mirror of
https://github.com/LibreELEC/LibreELEC.tv
synced 2025-09-24 19:46:01 +07:00
disable suspend if booting from removable storage
This commit is contained in:
@@ -588,6 +588,25 @@
|
||||
|
||||
BOOT_STEP=final
|
||||
|
||||
# no suspend when booted from nonpersistent storage
|
||||
STORAGE=$(cat /proc/mounts | grep " /sysroot/storage " | awk '{print $1}' | awk -F '/' '{print $3}')
|
||||
if [ -n "$STORAGE" ] ; then
|
||||
removable="/sys/class/block/*/$STORAGE/../removable"
|
||||
if [ -e $removable ] ; then
|
||||
if [ "$(cat $removable 2>/dev/null)" = "1" ] ; then
|
||||
SUSPEND_DISABLED=yes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
FLASH=$(cat /proc/mounts | grep " /sysroot/flash " | awk '{print $1}' | awk -F '/' '{print $3}')
|
||||
if [ -n "$FLASH" ] ; then
|
||||
removable="/sys/class/block/*/$FLASH/../removable"
|
||||
if [ -e $removable ] ; then
|
||||
if [ "$(cat $removable 2>/dev/null)" = "1" ] ; then
|
||||
SUSPEND_DISABLED=yes
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
# move some special filesystems
|
||||
/bin/busybox mount --move /dev /sysroot/dev
|
||||
/bin/busybox mount --move /proc /sysroot/proc
|
||||
@@ -601,6 +620,10 @@
|
||||
if [ "$STORAGE_NETBOOT" = "yes" ] ; then
|
||||
echo "" > /sysroot/dev/.storage_netboot
|
||||
fi
|
||||
# no suspend when booted from nonpersistent storage
|
||||
if [ "$SUSPEND_DISABLED" = "yes" ] ; then
|
||||
echo "" > /sysroot/dev/.suspend_disabled
|
||||
fi
|
||||
# switch to new sysroot and start real init
|
||||
exec /bin/busybox switch_root /sysroot /usr/lib/systemd/systemd $INIT_ARGS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user