openwrt: add script to support block devices
This commit is contained in:
parent
43e2cf3ee2
commit
ef38b13e55
1 changed files with 28 additions and 0 deletions
28
openwrt/openwrt-add-usb-stick.sh
Executable file
28
openwrt/openwrt-add-usb-stick.sh
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/sh
|
||||
# Nico Schottelius
|
||||
# 2021-01-07
|
||||
# Based on https://openwrt.org/docs/guide-user/storage/usb-drives-quickstart
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "$0 ip-address nat64-prefix"
|
||||
echo " ip-address: where to find the OpenWRT device"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
my_ip=$1; shift
|
||||
|
||||
cat <<EOF | ssh -t "root@${my_ip}"
|
||||
set -x
|
||||
|
||||
opkg update
|
||||
opkg install block-mount e2fsprogs kmod-fs-ext4 kmod-usb-storage kmod-usb2 kmod-usb3
|
||||
|
||||
echo y | mkfs.ext4 /dev/sda1
|
||||
|
||||
block detect | uci import fstab
|
||||
|
||||
uci set fstab.@mount[0].enabled='1' && uci set fstab.@global[0].anon_mount='1' && uci commit fstab
|
||||
|
||||
/etc/init.d/fstab boot
|
||||
|
||||
EOF
|
Loading…
Reference in a new issue