From e5525764312ecbc2c3e8cadbf1634c0832206f1b Mon Sep 17 00:00:00 2001 From: DanyLE Date: Wed, 2 Aug 2023 10:13:00 +0200 Subject: [PATCH] use sysvinit --- recipes-diya/diya-overlay/diya-overlay.bb | 6 ++++-- recipes-diya/diya-overlay/files/boot-to-recovery | 2 +- recipes-diya/diya-overlay/files/confd | 2 +- recipes-diya/diya-overlay/files/expandfs.sh | 6 ++++++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/recipes-diya/diya-overlay/diya-overlay.bb b/recipes-diya/diya-overlay/diya-overlay.bb index 7386114..7844bb5 100644 --- a/recipes-diya/diya-overlay/diya-overlay.bb +++ b/recipes-diya/diya-overlay/diya-overlay.bb @@ -6,7 +6,8 @@ LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda SRC_URI += "file://confd \ file://expandfs.sh \ file://80_diya \ - file://fs_resize" + file://fs_resize \ + file://boot-to-recovery" inherit update-rc.d useradd @@ -26,7 +27,8 @@ do_install() { install -d ${D}/usr/bin/ install -d ${D}/etc/default/volatiles # install -m 0644 ${WORKDIR}/80_diya ${D}${sysconfdir}/default/volatiles - install -m 0755 ${WORKDIR}/expandfs.sh ${D}/usr/bin/expandfs.sh + install -m 0755 ${WORKDIR}/expandfs.sh ${D}/usr/sbin/expandfs.sh + install -m 0755 ${WORKDIR}/boot-to-recovery ${D}/usr/sbin/boot-to-recovery install -m 0755 ${WORKDIR}/fs_resize ${DEPLOY_DIR_IMAGE}/ cat << EOF >> ${DEPLOY_DIR_IMAGE}/extraconfig.txt diff --git a/recipes-diya/diya-overlay/files/boot-to-recovery b/recipes-diya/diya-overlay/files/boot-to-recovery index 8f65c2a..18b92cd 100755 --- a/recipes-diya/diya-overlay/files/boot-to-recovery +++ b/recipes-diya/diya-overlay/files/boot-to-recovery @@ -9,7 +9,7 @@ fi # prepare env for recovery boot cat << EOF > /boot/extraconfig.txt -initramfs recovery-${MACHINE}.cpio.gz followkernel +initramfs recovery-$MACHINE.cpio.gz followkernel EOF echo "Rebooting to recovery mode" reboot \ No newline at end of file diff --git a/recipes-diya/diya-overlay/files/confd b/recipes-diya/diya-overlay/files/confd index 19dbeb8..0429fe5 100644 --- a/recipes-diya/diya-overlay/files/confd +++ b/recipes-diya/diya-overlay/files/confd @@ -13,7 +13,7 @@ case "$1" in # need to turn it on manually echo 0 > /sys/class/backlight/backlight/bl_power if [ -f "/boot/fs_resize" ]; then - /usr/bin/expandfs.sh + /usr/sbin/expandfs.sh touch /boot/home_partition_should_be_formated rm /boot/fs_resize reboot diff --git a/recipes-diya/diya-overlay/files/expandfs.sh b/recipes-diya/diya-overlay/files/expandfs.sh index 5749e18..faa7397 100644 --- a/recipes-diya/diya-overlay/files/expandfs.sh +++ b/recipes-diya/diya-overlay/files/expandfs.sh @@ -1,4 +1,10 @@ #! /bin/sh + +if [[ $(/usr/bin/id -u) -ne 0 ]]; then + echo "$0 shall be run as root" + exit 1 +fi + line=$( sed -e 's/\s*\([\+0-9a-zA-Z]*\).*/\1/' << EOF | fdisk /dev/mmcblk0 | grep /dev/mmcblk0p4 p