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.
pull/3/head
alex 2 years ago
parent 543e6b2809
commit 35f87341e6
Signed by: x1ddos
GPG Key ID: 540189B756BF5B12

@ -1,4 +1,8 @@
#!/bin/sh #!/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 # try to ensure sysupdates are running regularily before doing anoything else
xbps-install -y snooze xbps-install -y snooze
ln -sfT /etc/sv/snooze-hourly /var/service/snooze-hourly 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 # run updates approx. every hour
cat <<EOF > /etc/cron.hourly/sysupdate cat <<EOF > /etc/cron.hourly/sysupdate
#!/bin/sh #!/bin/sh
exec /ssd/sysupdates/update.sh exec /ssd/sysupdates/update.sh "$SYSUPDATES_CHANNEL"
EOF EOF
chmod +x /etc/cron.hourly/sysupdate chmod +x /etc/cron.hourly/sysupdate
fi fi

@ -9,6 +9,7 @@
# after user confirmation. # after user confirmation.
# git branch to pull from. defaults to master. # git branch to pull from. defaults to master.
# another value is "dev", for a development aka unstable version.
BRANCH="${1:-master}" BRANCH="${1:-master}"
# output everything to a temp file and print its contents only in case of an error, # 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 # so that when run via a cronjob, the output is empty on success which prevents
@ -45,6 +46,7 @@ if [ $? -ne 0 ]; then
fi fi
# run repo's update script # run repo's update script
export SYSUPDATES_CHANNEL="$BRANCH"
./apply.sh >> $LOGFILE 2>&1 ./apply.sh >> $LOGFILE 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "ERROR: apply failed" echo "ERROR: apply failed"

Loading…
Cancel
Save