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 18f6381 commit 6deaed5
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
env:
SEC_VBOX : ${{ secrets.SEC_VBOX }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Creating Web console
uses: vmactions/cf-tunnel@v0
id: tunnel
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
NGROK_TOKEN : ${{ secrets.NGROK_TOKEN }}
SEC_VBOX : ${{ secrets.SEC_VBOX }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: vmactions/cf-tunnel@v0
id: tunnel
with:
Expand Down
40 changes: 33 additions & 7 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ vmsh="$VM_VBOX"

export VM_OS_NAME
export VM_RELEASE
export VM_OCR
export VM_DISK


##############################################################
Expand Down Expand Up @@ -104,6 +106,7 @@ sleep 5

$vmsh startVM $osname

sleep 2


###############################################
Expand Down Expand Up @@ -192,6 +195,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 @@ -227,14 +258,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 "penBSD/amd64"

sleep 20

waitForText "logi"

$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/openbsd-7.1.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ VM_OPTS="conf/openbsd-7.1.opts.txt"

VM_VBOX="./vbox.sh"

VM_VBOX_LINK="https://raw.githubusercontent.com/vmactions/vbox/v0.0.3/vbox.sh"
VM_VBOX_LINK="https://raw.githubusercontent.com/vmactions/vbox/v0.9.4/vbox.sh"
2 changes: 1 addition & 1 deletion conf/openbsd-7.2.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ VM_OPTS="conf/openbsd-7.2.resp"

VM_VBOX="./vbox.sh"

VM_VBOX_LINK="https://raw.githubusercontent.com/vmactions/vbox/v0.9.2/vbox.sh"
VM_VBOX_LINK="https://raw.githubusercontent.com/vmactions/vbox/v0.9.4/vbox.sh"
2 changes: 1 addition & 1 deletion conf/openbsd-7.3.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ VM_OPTS="conf/openbsd-7.3.resp"

VM_VBOX="./vbox.sh"

VM_VBOX_LINK="https://raw.githubusercontent.com/vmactions/vbox/v0.9.2/vbox.sh"
VM_VBOX_LINK="https://raw.githubusercontent.com/vmactions/vbox/v0.9.4/vbox.sh"
2 changes: 1 addition & 1 deletion conf/openbsd-7.4.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ VM_OPTS="conf/openbsd-7.4.resp"

VM_VBOX="./vbox.sh"

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

0 comments on commit 6deaed5

Please sign in to comment.