Skip to content

Instantly share code, notes, and snippets.

@glmdev
Last active April 24, 2020 05:40
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save glmdev/6ab5bbdfde5da3b065eba3fb38f91c24 to your computer and use it in GitHub Desktop.
Save glmdev/6ab5bbdfde5da3b065eba3fb38f91c24 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
clear
echo "Checking for ngrok..."
if ! which ngrok ; then
echo "onedrived requires ngrok. Please download and install it from: https://ngrok.com/download"
exit 1
done
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 "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!"
@eduarddrenth
Copy link

line 16 => fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment