toolbox/sbin/toolbox-init

27 lines
649 B
Plaintext
Raw Normal View History

2023-12-20 13:04:23 -07:00
#! /bin/sh
2023-12-20 14:24:48 -07:00
exec > /var/log/boot.log
exec 2>&1
2023-12-20 13:04:23 -07:00
error () {
printf '\033[31mFLAGRANT SYSTEM ERROR\033[0m - %s' "$*" >> /etc/motd
}
echo "*** Setting up directories"
[ -d /mnt/toolbox ] && mkdir -p /mnt/toolbox/lbu /mnt/toolbox/apk
[ -d /etc/apk/cache ] || ln -s /mnt/toolbox/apk /etc/apk/cache
echo "*** Restoring system from backup"
apkovl=/mnt/toolbox/lbu/$(hostname).apkovl.tar.gz
if [ -f $apkovl ]; then
tar xf $apkovl || error "restoring system: untar $apkovl failed"
else
2023-12-20 14:24:48 -07:00
echo "$apkovl missing; run 'lbu commit' to create it"
2023-12-20 13:04:23 -07:00
fi
echo "*** Updating packages"
apk fix
2023-12-20 14:24:48 -07:00
echo "*** Handing off to runsvdir"
exec /sbin/runsvdir /etc/service