#!/bin/sh
#
# The Initial Developer of the Original Code is orrie.
#
# Portions created by the Initial Developer are Copyright (c) 2009 by the Initial Developer.
# All Rights Reserved.
#
# Contributor: Ørjan Alexander Jacobsen <code@orrie.org>


echo	"You will now disable the execution of Dropbox for individual users"
echo	"then you'll add the users that want to run Dropbox at startup."
echo	"TO CONTINUE THIS OPERATION YOU MUST BE ROOT."
echo	" "

echo	"Users on this computer:"
awk -F: '$4 >= 500 { print $1 }' /etc/passwd
echo	" "
echo	"REMEMBER TO WRITE JUST ONE USERNAME! (If you want to add more users you can run this script again)"
echo	"Type in the username for the user who want's to use Dropbox: "
read userinput

echo	" "

sudo addgroup dropbox

echo	" "

sudo chown root:dropbox /usr/lib/nautilus/extensions-2.0/libnautilus-dropbox.*
echo	"Root in the group dropbox is now owner of the files matching this request:"
echo	"«/usr/lib/nautilus/extensions-2.0/libnautilus-dropbox.*»"

echo	" "

sudo chmod 640 /usr/lib/nautilus/extensions-2.0/libnautilus-dropbox.*
echo	"Root has now read and write-access, the group «dropbox» has read and other has no access"
echo	"to the files matching this request:"
echo	"«/usr/lib/nautilus/extensions-2.0/libnautilus-dropbox.*»"

echo	" "

sudo adduser $userinput dropbox

echo	" "

echo	"The user «$userinput» will now have enabled the execution of Dropbox at startup."
echo	"If you wish to add more users to this group, you can run this script again by typing:"
echo	"sh disable-dropbox.sh"

