21 lines
531 B
Bash
Executable File
21 lines
531 B
Bash
Executable File
#! /bin/sh
|
|
|
|
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, skipping restore"
|
|
fi
|
|
|
|
echo "*** Updating packages"
|
|
apk fix
|