mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-08-02 15:37:49 +00:00
busybox: add systemd generator to override default.target
libreelec-target-generator replaces the logic previously used in the initramfs init script and dynamically redirects default.target if needed. Signed-off-by: Matthias Reichl <hias@horus.com>
This commit is contained in:
parent
a709f0e43e
commit
d233b7660d
@ -144,6 +144,9 @@ makeinstall_target() {
|
||||
cp $PKG_DIR/scripts/rpi-flash-firmware $INSTALL/usr/lib/libreelec
|
||||
fi
|
||||
|
||||
mkdir -p $INSTALL/usr/lib/systemd/system-generators/
|
||||
cp $PKG_DIR/scripts/libreelec-target-generator $INSTALL/usr/lib/systemd/system-generators/
|
||||
|
||||
mkdir -p $INSTALL/etc
|
||||
cp $PKG_DIR/config/profile $INSTALL/etc
|
||||
cp $PKG_DIR/config/inputrc $INSTALL/etc
|
||||
|
44
packages/sysutils/busybox/scripts/libreelec-target-generator
Executable file
44
packages/sysutils/busybox/scripts/libreelec-target-generator
Executable file
@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: GPL-2.0-or-later
|
||||
# Copyright (C) 2020-present Matthias Reichl <hias@horus.com>
|
||||
|
||||
EARLY_DIR="$2"
|
||||
|
||||
log() {
|
||||
echo "libreelec-target-generator: $@" > /dev/kmsg
|
||||
}
|
||||
|
||||
if [ -z "$EARLY_DIR" ]; then
|
||||
log "error: generator directory missing"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TARGET=""
|
||||
|
||||
for arg in $(cat /proc/cmdline); do
|
||||
case "$arg" in
|
||||
textmode)
|
||||
TARGET="textmode.target"
|
||||
;;
|
||||
installer)
|
||||
TARGET="installer.target"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
BACKUP_FILE=$(ls -1 /storage/.restore/*.tar 2>/dev/null | head -n 1)
|
||||
|
||||
if [ -f /storage/.please_resize_me ]; then
|
||||
TARGET="fs-resize.target"
|
||||
elif [ -f /storage/.cache/reset_oe -o -f /storage/.cache/reset_xbmc ]; then
|
||||
TARGET="factory-reset.target"
|
||||
elif [ -f "$BACKUP_FILE" ]; then
|
||||
TARGET="backup-restore.target"
|
||||
elif [ -f /storage/.rpi_flash_firmware ]; then
|
||||
TARGET="rpi-flash-firmware.target"
|
||||
fi
|
||||
|
||||
if [ -n "$TARGET" ]; then
|
||||
ln -sT "/usr/lib/systemd/system/$TARGET" "$EARLY_DIR/default.target" 2>/dev/kmsg || log "error creating symlink to $TARGET: $?"
|
||||
fi
|
Loading…
x
Reference in New Issue
Block a user