Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial release with dropbox-filesystem-fix integrated #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,24 @@ ENV DEBIAN_FRONTEND noninteractive

# Following 'How do I add or remove Dropbox from my Linux repository?' - https://www.dropbox.com/en/help/246
RUN echo 'deb http://linux.dropbox.com/debian jessie main' > /etc/apt/sources.list.d/dropbox.list \
&& apt-key adv --keyserver pgp.mit.edu --recv-keys 1C61A2656FB57B7E4DE0F4C1FC918B335044912E \
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1C61A2656FB57B7E4DE0F4C1FC918B335044912E \
&& apt-get -qqy update \
# Note 'ca-certificates' dependency is required for 'dropbox start -i' to succeed
&& apt-get -qqy install ca-certificates curl python-gpgme dropbox \
&& apt-get -qqy install ca-certificates curl python-gpgme dropbox git build-essential locales\
# Perform image clean up.
&& apt-get -qqy autoclean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \
# Create service account and set permissions.
&& groupadd dropbox \
&& useradd -m -d /dbox -c "Dropbox Daemon Account" -s /usr/sbin/nologin -g dropbox dropbox
&& useradd -m -d /dbox -c "Dropbox Daemon Account" -s /usr/sbin/nologin -g dropbox dropbox \
&& cd /tmp \
&& git clone https://github.com/dark/dropbox-filesystem-fix.git \
&& cd dropbox-filesystem-fix \
&& make \
&& cd /tmp \
&& mv dropbox-filesystem-fix /opt/ \
&& chmod +x /opt/dropbox-filesystem-fix/dropbox_start.py \
&& rm -rf /tmp/dropbox-filesystem-fix

# Dropbox is weird: it insists on downloading its binaries itself via 'dropbox
# start -i'. So we switch to 'dropbox' user temporarily and let it do its thing.
Expand Down Expand Up @@ -41,6 +49,13 @@ RUN mkdir -p /opt/dropbox \
# Prepare for command line wrapper
&& mv /usr/bin/dropbox /usr/bin/dropbox-cli

# Set locale for dropbox status output
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && \
dpkg-reconfigure --frontend=noninteractive locales && \
update-locale LANG=en_US.UTF-8

ENV LANG en_US.UTF-8

# Install init script and dropbox command line wrapper
COPY run /root/
COPY dropbox /usr/bin/dropbox
Expand Down
16 changes: 15 additions & 1 deletion run
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,18 @@ fi

echo "Starting dropboxd ($(cat /opt/dropbox/VERSION))..."
umask 002
exec su dropbox -s /bin/bash -c /opt/dropbox/dropboxd
#exec su dropbox -s /bin/bash -c /opt/dropbox/dropboxd
echo "Patching dropbox_start.py for updated dropboxd path"
sed -i "s:~/.dropbox-dist/dropboxd:/opt/dropbox/dropboxd:g" /opt/dropbox-filesystem-fix/dropbox_start.py

su dropbox -s /bin/bash -c /opt/dropbox-filesystem-fix/dropbox_start.py

#Loop until dropbox dies
#while [ $(ps -ef | grep dropbox | grep -v grep | wc -l) -ge 1 ]
#Replaced with infinite loop in case dropbox restarts itself
#To Do: Replace with something more elegant
while [ 1 -gt 0 ]
do
dropbox status
sleep 1
done