Skip to content

Instantly share code, notes, and snippets.

@codingtony
Created December 18, 2018 14:18
Show Gist options
  • Save codingtony/cb13fb9bdb0cf5acccba61545722654d to your computer and use it in GitHub Desktop.
Save codingtony/cb13fb9bdb0cf5acccba61545722654d to your computer and use it in GitHub Desktop.
#!/bin/bash
# https://metabubble.net/linux/how-to-keep-using-dropbox-even-if-you-dont-use-unencrypted-ext4-workaround/
if [[ -f ~/.dropbox/storage ]]; then
echo "File exist please revert installation manually if you want to install"
echo "Know what you are doing..."
echo "======"
echo "pkill -9 dropbox"
echo "umount ~/Dropbox"
echo "sudo chattr -i ~/Dropbox"
echo "rm -rf ~/Dropbox"
echo "rm -rf ~/.dropbox/storage"
echo "edit /etc/fstab"
exit 1
fi
GB=5
if [[ ! -d ~/Dropbox.bak ]]; then
echo "Creating backup of ~/Dropbox to ~/Dropbox.bak"
mv ~/Dropbox ~/Dropbox.bak
fi
if [[ ! -d ~/Dropbox ]]; then
mkdir ~/Dropbox
sudo chattr +i ~/Dropbox
fi
echo "Creating a volume of ${GB} GB"
dd if=/dev/zero of=~/.dropbox/storage bs=1M count=$((${GB}*1024))
mkfs.ext4 ~/.dropbox/storage
grep -q Dropbox /etc/fstab || echo "/home/${USER}/.dropbox/storage /home/${USER}/Dropbox ext4 defaults,noauto,user,user_xattr,loop 0 0" | sudo tee -a /etc/fstab
mount ~/Dropbox
sudo chown -R $(id -u $USER):$(id -g $USER) ~/Dropbox
mv ~/Dropbox.bak/* ~/Dropbox/
rm -rf ~/Dropbox.bak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment