From 22d9efb69677c6c0bdb72b6b3aba83fd62469039 Mon Sep 17 00:00:00 2001 From: James Freeman Date: Tue, 11 Jun 2019 16:47:40 +0100 Subject: [PATCH] Initial release with docker-filesystem-fix integrated --- Dockerfile | 21 ++++++++++++++++++--- run | 16 +++++++++++++++- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 17db4fc..34214fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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. @@ -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 diff --git a/run b/run index 2f4c167..64e24d0 100755 --- a/run +++ b/run @@ -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