44 lines
894 B
Bash
Executable file
44 lines
894 B
Bash
Executable file
#!/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)
|
|
|
|
# Save for sending to user
|
|
# FIXME: future make this more easy / better to transfer
|
|
echo $root_password > ${vigir_hostname}.rootpw
|
|
|
|
cat <<EOF | ssh -t "root@${vigir_ip}"
|
|
# Remove temporary IP
|
|
|
|
# Correct test SSID to final one
|
|
uci set wireless.default_radio0.ssid='IPv6 everywhere'
|
|
uci set wireless.default_radio1.ssid='IPv6 everywhere 5Ghz'
|
|
|
|
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
|
|
|
|
echo "Submit to user the root password = ${root_password}"
|