Skip to content

Instantly share code, notes, and snippets.

@fernandolopez
Last active December 14, 2020 19:50
Show Gist options
  • Save fernandolopez/5675457 to your computer and use it in GitHub Desktop.
Save fernandolopez/5675457 to your computer and use it in GitHub Desktop.
Boxed Dropbox permite ejecutar al mismo tiempo múltiples instancias de Dropbox asociadas a distintas cuentas.Requiere zenity y dropbox ya instalado en el PATH del sistema (paquete nautilus-dropbox en Debian).Si existe $HOME/Dropbox RENOMBRARLO o BORRARLO de otra manera el script descargará todo dentro del mismo.Uso:- Descargar en el home del usu…
#!/bin/sh
# run_boxed_dropbox.sh permite ejecutar al mismo tiempo múltiples
# instancias de Dropbox asociadas a distintas cuentas.
# Copyright (C) 2013 Fernando López <flopez [at] linti.unlp.edu.ar>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Boxed Dropbox permite ejecutar al mismo tiempo múltiples instancias de Dropbox asociadas a distintas cuentas.
#
# Requiere zenity y dropbox ya instalado en el PATH del sistema (paquete nautilus-dropbox en Debian).
#
# ##### IMPORTANTE #####
# Si existe $HOME/Dropbox RENOMBRARLO o BORRARLO de otra manera el script descargará todo dentro del mismo.
# ######################
# Uso:
# - Descargar en el home del usuario
# - chmod +x run_boxed_dropbox.sh
# - ./run_boxed_dropbox.sh
# - Seguir las instrucciones (luego arrancará automáticamente en el inicio de sesión)
accounts="cuenta1 cuenta2"
boxit(){
HOME="$1" dropbox stop
HOME="$1" dropbox start -i
}
info(){
zenity --info --title "$1" --text "$2"
}
autoexecit(){
mkdir -p "$HOME/.config/autostart/"
cat > "$HOME/.config/autostart/boxed_dropbox.desktop" <<EOF
[Desktop Entry]
Name=Dropbox
GenericName=File Synchronizer
Comment=Sync your files across computers and to the web
Exec=$(cd "$(dirname "$0")"; pwd)/$(basename $0)
Terminal=false
Type=Application
Icon=dropbox
Categories=Network;FileTransfer;
StartupNotify=false
EOF
}
# Setup first time
if [ ! -e "$HOME/Dropbox" ]; then
for account in $accounts; do
mkdir -p "$HOME/Dropbox/.$account"
ln -s "$HOME/Dropbox/.$account/Dropbox" "$HOME/Dropbox/$account"
info "Boxed Dropbox" "A continuación ingrese los datos de la cuenta: $account.\n\nDespués cierre este diálogo para seguir configurando el resto de las cuentas."
boxit "$HOME/Dropbox/.$account"
done
autoexecit
exit 0
fi
for account in $accounts; do
boxit "$HOME/Dropbox/.$account" &
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment