Dropbox
From Amahi
NOTE: Amahi Sync provides similar functionality to Dropbox for your HDA, with cloud mirroring and sharing
| WARNING | |
|---|---|
| This is recommended only for advanced users, proceed with caution. |
This guidance will instruct you how to add Dropbox capability to your HDA. Upon completion, you will have a share called Dropbox that will automatically synchronize with Dropbox service. There is an Amahi application in ALPHA that incorporates this guidance, but 3 scripts have to be executed manually to complete installation.
NOTE: This install method is for headless using SSH and a 64-bit machine, but can be adapted for 32-bit as noted. Additional guidance will be added for installation from the HDA desktop in the future.
PreRequisites
- Dropbox account. You can obtain one from http://www.dropbox.com for FREE that provides 2GB of storage space. There are plans for additional storage which require a small fee . DO NOT proceed with Install until you have a valid account.
- SSH access to your HDA.
Install (Headless via SSH)
- Use your favorite SSH client and log into your HDA.
- We will start from our user's home directory as your normal user, not root (replace user below with your HDA user):
| bash code |
|---|
| cd /home/user |
- Now we need to download some files (change x86_64 to x86 for 32-bit system):
| bash code |
|---|
| wget -O dropbox.tar.gz http://www.dropbox.com/download/?plat=lnx.x86_64 tar -xvzf dropbox.tar.gz |
- Execute the following command.
| bash code |
|---|
| ~/.dropbox-dist/dropboxd & |
- The SSH result should give you a URL with your host ID similar to the one below:
https://www.dropbox.com/cli_link?host_id=d2c11224f0gdb3rr592dw2d514c1ame
- In order to register this machine with, open a browser and navigate to that link. Login and if successful, you should see a message that says "This computer was successfully linked to your account." Now that your HDA is linked, the file synchronization process will begin. You will need to wait for it to complete before completing the Post Install steps.
- Next add capability to view your Dropbox status from command line (when it says "Dropbox is not running" or idle, proceed to Post Install):
| bash code |
|---|
| mkdir -p ~/bin wget -O ~/bin/dropbox.py "http://www.dropbox.com/download?dl=packages/dropbox.py" |
Post Install
- Create a share called Dropbox from the dashboard. Go to Setup, Shares and choose New Share. Enter the name as Dropbox.
- Lets direct the Dropbox service to that new share:
| bash code |
|---|
| ~/bin/./dropbox.py stop wget http://dl.dropbox.com/u/552/pyDropboxPath/1.0.1/pyDropboxPath.py |
- Move any existing files in your current HDA Dropbox to the new share:
| bash code |
|---|
| mv ~/Dropbox/* /var/hda/files/Dropbox |
NOTE: Recommend you back up this folder to another location. If something goes wrong. If you do not, you could lose all your files in your Dropbox account. Although they are recoverable from the Dropbox website, it can be time consuming if you have a lot of files.
- Lets tell Dropbox that our new folder is located here:
| bash code |
|---|
| rm -rf Dropbox ln -s /var/hda/files/Dropbox ~/ |
- We need to add the script below to start Dropbox service. Become root user and create /etc/init.d/dropbox. Insert the following text:
# chkconfig: 345 85 15
# description: Startup script for dropbox daemon
#
# processname: dropboxd
# pidfile: /var/run/dropbox.pid
# config: /etc/sysconfig/dropbox
#
### BEGIN INIT INFO
# Provides: dropboxd
# Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $syslog
# Should-Start: $syslog
# Should-Stop: $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start up the Dropbox file syncing daemon
# Description: Dropbox is a filesyncing sevice provided by dropbox.com
# This service starts up the dropbox daemon.
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
# To configure, add line with DROPBOX_USERS="user1 user2" to /etc/sysconfig/dropbox
# Probably should use a dropbox group in /etc/groups instead.
[ -f /etc/sysconfig/dropbox ] && . /etc/sysconfig/dropbox
prog=dropboxd
lockfile=${LOCKFILE-/var/lock/subsys/$prog}
config=${CONFIG-/etc/sysconfig/dropbox}
RETVAL=0
start() {
echo -n $"Starting $prog"
if [ -z $DROPBOX_USERS ] ; then
echo -n ": unconfigured: $config"
echo_failure
echo
rm -f ${lockfile} ${pidfile}
RETURN=6
return $RETVAL
fi
for dbuser in $DROPBOX_USERS; do
daemon --user $dbuser /bin/sh -c "/home/$dbuser/.dropbox-dist/dropboxd&"
done
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
status() {
for dbuser in $DROPBOX_USERS; do
dbpid=`pgrep -u $dbuser dropbox`
if [ -z $dbpid ] ; then
echo "dropboxd for USER $dbuser: not running."
else
echo "dropboxd for USER $dbuser: running (pid $dbpid)"
fi
done
}
stop() {
echo -n $"Stopping $prog"
for dbuser in $DROPBOX_USERS; do
killproc /home/$dbuser/.dropbox-dist/dropbox
done
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
# See how we were called.
case "$1" in
start)
start
;;
status)
status
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo $"Usage: $prog {start|status|stop|restart}"
RETVAL=3
esac
exit $RETVAL
- Create /etc/sysconfig/dropbox as root user and insert the following (replace user below with your HDA user):
| Text |
|---|
| DROPBOX_USERS="user" |
- Change the permissions as root user on the files at noted below:
| bash code |
|---|
| /bin/chmod 0755 /etc/init.d/dropbox /bin/chmod 0644 /etc/sysconfig/dropbox |
- Start/configure service to start on boot. As root user, do the following:
| bash code |
|---|
| chkconfig dropbox on service dropbox start |
That complete the setup of Dropbox on your HDA. Files will automatically download from your dropbox account to the HDA. To use it locally, put files in the share folder and they will automatically be uploaded to your Dropbox account.
Cleanup (OPTIONAL)
- You can move/delete most of the setup files. Do the following (replace user with your normal HDA user):
| bash code |
|---|
| cd /home/user rm -rf dropbox.tar.gz |
Tips
- Dropbox will continue to run and synchronize files on demand. If you want to temporarily stop it, do the following as your normal user:
| bash code |
|---|
| ./bin/dropbox.py stop |
then to restart
| bash code |
|---|
| ./bin/dropbox.py start |
- To stop it permanently, do the following as root user:
| bash code |
|---|
| service dropbox stop chkconfig dropbox off |
- If your share does not appear when doing \\hda, do the following as root user:
| bash code |
|---|
| service smb restart |
- To see options for Dropbox status, do the following as your normal HDA user (includes an option to get PUBLIC file URLs):
| bash code |
|---|
| ./bin/dropbox.py help |
Last update: Jan 2, 2012
