File: //proc/self/root/etc.defaults/init/auto-smallupdate.conf
description "auto smallupdate when upgrade bootup"
start on stopped dsm-services and stopped synopkgctl-launcher
task
console log
emits syno.autosmallupdate.done
script
if [ ! -f /var/.UpgradeBootup ] || [ -f /var/.AutoSmallupdateBootup ]; then
initctl emit --no-wait syno.autosmallupdate.done || true
exit 0
fi
if ! synoupgrade --support-auto-smallupdate; then
initctl emit --no-wait syno.autosmallupdate.done || true
exit 0
fi
if [ -f /var/.SkipAutoSmallupdate ]; then
echo "Skip auto smallupdate"
rm -f /var/.SkipAutoSmallupdate
initctl emit --no-wait syno.autosmallupdate.done || true
exit 0
fi
SMALL_PATCH="/.smallupdate.pat"
echo "start bootup smallupdate"
/bin/touch /var/.AutoSmallupdateBootup || true
if [ -f $SMALL_PATCH ]; then
/usr/syno/sbin/synoupgrade --bootup-smallupdate=$SMALL_PATCH || true
elif /usr/syno/sbin/synoupgrade --check-smallupdate; then
/usr/syno/sbin/synoupgrade --bootup-smallupdate || true
fi
echo "end bootup smallupdate"
# block bootup if need reboot timeout
if [ ! -f /tmp/.bootup_smallupdate_wait_reboot ]; then
/sbin/initctl emit --no-wait syno.autosmallupdate.done || true
else
echo "wait smallupdate reboot"
# go through when timeout
sleep 240 || true
echo "wait reboot over 240s timeout!"
/sbin/initctl emit --no-wait syno.autosmallupdate.done || true
fi
end script
# vim:ft=upstart