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 4b4bb6e commit c0993f2
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .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 All @@ -33,7 +33,7 @@ jobs:
echo "bash build.sh conf/dragonflybsd-$RELEASE.conf"
echo "============================="
touch /tmp/keepalive
- uses: neilpang/debugger-action@master

# - run: |
Expand Down
39 changes: 31 additions & 8 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,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 @@ -168,19 +167,45 @@ if [ "$VM_PRE_INSTALL_PKGS" ]; then
ssh $osname sh <<<"$VM_INSTALL_CMD $VM_PRE_INSTALL_PKGS"
fi

ssh $osname "$VM_SHUTDOWN_CMD"

sleep 30
#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 30

###############################################################

while $vmsh isRunning $osname; do
sleep 5
done



##############################################################


Expand All @@ -205,11 +230,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 "Local package"
sleep 10

$vmsh waitForVMReady $osname
ssh $osname sh <<<"$VM_INSTALL_CMD $VM_RSYNC_PKG"
ssh $osname sh <<<"$VM_INSTALL_CMD $VM_SSHFS_PKG"
fi
Expand Down
2 changes: 1 addition & 1 deletion conf/dragonflybsd-6.4.0.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ VM_OPTS="conf/dragonflybsd-6.4.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 c0993f2

Please sign in to comment.