42 lines
794 B
Bash
Executable file
42 lines
794 B
Bash
Executable file
#!/bin/sh
|
|
# Nico Schottelius
|
|
# 2020-06-14
|
|
|
|
|
|
if [ $# -ne 2 ]; then
|
|
echo "$0 viwib-ip-address viwib-id"
|
|
echo " viwib-ip-address: where to find the viwib"
|
|
echo " viwib-id: number in decimal format"
|
|
exit 1
|
|
fi
|
|
|
|
set -e
|
|
set -x
|
|
|
|
viwib_ip=$1; shift
|
|
|
|
id=$1; shift
|
|
viwib_hostname=viwib${id}
|
|
|
|
root_password=$(pwgen -1 32)
|
|
|
|
cat <<EOF | ssh -t "root@${viwib_ip}"
|
|
# Remove temporary IP
|
|
|
|
# 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
|
|
|
|
reboot
|
|
EOF
|
|
|
|
printf "${root_password}\n${root_password}\n" | pass insert viwib/viwib${id}
|
|
pass git push
|
|
|
|
echo "Submit to user the root password = ${root_password}"
|