2020-06-14 20:39:49 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Nico Schottelius
|
|
|
|
# 2020-06-14
|
|
|
|
|
|
|
|
set -e
|
|
|
|
set -x
|
|
|
|
|
2020-06-14 20:54:40 +00:00
|
|
|
if [ $# -ne 2 ]; then
|
|
|
|
echo "$0 viirb-ip-address viirb-id"
|
|
|
|
echo " viirb-ip-address: where to find the viirb"
|
|
|
|
echo " viirb-id: number in decimal format"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2020-06-14 20:39:49 +00:00
|
|
|
viirb_ip=$1; shift
|
2020-06-14 20:54:40 +00:00
|
|
|
|
|
|
|
id=$1; shift
|
|
|
|
viirb_hostname=viirb${id}
|
|
|
|
|
2020-06-14 20:39:49 +00:00
|
|
|
root_password=$(pwgen -1 32)
|
|
|
|
|
|
|
|
cat <<EOF | ssh -t "root@${viirb_ip}"
|
|
|
|
# Remove temporary IP
|
|
|
|
uci delete network.lanv4temp
|
|
|
|
|
|
|
|
# Correct test SSID to final one
|
|
|
|
uci set wireless.default_radio0.ssid='IPv6 everywhere'
|
|
|
|
uci commit
|
|
|
|
|
|
|
|
# Remove our ssh keys
|
|
|
|
rm -f /etc/dropbear/authorized_keys
|
|
|
|
|
|
|
|
# Setup root password
|
|
|
|
printf "${root_password}\n${root_password}\n" | passwd
|
2021-08-02 15:23:26 +00:00
|
|
|
|
|
|
|
# Ensure everything's good
|
|
|
|
reboot
|
2020-06-14 20:39:49 +00:00
|
|
|
EOF
|
|
|
|
|
2021-08-13 10:21:30 +00:00
|
|
|
printf "${root_password}\n${root_password}\n" | pass insert viirb/viirb${id}
|
|
|
|
pass git push
|
|
|
|
|
2020-06-14 20:54:40 +00:00
|
|
|
echo "Submit to user the root password = ${root_password}"
|