Skip to content

Commit

Permalink
add reboot.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
neil committed Dec 3, 2023
1 parent 900d5b7 commit d30f0a4
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 10 deletions.
37 changes: 31 additions & 6 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ done

$vmsh startVM $osname


sleep 2


###############################################
Expand All @@ -107,7 +107,6 @@ if [ ! -e ~/.ssh/id_rsa ] ; then
ssh-keygen -f ~/.ssh/id_rsa -q -N ""
fi


cat enablessh.txt >enablessh.local


Expand Down Expand Up @@ -162,6 +161,34 @@ if [ "$VM_PRE_INSTALL_PKGS" ]; then
ssh $osname sh <<<"$VM_INSTALL_CMD $VM_PRE_INSTALL_PKGS"
fi


#upload reboot.sh
if [ -e "hooks/reboot.sh" ]; then
echo "hooks/reboot.sh"
cat "hooks/reboot.sh"
scp hooks/reboot.sh $osname:/reboot.sh
else
ssh "$osname" "cat - >/reboot.sh" <<EOF
sleep 5
ssh host "touch $osname.rebooted"
EOF
fi


#set cronjob
ssh "$osname" sh <<EOF
chmod +x /reboot.sh
cat /reboot.sh
if uname -a | grep SunOS >/dev/null; then
crontab -l | { cat; echo "@reboot /reboot.sh"; } | crontab --
else
crontab -l | { cat; echo "@reboot /reboot.sh"; } | crontab -
fi
crontab -l
EOF


ssh $osname "$VM_SHUTDOWN_CMD"

sleep 5
Expand Down Expand Up @@ -197,11 +224,9 @@ echo "Checking the packages: $VM_RSYNC_PKG $VM_SSHFS_PKG"
if [ -z "$VM_RSYNC_PKG$VM_SSHFS_PKG" ]; then
echo "skip"
else
$vmsh addSSHAuthorizedKeys $osname-$VM_RELEASE-id_rsa.pub
$vmsh startVM $osname

waitForText "$VM_LOGIN_TAG"
sleep 2

$vmsh waitForVMReady $osname
ssh $osname sh <<<"$VM_INSTALL_CMD $VM_RSYNC_PKG $VM_SSHFS_PKG"
fi

Expand Down
2 changes: 1 addition & 1 deletion conf/netbsd-9.0.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ VM_OPTS="conf/netbsd-9.0.opts.txt"

VM_VBOX="./vbox.sh"

VM_VBOX_LINK="https://raw.githubusercontent.com/vmactions/vbox/v0.9.3/vbox.sh"
VM_VBOX_LINK="https://raw.githubusercontent.com/vmactions/vbox/v0.9.4/vbox.sh"


2 changes: 1 addition & 1 deletion conf/netbsd-9.1.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ VM_OPTS="conf/netbsd-9.0.opts.txt"

VM_VBOX="./vbox.sh"

VM_VBOX_LINK="https://raw.githubusercontent.com/vmactions/vbox/v0.9.3/vbox.sh"
VM_VBOX_LINK="https://raw.githubusercontent.com/vmactions/vbox/v0.9.4/vbox.sh"


2 changes: 1 addition & 1 deletion conf/netbsd-9.2.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ VM_OPTS="conf/netbsd-9.0.opts.txt"

VM_VBOX="./vbox.sh"

VM_VBOX_LINK="https://raw.githubusercontent.com/vmactions/vbox/v0.9.3/vbox.sh"
VM_VBOX_LINK="https://raw.githubusercontent.com/vmactions/vbox/v0.9.4/vbox.sh"


2 changes: 1 addition & 1 deletion conf/netbsd-9.3.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ VM_OPTS="conf/netbsd-9.0.opts.txt"

VM_VBOX="./vbox.sh"

VM_VBOX_LINK="https://raw.githubusercontent.com/vmactions/vbox/v0.9.3/vbox.sh"
VM_VBOX_LINK="https://raw.githubusercontent.com/vmactions/vbox/v0.9.4/vbox.sh"


0 comments on commit d30f0a4

Please sign in to comment.