Skip to content

Instantly share code, notes, and snippets.

@KennethEhmsen
Forked from glmdev/onedrive-ubu.sh
Created October 31, 2018 12:57
Show Gist options
  • Save KennethEhmsen/b6029cd5c6b16726506fc3c175e40002 to your computer and use it in GitHub Desktop.
Save KennethEhmsen/b6029cd5c6b16726506fc3c175e40002 to your computer and use it in GitHub Desktop.
A bash script to setup OneDrive integration with GNOME on Ubuntu.
#!/bin/sh
# onedrive-ubu.sh
# A BASH script to set up OneDrive integration with GNOME on Ubuntu
# Copyright (C) 2018 Garrett Mills (garrett@glmdev.tech)
# This software is licensed under the MIT License.
# This sofware is provided without warranty or even any implied intent of purpose.
#
# OnedriveD: https://github.com/xybu/onedrived-dev
#
# NOTE: This script downloads the NGROK binary from http://glmdev.tech/ngrok
# You can replace the download URL with your own, or install it manually from the NGROK website.
clear
echo "Setting up OneDrive for Ubuntu GNOME..."
sleep 1
echo "Authorize sudo..."
sudo echo "Success!"
echo "Verifying dependencies..."
sleep 1
sudo apt update > /dev/null
sudo apt install -y git build-essential python3-dev libssl-dev inotify-tools python3-pip python3-dbus > /dev/null
echo "Removing any old versions of onedrived..."
sudo pip3 uninstall -y onedrive_d onedrived > /dev/null
sudo rm -rf ~/.onedrive ~/.onedrived ~/.odd
echo "Downloading onedrived..."
git clone --quiet https://github.com/xybu/onedrived-dev.git ~/.odd > /dev/null
cd ~/.odd
echo "Installing onedrived..."
sudo python3 ./setup.py install > /dev/null
echo "Configuring onedrived..."
echo "Configuring account..."
onedrived-pref account add
echo "Configuring drive..."
onedrived-pref drive set
echo "Checking for ngrok..."
if ! which ngrok ; then
echo "Downloading ngrok... (this may take a while)"
cd /tmp
wget --quiet http://glmdev.tech/ngrok > /dev/null
sudo mv ngrok /usr/bin/ngrok
sudo chmod +x /usr/bin/ngrok
done
echo "Starting OneDrive daemon..."
onedrived start
echo "Modifying default user directories..."
rm -rf ~/.config/user-dirs.dirs
echo '
# This file was written by an automatic generator while
# setting up the OneDrive integration with onedrived.
XDG_DESKTOP_DIR="$HOME/OneDrive/Desktop"
XDG_DOWNLOAD_DIR="$HOME/Downloads"
XDG_TEMPLATES_DIR="$HOME/Templates"
XDG_PUBLICSHARE_DIR="$HOME/OneDrive/Public"
XDG_DOCUMENTS_DIR="$HOME/OneDrive/Documents"
XDG_MUSIC_DIR="$HOME/OneDrive/Music"
XDG_PICTURES_DIR="$HOME/OneDrive/Pictures"
XDG_VIDEOS_DIR="$HOME/OneDrive/Videos"
' > ~/.config/user-dirs.dirs
rm -rf ~/.config/user-dirs.conf
echo "enabled=false" > ~/.config/user-dirs.conf
echo "Creating auto-start entry..."
echo "
[Desktop Entry]
Name=OneDrive Daemon Autostart
Exec=onedrived start
Type=Application
X-GNOME-Autostart-enabled=true
" > ~/.config/onedrive_daemon.desktop
echo "Success!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment