mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 05:06:43 +00:00
factory-reset: move as systemd target
This commit is contained in:
parent
5668f98de0
commit
a5b35e1b44
@ -40,8 +40,9 @@ get_target() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# hard reset
|
|
||||||
if [ -f /storage/.cache/reset_oe ] ; then
|
if [ -f /storage/.cache/reset_oe ] ; then
|
||||||
|
# hard reset
|
||||||
|
rm -f /storage/.cache/reset_oe
|
||||||
get_target
|
get_target
|
||||||
if [ ! -z $target ] ; then
|
if [ ! -z $target ] ; then
|
||||||
echo "hard resetting..."
|
echo "hard resetting..."
|
||||||
@ -53,15 +54,19 @@ if [ -f /storage/.cache/reset_oe ] ; then
|
|||||||
if [ ! -z $uuid ] ; then
|
if [ ! -z $uuid ] ; then
|
||||||
tune2fs -U $uuid $target
|
tune2fs -U $uuid $target
|
||||||
fi
|
fi
|
||||||
reboot
|
echo "done"
|
||||||
|
sleep 5
|
||||||
fi
|
fi
|
||||||
fi
|
elif [ -f /storage/.cache/reset_xbmc ] ; then
|
||||||
|
|
||||||
# soft reset
|
# soft reset
|
||||||
if [ -f /storage/.cache/reset_xbmc ] ; then
|
rm -f /storage/.cache/reset_xbmc
|
||||||
get_target
|
get_target
|
||||||
if [ ! -z $target ] ; then
|
if [ ! -z $target ] ; then
|
||||||
echo "soft resetting..."
|
echo "soft resetting..."
|
||||||
rm -rf /storage/.??* 2>&1 >/dev/null
|
rm -rf /storage/.??* 2>&1 >/dev/null
|
||||||
|
echo "done"
|
||||||
|
sleep 5
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
sync
|
||||||
|
reboot
|
||||||
|
@ -1,17 +1,10 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Factory reset
|
Description=Factory reset
|
||||||
DefaultDependencies=false
|
DefaultDependencies=no
|
||||||
After=show-version.service
|
|
||||||
Before=local-fs-pre.target shutdown.target
|
|
||||||
Conflicts=shutdown.target
|
|
||||||
|
|
||||||
ConditionPathExists=|/storage/.cache/reset_oe
|
|
||||||
ConditionPathExists=|/storage/.cache/reset_xbmc
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=idle
|
||||||
ExecStart=/usr/lib/openelec/factory-reset
|
ExecStart=/usr/lib/openelec/factory-reset
|
||||||
StandardOutput=tty
|
StandardInput=tty-force
|
||||||
|
StandardOutput=inherit
|
||||||
[Install]
|
StandardError=inherit
|
||||||
WantedBy=local-fs-pre.target
|
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Factory reset target
|
||||||
|
Requires=factory-reset.service
|
||||||
|
After=factory-reset.service
|
||||||
|
AllowIsolate=yes
|
@ -670,6 +670,10 @@
|
|||||||
if [ -f /sysroot/storage/.please_resize_me ] ; then
|
if [ -f /sysroot/storage/.please_resize_me ] ; then
|
||||||
INIT_ARGS="--unit=fs-resize.target"
|
INIT_ARGS="--unit=fs-resize.target"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -f /sysroot/storage/.cache/reset_oe -o -f /sysroot/storage/.cache/reset_xbmc ] ; then
|
||||||
|
INIT_ARGS="--unit=factory-reset.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
|
exec /bin/busybox switch_root /sysroot /usr/lib/systemd/systemd $INIT_ARGS
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user