mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 05:06:43 +00:00
backup-restore: move as systemd target
This commit is contained in:
parent
d90305e027
commit
4173481b4b
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
BACKUP_FILE=`ls -1 /storage/.restore/??????????????.tar 2>/dev/null | tail -1`
|
BACKUP_FILE=`ls -1 /storage/.restore/??????????????.tar 2>/dev/null | tail -1`
|
||||||
|
|
||||||
if [ -e "$BACKUP_FILE" ] ; then
|
if [ -f "$BACKUP_FILE" ] ; then
|
||||||
echo -en "please wait.. checking backup file: "
|
echo -en "please wait.. checking backup file: "
|
||||||
tar tf $BACKUP_FILE &>/dev/null
|
tar tf $BACKUP_FILE &>/dev/null
|
||||||
ret=$?
|
ret=$?
|
||||||
@ -32,13 +32,14 @@ if [ -e "$BACKUP_FILE" ] ; then
|
|||||||
tar xf $BACKUP_FILE -C / &>/dev/null
|
tar xf $BACKUP_FILE -C / &>/dev/null
|
||||||
rm -f $BACKUP_FILE &>/dev/null
|
rm -f $BACKUP_FILE &>/dev/null
|
||||||
echo done
|
echo done
|
||||||
echo "all good. normal startup in 5s..."
|
echo "rebooting in 5s..."
|
||||||
sleep 5
|
sleep 5
|
||||||
else
|
else
|
||||||
echo FAILED
|
echo FAILED
|
||||||
echo "normal startup in 30s..."
|
|
||||||
rm -f $BACKUP_FILE &>/dev/null
|
rm -f $BACKUP_FILE &>/dev/null
|
||||||
|
echo "rebooting in 30s..."
|
||||||
sleep 30
|
sleep 30
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
sync
|
||||||
|
reboot
|
||||||
|
@ -1,15 +1,10 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Restoring Backup
|
Description=Restoring Backup
|
||||||
DefaultDependencies=false
|
DefaultDependencies=no
|
||||||
After=show-version.service
|
|
||||||
Before=local-fs-pre.target shutdown.target
|
|
||||||
Conflicts=shutdown.target
|
|
||||||
ConditionPathExistsGlob=|/storage/.restore/*.tar
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=idle
|
||||||
ExecStart=/usr/lib/openelec/backup-restore
|
ExecStart=/usr/lib/openelec/backup-restore
|
||||||
StandardOutput=tty
|
StandardInput=tty-force
|
||||||
|
StandardOutput=inherit
|
||||||
[Install]
|
StandardError=inherit
|
||||||
WantedBy=local-fs-pre.target
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Restoring Backup target
|
||||||
|
Requires=backup-restore.service
|
||||||
|
After=backup-restore.service
|
||||||
|
AllowIsolate=yes
|
@ -674,6 +674,12 @@
|
|||||||
if [ -f /sysroot/storage/.cache/reset_oe -o -f /sysroot/storage/.cache/reset_xbmc ] ; then
|
if [ -f /sysroot/storage/.cache/reset_oe -o -f /sysroot/storage/.cache/reset_xbmc ] ; then
|
||||||
INIT_UNIT="--unit=factory-reset.target"
|
INIT_UNIT="--unit=factory-reset.target"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
BACKUP_FILE=`ls -1 /sysroot/storage/.restore/??????????????.tar 2>/dev/null | head -n 1`
|
||||||
|
if [ -f "$BACKUP_FILE" ] ; then
|
||||||
|
INIT_UNIT="--unit=backup-restore.target"
|
||||||
|
fi
|
||||||
|
|
||||||
# switch to new sysroot and start real init
|
# switch to new sysroot and start real init
|
||||||
exec /bin/busybox switch_root /sysroot /usr/lib/systemd/systemd $INIT_ARGS $INIT_UNIT
|
exec /bin/busybox switch_root /sysroot /usr/lib/systemd/systemd $INIT_ARGS $INIT_UNIT
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user