LinuxでOneDriveを使用する

スポンサーリンク

Ubuntu20.04でOneDriveを使用できるようにします。GitHubのページでコマンドをコピペするだけです。そのためには最初に依存関係をインストールします。

GitHub - abraunegg/onedrive: OneDrive Client for Linux
OneDrive Client for Linux. Contribute to abraunegg/onedrive development by creating an account on GitHub.
sudo apt install build-essential
sudo apt install libcurl4-openssl-dev
sudo apt install libsqlite3-dev
sudo apt install pkg-config
sudo apt install git
sudo apt install curl
curl -fsS https://dlang.org/install.sh | bash -s dmd

mamushi@mamushipc:~$ curl -fsS https://dlang.org/install.sh | bash -s dmd
Downloading https://dlang.org/d-keyring.gpg

################################################################## 100.0%

Downloading https://dlang.org/install.sh

################################################################## 100.0%

The latest version of this script was installed as ~/dlang/install.sh.
It can be used it to install further D compilers.
Run ~/dlang/install.sh --help for usage information.

Downloading and unpacking http://downloads.dlang.org/releases/2.x/2.098.1/dmd.2.098.1.linux.tar.xz

################################################################## 100.0%

Using dub 1.27.0 shipped with dmd-2.098.1

Run source ~/dlang/dmd-2.098.1/activate in your shell to use dmd-2.098.1.
This will setup PATH, LIBRARY_PATH, LD_LIBRARY_PATH, DMD, DC, and PS1.
Run deactivate later on to restore your environment.

Curlコマンドを使用した時に表示された内容をメモしておきます。この場合は下記をターミナルにコピペします。D言語をアクティブにするということらしいです。なお、これを行うとターミナルでユーザー名の前にdmdが付きます。

source ~/dlang/dmd-2.098.1/activate

次はGITからファイルをとってきて設定およびインストールをします。

git clone https://github.com/abraunegg/onedrive.git
cd onedrive
./configure
make clean; make;
sudo make install

ここまで終わったら、先ほどのD言語を非アクティブにするか、一度ターミナルを起動しなおします。
onedriveと入力するとURLが表示されるので、レスポンスURLを入力するように求められます。そこで、ブラウザで表示されたこのURLにアクセスします。


OneDriveのユーザー名とパスワードを入力して進むと空白のページが表示されます。この空白のページのURLがレスポンスURLですので、これをターミナルに貼り付けて完了です。

それではLinux版のOneDriveで同期をしてみましょう。構成内容を確認します。

onedrive --display-config

全て同期するコマンドを入力しますが、後ろにdry-runを付けると検証するとこができます。ファイルのダウンロード、アップロード、削除が表示されますがテストなので実際には行われていません。

onedrive --synchronize --verbose --dry-run

全部同期する必要はなかったので一部だけを同期することにしました。OneDriveの下の単一フォルダを同期しました。

onedrive --synchronize --single-directory '<dir_name>'

mamushi@mamushipc:~$ onedrive –synchronize –single-directory ‘linux’
Configuring Global Azure AD Endpoints
Initializing the Synchronization Engine …
WARNING: The requested path for –single-directory does not exist locally. Creating requested path within /home/mamushi/OneDrive
Syncing changes from selected OneDrive path …
Downloading file linux/test.ods … done.
Downloading file linux/kehai.xlsx … done.
Uploading differences of linux
Uploading new items of linux

他にも一方向の同期もあるみたいです。

タイトルとURLをコピーしました