Skip to content

Instantly share code, notes, and snippets.

@gnue
Last active June 9, 2019 07:19
Show Gist options
  • Save gnue/a58a43943a80c55db6d2d7c950d989ad to your computer and use it in GitHub Desktop.
Save gnue/a58a43943a80c55db6d2d7c950d989ad to your computer and use it in GitHub Desktop.
Raspberry Pi を USB-Ethernetデバイスで使えるように boot ボリュームを書き換える
#!/bin/bash
# for macOS
cd /Volumes/boot
dtoverlay="dtoverlay=dwc2"
module_load="modules-load=dwc2,g_ether"
if [ -z $(grep "^$dtoverlay$" config.txt 2>/dev/null) ]; then
echo "$dtoverlay" | tee -a config.txt
fi
if [[ -z $(grep "$module_load" cmdline.txt 2>/dev/null) ]]; then
echo "$module_load"
sed -i.bak "s/rootwait/rootwait $module_load/" cmdline.txt
fi
touch ssh
@gnue
Copy link
Author

gnue commented Jun 9, 2019

macOS用なので cd /Volumes/boot しています。
他の環境で使う場合は boot ボリュームのマウントポイントに合わせて変更して下さい。

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