ungleich-tools/openwrt/vigir-4-cleanup.sh

44 lines
854 B
Bash
Raw Normal View History

2020-12-21 19:24:52 +00:00
#!/bin/sh
# Nico Schottelius
# 2020-12-21
set -e
set -x
if [ $# -ne 2 ]; then
echo "$0 vigir-ip-address vigir-id"
echo " vigir-ip-address: where to find the vigir"
echo " vigir-id: number in decimal format"
exit 1
fi
vigir_ip=$1; shift
id=$1; shift
vigir_hostname=vigir${id}
root_password=$(pwgen -1 32)
cat <<EOF | ssh -t "root@${vigir_ip}"
# Remove temporary IP
# Correct test SSID to final one
uci set wireless.default_radio0.ssid='IPv6 everywhere'
2020-12-22 07:54:49 +00:00
uci set wireless.default_radio1.ssid='IPv6 everywhere 5Ghz'
2020-12-21 19:24:52 +00:00
uci commit
# Remove our ssh keys
rm -f /etc/dropbear/authorized_keys
# Setup root password
printf "${root_password}\n${root_password}\n" | passwd
reboot
EOF
printf "${root_password}\n${root_password}\n" | pass insert vigir/vigir${id}
pass git push
2020-12-21 19:24:52 +00:00
echo "Submit to user the root password = ${root_password}"