toolbox/sbin/toolbox-init

27 lines
649 B
Bash
Executable File

#! /bin/sh
exec > /var/log/boot.log
exec 2>&1
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
echo "$apkovl missing; run 'lbu commit' to create it"
fi
echo "*** Updating packages"
apk fix
echo "*** Handing off to runsvdir"
exec /sbin/runsvdir /etc/service