下準備
必要なパッケージをインストールする。
[email protected] $ sudo apt install libcurl4-openssl-dev libsqlite3-dev gdebi
[email protected] $ wget http://downloads.dlang.org/releases/2020/dmd_2.090.1-0_amd64.deb [email protected] $ sudo gdebi dmd_2.090.1-0_amd64.deb
OneDrive Client のインストール
[email protected] $ git clone [email protected]:skilion/onedrive.git [email protected] $ cd onedrive [email protected] $ make [email protected] $ sudo make install
設定ファイルのコピー
[email protected] $ mkdir -p ~/.config/onedrive [email protected] $ cp ./config ~/.config/onedrive/config
デフォルトの設定ファイルはつぎのようになっている。
# Directory where the files will be synced sync_dir = "~/OneDrive" # Skip files and directories that match this pattern skip_file = ".*|~*"
サービスの起動
[email protected] $ systemctl --user enable onedrive [email protected] $ systemctl --user start onedrive
初回起動
サービスとして起動したら、onedrive コマンドを実行。
[email protected] $ onedrive
すると、端末にメッセージが表示される。「Authorize this app visiting:
」につづいて URL が表示されるので、これをコピーしてブラウザでアクセスし、Microsoftアカウントにログインする。アプリから OneDrive へのアクセスを許可するかと聞かれるので「はい」を選択。新しい、空白のページが表示されるので、このページの URL をコピーして端末に戻り、「Enter the response uri:
」のあとに貼り付けてエンター。これでファイルの同期が始まる。
自動起動の設定
ファイルの同期を続けるためには、onedrive コマンドを実行しておく必要があるらしい。Ubuntu にログインするときに自動的に実行するように設定する。
Alt+F2 キーを押してアクティビティ画面を表示し、「gnome-session-properties」を検索。出てきたアイコンをクリックすると「自動的に起動するプログラムの追加」ウィンドウが表示される。ここに onedrive -m コマンドを追加する。