make relaunch.sh more generic, move IP info to deploy.pl
This commit is contained in:
parent
a0b3e8fa3d
commit
9db62fa0eb
32
relaunch.sh
32
relaunch.sh
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Copyright (c) 2019-2022 Mischa Peters <mischa @ openbsd.amsterdam>
|
# Copyright (c) 2019-2023 Mischa Peters <mischa @ openbsd.amsterdam>
|
||||||
#
|
#
|
||||||
# Permission to use, copy, modify, and distribute this software for any
|
# Permission to use, copy, modify, and distribute this software for any
|
||||||
# purpose with or without fee is hereby granted, provided that the above
|
# purpose with or without fee is hereby granted, provided that the above
|
||||||
|
@ -38,25 +38,34 @@ else
|
||||||
chmod 600 ${VMS}/${1}.txt
|
chmod 600 ${VMS}/${1}.txt
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
INSTANCE=$(awk -F'=' '/instance/ {print $2}' ${VMS}/${1}.txt | tr -d '"')
|
||||||
|
if [[ -z ${INSTANCE} ]]; then
|
||||||
|
INSTANCE=${1}
|
||||||
|
fi
|
||||||
|
|
||||||
deploy.pl
|
deploy.pl
|
||||||
rcctl restart dhcpd
|
sleep 10
|
||||||
|
if [[ -z ${DHCPD} ]]; then
|
||||||
|
rcctl restart dhcpd
|
||||||
|
fi
|
||||||
vmctl reload
|
vmctl reload
|
||||||
sleep 10
|
sleep 10
|
||||||
|
|
||||||
mkfifo -m 600 /tmp/pipe_${1}
|
mkfifo -m 600 /tmp/pipe_${1}
|
||||||
install -g mischa -m 600 -o mischa /dev/null ${LOGS}/${1}.log
|
install -g mischa -m 600 -o mischa /dev/null ${LOGS}/${1}.log
|
||||||
|
|
||||||
echo -n "autoinstall(8) ${1}, log output ${LOGS}/${1}.log... "
|
echo -n "autoinstall(8) ${INSTANCE}, log output ${LOGS}/${1}.log... "
|
||||||
|
|
||||||
vmctl start -c ${1} < /tmp/pipe_${1} | while read line; do
|
vmctl start -c ${INSTANCE} < /tmp/pipe_${1} | while read line; do
|
||||||
printf '%s\n' "$line" >&2
|
printf '%s\n' "$line" >&2
|
||||||
case $line in
|
case $line in
|
||||||
*rebooting...*)
|
*rebooting...*)
|
||||||
vmctl stop -f ${1}
|
vmctl stop -f ${INSTANCE}
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
#Response file location\?*)
|
#Response file location\?*)
|
||||||
#vmctl stop -f ${1}
|
#vmctl stop -f ${1}
|
||||||
|
#rm -rf /tmp/pipe_${1}
|
||||||
#rm -rf /var/vmm/${1}.qcow2
|
#rm -rf /var/vmm/${1}.qcow2
|
||||||
#pushover.pl -m "${SERVER} ${1} failed deploy" -t "OpenBSD Amsterdam" -p 1
|
#pushover.pl -m "${SERVER} ${1} failed deploy" -t "OpenBSD Amsterdam" -p 1
|
||||||
#exit 1
|
#exit 1
|
||||||
|
@ -67,13 +76,16 @@ done > /tmp/pipe_${1} 2> ${LOGS}/${1}.log
|
||||||
echo "completed"
|
echo "completed"
|
||||||
|
|
||||||
deploy.pl
|
deploy.pl
|
||||||
rcctl restart dhcpd
|
sleep 10
|
||||||
|
if [[ -z ${DHCPD} ]]; then
|
||||||
|
rcctl restart dhcpd
|
||||||
|
fi
|
||||||
vmctl reload
|
vmctl reload
|
||||||
sleep 10
|
sleep 10
|
||||||
|
|
||||||
echo "booting ${1}"
|
echo "booting ${INSTANCE}"
|
||||||
|
|
||||||
vmctl start -c ${1} < /tmp/pipe_${1} | while read line; do
|
vmctl start -c ${INSTANCE} < /tmp/pipe_${1} | while read line; do
|
||||||
printf '%s\n' "$line" >&2
|
printf '%s\n' "$line" >&2
|
||||||
case $line in
|
case $line in
|
||||||
*tty00*)
|
*tty00*)
|
||||||
|
@ -85,6 +97,6 @@ done > /tmp/pipe_${1} 2>> ${LOGS}/${1}.log
|
||||||
rm -rf /tmp/pipe_${1}
|
rm -rf /tmp/pipe_${1}
|
||||||
|
|
||||||
echo
|
echo
|
||||||
echo "SUCCES! - re-deployed ${1}"
|
echo "SUCCES! - re-deployed ${INSTANCE}"
|
||||||
notify.pl redeployed ${1}
|
notify.pl redeployed ${1}
|
||||||
pushover.pl -m "${SERVER} ${1} re-deployed" -t "OpenBSD Amsterdam"
|
pushover.pl -m "${SERVER} ${INSTANCE} re-deployed" -t "OpenBSD Amsterdam"
|
||||||
|
|
Loading…
Reference in New Issue