Created
April 18, 2012 17:20
-
-
Save denzuko/2415192 to your computer and use it in GitHub Desktop.
Dropbox CLI Installer - Installs Dropbox cloud file sync service onto a full CLI based linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Dropbox CLI Installer | |
| # Version 1.0b - Dwight Spencer <dspencer@odesk.com> | |
| # Copyright (C)2009 CompuTEK Industries, LLC. All Rights Reserved. | |
| # | |
| # Installs Dropbox cloud file sync service onto a full CLI based linux | |
| # $ installer=./dropbox_installer.sh; chmod +x $installer && ./$installer | |
| # | |
| function grab() | |
| { | |
| curl ${1} | tar zxof - | |
| } | |
| function install_daemon() | |
| { | |
| echo >/tmp/dropbox<<ENDF | |
| #!/bin/sh | |
| # chkconfig: 345 85 15 | |
| # description: Startup script for dropbox daemon | |
| # | |
| # processname: dropboxd | |
| # pidfile: /var/run/dropbox.pid | |
| # | |
| # Source function library. | |
| . /etc/rc.d/init.d/functions | |
| DROPBOX_USERS="user1 user2" | |
| [ -e /etc/sysconfig/dropbox ] && . /etc/sysconfig/dropbox | |
| prog=dropboxd | |
| lockfile=${LOCKFILE-/var/lock/subsys/dropbox} | |
| RETVAL=0 | |
| start() { | |
| echo -n $"Starting $prog" | |
| for dbuser in $DROPBOX_USERS; do | |
| daemon --user $dbuser ~${dbuser}/.dropbox-dist/dropboxd | |
| done | |
| RETVAL=$? | |
| echo | |
| [ $RETVAL = 0 ] && touch ${lockfile} | |
| return $RETVAL | |
| } | |
| stop() { | |
| echo -n $"Stopping $prog" | |
| for dbuser in $DROPBOX_USERS; do | |
| killproc ~${dbuser}/.dropbox-dist/dropboxd | |
| done | |
| RETVAL=$? | |
| echo | |
| [ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile} | |
| } | |
| restart() | |
| { | |
| stop && start | |
| } | |
| # See how we were called. | |
| case "$1" in | |
| start) start;; | |
| stop) stop;; | |
| restart) restart;; | |
| *) | |
| echo $"Usage: $prog {start|stop|restart}" | |
| RETVAL=3 | |
| esac | |
| exit $RETVAL | |
| ENDF | |
| sudo install -m 755 /tmp/dropbox /etc/init.d/dropbox | |
| } | |
| site=http://dl.getdropbox.com | |
| version=lnx.x86-0.6.427 | |
| echo "Creating ./.dropbox-dist and ~/Dropbox" | |
| [ ! -d ~/Dropbox ] && mkdir ~/Dropbox | |
| [ ! -e ~/.dropbox-dist ] && grab ${site}/u/17/dropbox-${version}.tar.gz | |
| for x in db{makefakelib,readconfig}.py; do | |
| [ ! -e $x ] && curl -s -O ${site}/u/6995/$x && chmod +x $x | |
| done | |
| echo "Dropbox created and syncing with cloud server" | |
| for x in db{makefakelib,readconfig}.py; do | |
| /usr/bin/env python $x >> install.log | |
| done | |
| rm fakelib.c db{makefilelib,readconfig}.py | |
| nohup ./.dropbox-dist/dropboxd >/dev/null & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment