openwrt: add script to support block devices

This commit is contained in:
Nico Schottelius 2021-08-19 15:51:32 +02:00
parent 43e2cf3ee2
commit ef38b13e55

View 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