diff --git a/package/petitboot/Config.in b/package/petitboot/Config.in index 66836f31ac..50d5a4da70 100644 --- a/package/petitboot/Config.in +++ b/package/petitboot/Config.in @@ -1,7 +1,7 @@ config BR2_PACKAGE_PETITBOOT bool "petitboot" depends on BR2_PACKAGE_KEXEC_ARCH_SUPPORTS || BR2_PACKAGE_KEXEC_LITE_ARCH_SUPPORTS - depends on BR2_USE_MMU # lvm2 + depends on BR2_USE_MMU # lvm2, agetty depends on BR2_USE_WCHAR # elfutils, kexec-lite depends on !BR2_STATIC_LIBS # elfutils, kexec-lite, lvm2 depends on BR2_TOOLCHAIN_HAS_THREADS # elfutils, kexec-lite, lvm2 @@ -17,6 +17,8 @@ config BR2_PACKAGE_PETITBOOT select BR2_PACKAGE_LIBXCRYPT if BR2_TOOLCHAIN_USES_GLIBC select BR2_PACKAGE_NVME if ( BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le ) select BR2_PACKAGE_POWERPC_UTILS if ( BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le ) + select BR2_PACKAGE_UTIL_LINUX + select BR2_PACKAGE_UTIL_LINUX_AGETTY help Petitboot is a small kexec-based bootloader diff --git a/package/petitboot/S15pb-discover b/package/petitboot/S15pb-discover index 71ab62d998..9e8f6c87f8 100644 --- a/package/petitboot/S15pb-discover +++ b/package/petitboot/S15pb-discover @@ -12,7 +12,9 @@ fi start() { printf 'Starting %s: ' "$DAEMON" - mkdir -p /var/log/petitboot + # shellcheck disable=SC2174 # only apply -m to deepest dir + mkdir -p -m 0775 /var/log/petitboot + chown petituser:petitgroup /var/log/petitboot # shellcheck disable=SC2086 # we need the word splitting start-stop-daemon -S -q -b -m -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \ diff --git a/package/petitboot/pb-console b/package/petitboot/pb-console index 407ff3b302..8b23b2233d 100644 --- a/package/petitboot/pb-console +++ b/package/petitboot/pb-console @@ -3,14 +3,16 @@ DAEMON="pb-console" PB_CONSOLE_PORT=${2:-"console"} -PB_CONSOLE_ARGS="--getty --detach -- -n -i 0 $PB_CONSOLE_PORT linux" +PB_CONSOLE_ARGS="--getty=/sbin/agetty --detach -- -a petituser -n -i $PB_CONSOLE_PORT linux" # shellcheck source=/dev/null [ -r "/etc/default/petitboot" ] && . "/etc/default/petitboot" start() { printf 'Starting %s on %s: ' "$DAEMON" "$PB_CONSOLE_PORT" - mkdir -p /var/log/petitboot + # shellcheck disable=SC2174 # only apply -m to deepest dir + mkdir -p -m 0775 /var/log/petitboot + chown petituser:petitgroup /var/log/petitboot # shellcheck disable=SC2086 # we need the word splitting start-stop-daemon -S -q -x "/usr/libexec/petitboot/$DAEMON" \ diff --git a/package/petitboot/petitboot.mk b/package/petitboot/petitboot.mk index 6f7789b185..a6588a68e9 100644 --- a/package/petitboot/petitboot.mk +++ b/package/petitboot/petitboot.mk @@ -97,6 +97,8 @@ define PETITBOOT_POST_INSTALL $(TARGET_DIR)/etc/init.d/pb-console $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/pb-shell \ $(TARGET_DIR)/usr/libexec/petitboot/pb-shell + $(INSTALL) -D -m 0755 $(PETITBOOT_PKGDIR)/shell_profile \ + $(TARGET_DIR)/home/petituser/.profile mkdir -p $(TARGET_DIR)/etc/udev/rules.d for port in $(PETITBOOT_GETTY_PORT); do \ @@ -111,4 +113,8 @@ endef PETITBOOT_POST_INSTALL_TARGET_HOOKS += PETITBOOT_POST_INSTALL +define PETITBOOT_USERS + petituser -1 petitgroup -1 * /home/petituser /bin/sh - petitboot user +endef + $(eval $(autotools-package)) diff --git a/package/petitboot/shell_profile b/package/petitboot/shell_profile new file mode 100644 index 0000000000..a958ca4402 --- /dev/null +++ b/package/petitboot/shell_profile @@ -0,0 +1,3 @@ +if [ "$PPID" = "1" ]; then + exec /usr/libexec/petitboot/pb-console +fi