From 35f87341e6e110a15efda770e886a981259ae651 Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 5 Feb 2023 23:40:29 +0100 Subject: [PATCH] base: preserve sysupdates channel on initial setup the first run of update.sh sets up a cron job to run itself periodically. the update script takes one position argument, the git branch to pull changes from, which is also known as "sysupdates channel" - master for stable, dev for testing. the sysupdates channel was lost in the cron job setup, always defaulting to master (stable). this commit preserves the original arg value given to update.sh during the initial run. --- base/voidlinux.sh | 6 +++++- update.sh | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/base/voidlinux.sh b/base/voidlinux.sh index 8f766f2..b669dc7 100755 --- a/base/voidlinux.sh +++ b/base/voidlinux.sh @@ -1,4 +1,8 @@ #!/bin/sh +# base OS tweaks. +# the script assumes SYSUPDATES_CHANNEL env var is set to the desired changes +# channel, whatever the update.sh accept which is typically "dev" or "master". + # try to ensure sysupdates are running regularily before doing anoything else xbps-install -y snooze ln -sfT /etc/sv/snooze-hourly /var/service/snooze-hourly @@ -11,7 +15,7 @@ if [ ! -f /etc/cron.hourly/sysupdate ]; then # run updates approx. every hour cat < /etc/cron.hourly/sysupdate #!/bin/sh -exec /ssd/sysupdates/update.sh +exec /ssd/sysupdates/update.sh "$SYSUPDATES_CHANNEL" EOF chmod +x /etc/cron.hourly/sysupdate fi diff --git a/update.sh b/update.sh index 164853e..01d0a5d 100755 --- a/update.sh +++ b/update.sh @@ -9,6 +9,7 @@ # after user confirmation. # git branch to pull from. defaults to master. +# another value is "dev", for a development aka unstable version. BRANCH="${1:-master}" # output everything to a temp file and print its contents only in case of an error, # so that when run via a cronjob, the output is empty on success which prevents @@ -45,6 +46,7 @@ if [ $? -ne 0 ]; then fi # run repo's update script +export SYSUPDATES_CHANNEL="$BRANCH" ./apply.sh >> $LOGFILE 2>&1 if [ $? -ne 0 ]; then echo "ERROR: apply failed"