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
parent
543e6b2809
commit
35f87341e6
|
@ -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 <<EOF > /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
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue