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
参考
Raspberry pi OSの初期ユーザー名はpiとなっていますが、これを変更する方法です。
作業用ユーザーの作成
$ sudo adduser worku ユーザ `worku' を追加しています... 新しいグループ `worku' (1001) を追加しています... 新しいユーザ `worku' (1001) をグループ `worku' として追加しています... ホームディレクトリ `/home/worku' を作成しています... `/etc/skel' からファイルをコピーしています... 新しいパスワード: 新しいパスワードを再入力してください: passwd: パスワードは正しく更新されました worku のユーザ情報を変更中 新しい値を入力してください。標準設定値を使うならリターンを押してください フルネーム []: 部屋番号 []: 職場電話番号 []: 自宅電話番号 []: その他 []: 以上で正しいですか? [Y/n] Y $ sudo gpasswd -a worku sudo ユーザ worku をグループ sudo に追加 $
自動ログインの無効化

無効後に再起動させ作業用ユーザーworkuでログインします。
変更作業
workuでログイン後変更作業を行います。
$ who worku tty7 2020-11-04 14:14 (:0) worku pts/1 2020-11-04 14:15 (172.16.200.251) $
他のユーザーがログインしていないことを確認してから、ユーザー"pi"を新しいIDの"newid"に変更します。
$ sudo usermod -l newid pi
あなたはシステム管理者から通常の講習を受けたはずです。
これは通常、以下の3点に要約されます:
#1) 他人のプライバシーを尊重すること。
#2) タイプする前に考えること。
#3) 大いなる力には大いなる責任が伴うこと。
[sudo] worku のパスワード:
$ sudo usermod -d /home/newid -m newid
$ sudo groupmod -n newid pi
$ sudo passwd newid
この後設定ファイル内のユーザー"pi"を"newid"に変更します。
$ sudo vi /etc/lightdm/lightdm.conf
リストは抜粋 変更部部分赤字
#greeter-show-remote-login=true
#user-session=default
#allow-user-switching=true
#allow-guest=true
#guest-session=
#session-wrapper=lightdm-session
#greeter-wrapper=
#guest-wrapper=
display-setup-script=/usr/share/dispsetup.sh
#display-stopped-script=
#greeter-setup-script=
#session-setup-script=
#session-cleanup-script=
#autologin-guest=false
autologin-user=newid
#autologin-user-timeout=0
#autologin-in-background=false
#autologin-session=
#exit-on-failure=false
#
# XDMCP Server configuration
#
$ sudo vi /etc/systemd/system/autologin@.serviceリストは抜粋 変更部分赤字
# getty.target didn't actually pull it in.
Before=getty.target
IgnoreOnIsolate=yes
# On systems without virtual consoles, don't start any getty. Note
# that serial gettys are covered by serial-getty@.service, not this
# unit.
ConditionPathExists=/dev/tty0
[Service]
# the VT is cleared by TTYVTDisallocate
ExecStart=-/sbin/agetty --autologin newid --noclear %I $TERM
Type=idle
Restart=always
RestartSec=0
UtmpIdentifier=%I
TTYPath=/dev/%I
TTYReset=yes
TTYVHangup=yes
TTYVTDisallocate=yes
KillMode=process
IgnoreSIGPIPE=no
SendSIGHUP=yes
$ sudo vi /etc/sudoers.d/010_pi-nopasswd
変更部分赤字
newid ALL=(ALL) NOPASSWD: ALL
最後に作業用ユーザーを削除して再起動します。
sudo userdel -r worku
参考
発熱量が多いといわれるRaspberry Pi4にファンをつけて空冷してみました。

温度
CPU負荷率100%で1時間放置してみました。

回路

プログラム
ファン制御プログラム
#!/bin/sh gpio -g mode 18 pwm gpio pwm-ms gpio pwmc 2 gpio pwmr 256 gpio -g pwm 18 0 while : do DAY=`date` TEMP=`cat /sys/class/thermal/thermal_zone0/temp` echo "$DAY : $TEMP" if [ $TEMP -gt 70000 ] then gpio -g pwm 18 255 else if [ $TEMP -gt 60000 ] then gpio -g pwm 18 200 else if [ $TEMP -gt 50000 ] then gpio -g pwm 18 100 else if [ $TEMP -lt 40000 ] then gpio -g pwm 18 0 fi fi fi fi sleep 3 done
参考
Raspberry Pi OS 64bitのβ版を使用していますが、標準でインストールされているWiringpiが動作しません。githubに最新のバージョンがあったので、これをインストールしたら動くようになりました。インストールの記録です。
$ sudo apt purge wiringpi $ sudo apt autoremove $ git clone https://github.com/WiringPi/WiringPi.git $ cd WiringPi $ ./build
以上でコンパイル&インストールが終わります。
Rsapberry PiにVisual Studio Codeを簡単にインストールする方法を見つけました。インストールするのはオープンソース版のVSCodiumになります。
最初にパッケージ管理のシステム snapをインストールします。
$ sudo apt update $ sudo apt install snapd
再起動を行い、
vscodiumをインストールします。
$ sudo snap install codium --classic
次のコマンドで起動します。
$ codium

追記
Visual Studio Codeのサイトから直接ダウンロードできるようになりました。
参考