Raspberry pi OS 64bit β版の動作しているRaspberry pi 4BにOneDriveクライアントをインストールしました。
必要なソフトウェアのインストール
$ sudo apt install libcurl4-openssl-dev libsqlite3-dev libxml2 pkg-config ldc libnotify-dev
ソースコードのダウンロードとビルド
$ git clone https://github.com/abraunegg/onedrive.git $ cd onedrive $ ./configure $ make clean; make; $ sudo make install
動作確認
$ onedrive --display-config onedrive version = v2.4.6-16-g106e114 Config path = /home/pi/.config/onedrive Config file found in config path = false Config option 'check_nosync' = false Config option 'sync_dir' = /home/pi/OneDrive Config option 'skip_dir' = Config option 'skip_file' = ~*|.~*|*.tmp Config option 'skip_dotfiles' = false Config option 'skip_symlinks' = false Config option 'monitor_interval' = 300 Config option 'min_notify_changes' = 5 Config option 'log_dir' = /var/log/onedrive/ Config option 'classify_as_big_delete' = 1000 Config option 'sync_root_files' = false Selective sync 'sync_list' configured = false Business Shared Folders configured = false
認証
コマンドを実行するとURLが表示されるので、ブラウザでアクセスします。OneDriveの認証画面になり、認証させると空白のページが表示されます。この時のURLを入力します。
$ chmod 700 /home/pi/.config/onedrive/ $ onedrive --synchronize Configuring Global Azure AD Endpoints Authorize this app visiting: https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx <-ブラウザでアクセス Enter the response uri: https://login.microsoftonline.com/common/oauth2/nativeclient?code=yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy <-ブラウザからコピー Initializing the Synchronization Engine ... Syncing changes from OneDrive ... Creating local directory: ドキュメント Creating local directory: 画像
認証に成功すると同期が始まります。同期するフォルダ・ファイルを制限したい場合は、[^C]で一度中断させます。
ファイル・フォルダの指定
ファイル"~/.config/onedrive/sync_list"をエディタで開き同期させたいフォルダ・ファイルを列挙します。
$ vi ~/.config/onedrive/sync_list ファイルの編集 $ onedrive --synchronize --resync ファイルの同期
sync_listの例
Backup Documents/latest_report.docx Work/ProjectX notes.txt
自動的に起動
自動的に起動するように設定します。
$ systemctl --user enable onedrive $ systemctl --user start onedrive
参考
※コメント投稿者のブログIDはブログ作成者のみに通知されます