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