Skip to content

Instantly share code, notes, and snippets.

@codingtony
Last active December 18, 2018 14:19
Show Gist options
  • Save codingtony/1f2742dad916ae867496f05cc2c8a333 to your computer and use it in GitHub Desktop.
Save codingtony/1f2742dad916ae867496f05cc2c8a333 to your computer and use it in GitHub Desktop.
Script inspired by the blog post : https://metabubble.net/linux/how-to-keep-using-dropbox-even-if-you-dont-use-unencrypted-ext4-workaround/ to continue to use dropbox on an encrypted home.
#!/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