diff options
19 files changed, 292 insertions, 66 deletions
@@ -1,4 +1,6 @@ Copyright (c) 2015 Raspberry Pi (Trading) Ltd. +Copyright (c) 2021 ZAFENA AB +Copyright (c) 2021 Gothel Software e.K. All rights reserved. diff --git a/export-image/02-network/01-run.sh b/export-image/02-network/01-run.sh index 4150732..5deac86 100755 --- a/export-image/02-network/01-run.sh +++ b/export-image/02-network/01-run.sh @@ -1,3 +1,6 @@ #!/bin/bash -e -install -m 644 files/resolv.conf "${ROOTFS_DIR}/etc/" +# cleanup resolv.conf +rm -f "${ROOTFS_DIR}/etc/resolv.conf" +touch "${ROOTFS_DIR}/etc/resolv.conf" +chmod 644 "${ROOTFS_DIR}/etc/resolv.conf" diff --git a/export-image/02-network/files/resolv.conf b/export-image/02-network/files/resolv.conf deleted file mode 100644 index cae093a..0000000 --- a/export-image/02-network/files/resolv.conf +++ /dev/null @@ -1 +0,0 @@ -nameserver 8.8.8.8 diff --git a/export-image/04-finalise/01-run.sh b/export-image/04-finalise/01-run.sh index c7ffea6..cdaadc3 100755 --- a/export-image/04-finalise/01-run.sh +++ b/export-image/04-finalise/01-run.sh @@ -83,15 +83,13 @@ install -m 644 "${ROOTFS_DIR}/etc/rpi-issue" "${ROOTFS_DIR}/boot/issue.txt" cp "$ROOTFS_DIR/etc/rpi-issue" "$INFO_FILE" -if [ "${ROOTFS_RO}" = "1" ] ; then - cp "$INFO_FILE" "$INFO_FILE_ROOT" - echo >> "$INFO_FILE_ROOT" - echo "+++" >> "$INFO_FILE_ROOT" - echo >> "$INFO_FILE_ROOT" - echo "Root Partition `basename $IMG_FILE_ROOT_EXT4`" >> "$INFO_FILE_ROOT" - echo "Root Partition of `basename $IMG_FILE`" >> "$INFO_FILE_ROOT" - echo >> "$INFO_FILE_ROOT" -fi +cp "$INFO_FILE" "$INFO_FILE_ROOT" +echo >> "$INFO_FILE_ROOT" +echo "+++" >> "$INFO_FILE_ROOT" +echo >> "$INFO_FILE_ROOT" +echo "Root Partition `basename $IMG_FILE_ROOT_EXT4`" >> "$INFO_FILE_ROOT" +echo "Root Partition of `basename $IMG_FILE`" >> "$INFO_FILE_ROOT" +echo >> "$INFO_FILE_ROOT" rm -rf "${DEPLOY_DIR2}" mkdir -p "${DEPLOY_DIR2}" @@ -144,13 +142,16 @@ fi mv "$IMG_FILE" "$DEPLOY_DIR2/" if [ "${ROOTFS_RO}" = "1" ] ; then - ( cd "${DEPLOY_DIR2}/sdcard${IMG_SUFFIX}"; zip -r0 "../${IMG_FILENAME}${IMG_SUFFIX}.sdcard.zip" . ) + # for now, not zipping the sdcard folder, as we further postprocess it + # ( cd "${DEPLOY_DIR2}/sdcard${IMG_SUFFIX}"; zip -r0 "../${IMG_FILENAME}${IMG_SUFFIX}.sdcard.zip" . ) + + echo "${DEPLOY_DIR2}/sdcard${IMG_SUFFIX} done." - mv "$IMG_FILE_ROOT_EXT4" "$DEPLOY_DIR2/" - #mv "$IMG_FILE_ROOT_SQFS_GZ" "$DEPLOY_DIR2/" - mv "$IMG_FILE_ROOT_SQFS_LZO" "$DEPLOY_DIR2/" - #mv "$IMG_FILE_ROOT_SQFS_ZSTD" "$DEPLOY_DIR2/" + #mv -v "$IMG_FILE_ROOT_SQFS_GZ" "$DEPLOY_DIR2/" + mv -v "$IMG_FILE_ROOT_SQFS_LZO" "$DEPLOY_DIR2/" + #mv -v "$IMG_FILE_ROOT_SQFS_ZSTD" "$DEPLOY_DIR2/" fi +mv -v "$IMG_FILE_ROOT_EXT4" "$DEPLOY_DIR2/" rm -f "${STAGE_WORK_DIR}/SHA256SUMS" ( cd "${DEPLOY_DIR2}"; find . -maxdepth 1 -type f -exec sha256sum -b \{\} >> "${STAGE_WORK_DIR}/SHA256SUMS" \; ) diff --git a/scripts/01-build-debian_amd64-rw-light-jau.cfg b/scripts/01-build-debian_amd64-rw-light-jau.cfg new file mode 100644 index 0000000..00b3378 --- /dev/null +++ b/scripts/01-build-debian_amd64-rw-light-jau.cfg @@ -0,0 +1,47 @@ +#! /bin/bash + +export TARGET_RASPI="0" +export TARGET_ARCH="amd64" + +export RELEASE=bullseye +# export RELEASE=buster + +# Produce a read-only rootfs +# export ROOTFS_RO=1 +# export REDUCED_FOOTPRINT=1 + +export APT_PROXY=http://jordan:3142 + +export CUSTOM_NAME="DebAmd64Light" +export CUSTOM_VERSION="1.2-rw" + +export PI_GEN="pi-gen (custom branch)" + +export IMG_NAME="${CUSTOM_NAME}-${CUSTOM_VERSION}-${TARGET_ARCH}" +export WORK_DIR="/data/${CUSTOM_NAME}-${CUSTOM_VERSION}-${TARGET_ARCH}-work" +export IMG_FILENAME=${IMG_NAME} + +export DEPLOY_DIR=/data/diskimages +export DEPLOY_ZIP=0 + +#export USE_QEMU=1 + +export TARGET_HOSTNAME=deb11amd64 + +export LOCALE_DEFAULT=en_US.UTF-8 +export KEYBOARD_KEYMAP=us +export KEYBOARD_LAYOUT="English (US)" +export TIMEZONE_DEFAULT="Europe/Berlin" + +export FIRST_USER_NAME="pi" +export FIRST_USER_PASS="pi" +export ENABLE_SSH=1 +export PUBKEY_SSH_FIRST_USER="ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEAm2qfo3uiWT9V7E/sH6unVO6XhGHeNnGUswxuADwFAKyflJq2yCALWIX7+DzEhBc7O9HxVztZAHLA+lfEpctQkA7KPgX98rjLHJlrm1lQXCPjwWjTZBrGNCmjWpYkc8jew/BzngmiwDlshYqzp0rWKNvQbkGJaVctqaraJAzE3F2wa+KkSBQuw2rAhiarbiO4MtO1AIw25EnSXHhP9EpeTKhAniKm73q977m5wpzaU+uwoGPCIyVl+BeaGLbPPIF35PJbg4tIqG6WLy3a8++Mf5Ml8lETcYYfjh4er3CvqFLhAYcaCLPNOwkK/YT4UnYZoZ4nt0Z+JWjxeNhIuJf64neysBdgB5E5FEYP2iYH+EUjcYp7YCrl/3/ag4Z2KAsF2qEa6/+s90Clm0r2mqRcQyLYQ6Co1YlYa1/jq7qsiuNgWvn5Mg8Pt4+L/C0KoycvUr4HhTS8EBJx+774p2uBa3mB65Vg2llKb8DdtQwR1bh0Ot9cjKTJY0pDyPiFbemZh2q7qD958bsOZCly43WYRd6E0Df68Q2MTz6ZC1y+z103gsEiK8bXmZp42ghDa96Ik2JO6pWCEUjBJ/9+rdudRHcfDlBqoS6+wg/z+WvtRtEyvVO4LSTrsX5xHWzVloSZeAGowmLbxGWHGWfl5oCcNfUzXo0lXDP0bzyy5NxWkpE= sven@phalanx" +export PUBKEY2_SSH_FIRST_USER="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC+pMJr432NOaDKnVN9+KDARU3XPDCMcwlsDdFHAEuVIGiNE2yxsC+UVKqu2+ZWKIlNET0zW8b87WsWVwiTa58lkxVre3g9DYAXpV7HPsf0bpTmzKqfPUC2z52aISluH/+Mf5FlytqFgpzx1VxREjvAw2H0GFE2K7+GsVcDFxjd5hv81FVAO9KISFnVVP9i+mSR7P4QOUYmXMw7Zq1z6hjXAGxXupEx8p/6KCqgo1tdVQBefJNOJpCABDI0yHgRsXnm7CUv1a/vM7QfCsn1hugcEGilacBLBcQp6EhXvleavX3ixffNV9RmOO0X06/EVwBtgal9aH375XABWihUi3EkRvfRqo07eieWzTIj6gO+AhZmuu4X/o53W5BG+cgMRV/+VGsLijH6jdvVv9W+motjX16TSHbSBHFaiwFyreAFi/A7WiUqdcbe12nnUsHlumhJSAIynCHKy6hgFEuGQFdENcudCgNMF7SDQEB52TwiO6BZuP6VHw4nNqxm+sbmKjgKi5vTrzIe7JkuRX+eIZLFZifFS7kfIRfQY67sCerTYsnC0Y0muX+VixKG3FIL6iSlF3KLOd41LPVNmBbpZK7oC62qrXBhvgA2d9D92o5rzqFCA6obEYiEDgyN6liASJD6VFNey366FyZzsf2U2dUeHFkyUxY0EEEFNeoOPhF5SQ== [email protected]" +export PUBKEY_ONLY_SSH=1 + +export STAGE_LIST="stage0 stage1 stage2" +#export SKIP_STAGE_LIST="stage0 stage1 stage2" + +#export SKIP_IMAGES_LIST="stage2" + diff --git a/scripts/01-build-debian_amd64-rw-lightxdev-jau.cfg b/scripts/01-build-debian_amd64-rw-lightxdev-jau.cfg new file mode 100644 index 0000000..25feaa6 --- /dev/null +++ b/scripts/01-build-debian_amd64-rw-lightxdev-jau.cfg @@ -0,0 +1,48 @@ +#! /bin/bash + +export TARGET_RASPI="0" +export TARGET_ARCH="amd64" + +export RELEASE=bullseye +# export RELEASE=buster + +# Produce a read-only rootfs +# export ROOTFS_RO=1 +# export REDUCED_FOOTPRINT=1 + +export APT_PROXY=http://jordan:3142 + +export CUSTOM_NAME="DebAmd64LightDev" +export CUSTOM_VERSION="1.2-rw" + +export PI_GEN="pi-gen (custom branch)" + +export IMG_NAME="${CUSTOM_NAME}-${CUSTOM_VERSION}-${TARGET_ARCH}" +export WORK_DIR="/data/${CUSTOM_NAME}-${CUSTOM_VERSION}-${TARGET_ARCH}-work" +export IMG_FILENAME=${IMG_NAME} + +export DEPLOY_DIR=/data/diskimages +export DEPLOY_ZIP=0 + +#export USE_QEMU=1 + +export TARGET_HOSTNAME=deb11amd64 + +export LOCALE_DEFAULT=en_US.UTF-8 +export KEYBOARD_KEYMAP=us +export KEYBOARD_LAYOUT="English (US)" +export TIMEZONE_DEFAULT="Europe/Berlin" + +export FIRST_USER_NAME="pi" +export FIRST_USER_PASS="pi" +export ENABLE_SSH=1 +export PUBKEY_SSH_FIRST_USER="ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEAm2qfo3uiWT9V7E/sH6unVO6XhGHeNnGUswxuADwFAKyflJq2yCALWIX7+DzEhBc7O9HxVztZAHLA+lfEpctQkA7KPgX98rjLHJlrm1lQXCPjwWjTZBrGNCmjWpYkc8jew/BzngmiwDlshYqzp0rWKNvQbkGJaVctqaraJAzE3F2wa+KkSBQuw2rAhiarbiO4MtO1AIw25EnSXHhP9EpeTKhAniKm73q977m5wpzaU+uwoGPCIyVl+BeaGLbPPIF35PJbg4tIqG6WLy3a8++Mf5Ml8lETcYYfjh4er3CvqFLhAYcaCLPNOwkK/YT4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f2U2dUeHFkyUxY0EEEFNeoOPhF5SQ== [email protected]" +export PUBKEY_ONLY_SSH=1 + +export STAGE_LIST="stage0 stage1 stage2 stage3a stage3a_dev" +#export SKIP_STAGE_LIST="stage0 stage1 stage2 stage3a stage3a_dev" + +#export SKIP_IMAGES_LIST="stage2 stage3a stage3a_dev" +export SKIP_IMAGES_LIST="stage2 stage3a" + diff --git a/scripts/01-build-debian_amd64-rw-lightxdev.cfg b/scripts/01-build-debian_amd64-rw-lightxdev.cfg new file mode 100644 index 0000000..cc95db5 --- /dev/null +++ b/scripts/01-build-debian_amd64-rw-lightxdev.cfg @@ -0,0 +1,47 @@ +#! /bin/bash + +export TARGET_RASPI="0" +export TARGET_ARCH="amd64" + +export RELEASE=bullseye +# export RELEASE=buster + +# Produce a read-only rootfs +# export ROOTFS_RO=1 +# export REDUCED_FOOTPRINT=1 + +# export APT_PROXY=http://jordan:3142 + +export CUSTOM_NAME="DebAmd64LightDev" +export CUSTOM_VERSION="1.2-rw" + +export PI_GEN="pi-gen (custom branch)" + +export IMG_NAME="${CUSTOM_NAME}-${CUSTOM_VERSION}-${TARGET_ARCH}" +export WORK_DIR="/data/${CUSTOM_NAME}-${CUSTOM_VERSION}-${TARGET_ARCH}-work" +export IMG_FILENAME=${IMG_NAME} + +export DEPLOY_DIR=/data/diskimages +export DEPLOY_ZIP=0 + +#export USE_QEMU=1 + +export TARGET_HOSTNAME=deb11amd64 + +export LOCALE_DEFAULT=en_US.UTF-8 +export KEYBOARD_KEYMAP=us +export KEYBOARD_LAYOUT="English (US)" +export TIMEZONE_DEFAULT="Europe/Berlin" + +export FIRST_USER_NAME="pi" +export FIRST_USER_PASS="pi" +export ENABLE_SSH=1 +# export PUBKEY_SSH_FIRST_USER="ssh-rsa long-number my@machine" +# export PUBKEY_ONLY_SSH=1 + +export STAGE_LIST="stage0 stage1 stage2 stage3a stage3a_dev" +#export SKIP_STAGE_LIST="stage0 stage1 stage2 stage3a stage3a_dev" + +#export SKIP_IMAGES_LIST="stage2 stage3a stage3a_dev" +export SKIP_IMAGES_LIST="stage2 stage3a" + diff --git a/scripts/01-build-raspi-rw-light-jau.cfg b/scripts/01-build-raspi-rw-light-jau.cfg new file mode 100644 index 0000000..bf1546d --- /dev/null +++ b/scripts/01-build-raspi-rw-light-jau.cfg @@ -0,0 +1,47 @@ +#! /bin/bash + +export TARGET_RASPI="1" +export TARGET_ARCH="arm64" + +export RELEASE=bullseye +# export RELEASE=buster + +# Produce a read-only rootfs +# export ROOTFS_RO=1 +# export REDUCED_FOOTPRINT=1 + +export APT_PROXY=http://jordan:3142 + +export CUSTOM_NAME="RaspiArm64Light" +export CUSTOM_VERSION="1.2-rw" + +export PI_GEN="pi-gen (jau branch)" + +export IMG_NAME="${CUSTOM_NAME}-${CUSTOM_VERSION}-${TARGET_ARCH}" +export WORK_DIR="/data/${CUSTOM_NAME}-${CUSTOM_VERSION}-${TARGET_ARCH}-work" +export IMG_FILENAME=${IMG_NAME} + +export DEPLOY_DIR=/data/diskimages +export DEPLOY_ZIP=0 + +#export USE_QEMU=1 + +export TARGET_HOSTNAME=deb11arm64raspi + +export LOCALE_DEFAULT=en_US.UTF-8 +export KEYBOARD_KEYMAP=us +export KEYBOARD_LAYOUT="English (US)" +export TIMEZONE_DEFAULT="Europe/Berlin" + +export FIRST_USER_NAME="pi" +export FIRST_USER_PASS="pi" +export ENABLE_SSH=1 +export PUBKEY_SSH_FIRST_USER="ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAgEAm2qfo3uiWT9V7E/sH6unVO6XhGHeNnGUswxuADwFAKyflJq2yCALWIX7+DzEhBc7O9HxVztZAHLA+lfEpctQkA7KPgX98rjLHJlrm1lQXCPjwWjTZBrGNCmjWpYkc8jew/BzngmiwDlshYqzp0rWKNvQbkGJaVctqaraJAzE3F2wa+KkSBQuw2rAhiarbiO4MtO1AIw25EnSXHhP9EpeTKhAniKm73q977m5wpzaU+uwoGPCIyVl+BeaGLbPPIF35PJbg4tIqG6WLy3a8++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A2d9D92o5rzqFCA6obEYiEDgyN6liASJD6VFNey366FyZzsf2U2dUeHFkyUxY0EEEFNeoOPhF5SQ== [email protected]" +export PUBKEY_ONLY_SSH=1 + +export STAGE_LIST="stage0 stage1 stage2" +#export SKIP_STAGE_LIST="stage0 stage1 stage2" + +#export SKIP_IMAGES_LIST="stage2" + diff --git a/scripts/01-build-raspi-rw-lightxdev-jau.cfg b/scripts/01-build-raspi-rw-lightxdev-jau.cfg index a79c956..66c0e3a 100644 --- a/scripts/01-build-raspi-rw-lightxdev-jau.cfg +++ b/scripts/01-build-raspi-rw-lightxdev-jau.cfg @@ -12,7 +12,7 @@ export RELEASE=bullseye export APT_PROXY=http://jordan:3142 -export CUSTOM_NAME="RaspiArm64LightDevJau" +export CUSTOM_NAME="RaspiArm64LightDev" export CUSTOM_VERSION="1.2-rw" export PI_GEN="pi-gen (jau branch)" diff --git a/scripts/02-build-raspi-ro-smalldesk-jau.cfg b/scripts/02-build-raspi-ro-smalldesk-jau.cfg index 52f8ddc..35bbb00 100644 --- a/scripts/02-build-raspi-ro-smalldesk-jau.cfg +++ b/scripts/02-build-raspi-ro-smalldesk-jau.cfg @@ -12,7 +12,7 @@ export REDUCED_FOOTPRINT=1 export APT_PROXY=http://jordan:3142 -export CUSTOM_NAME="RaspiArm64SmallDeskJau" +export CUSTOM_NAME="RaspiArm64SmallDesk" export CUSTOM_VERSION="1.2-ro" export PI_GEN="pi-gen (jau branch)" diff --git a/scripts/03-build-debian_amd64-ro-rescue-jau.cfg b/scripts/03-build-debian_amd64-ro-rescue-jau.cfg index 76de7bc..5ccc5ef 100644 --- a/scripts/03-build-debian_amd64-ro-rescue-jau.cfg +++ b/scripts/03-build-debian_amd64-ro-rescue-jau.cfg @@ -12,7 +12,7 @@ export ROOTFS_RO=1 export APT_PROXY=http://jordan:3142 -export CUSTOM_NAME="DebAmd64RescueJau" +export CUSTOM_NAME="DebAmd64Rescue" export CUSTOM_VERSION="1.2-ro" export PI_GEN="pi-gen (jau branch)" diff --git a/scripts/qcow2_handling b/scripts/qcow2_handling index 770d074..e996e8f 100644 --- a/scripts/qcow2_handling +++ b/scripts/qcow2_handling @@ -394,7 +394,21 @@ function make_bootable_image() { exit 1 fi - if false ; then + if [ "${ROOTFS_RO}" = "1" ] ; then + echo "Setup hard devicenames" + BOOT_DEV_NAME="\/dev\/mmcblk0p1" + echo "Boot: $BOOT_DEV_NAME" + ROOT_DEV_NAME="\/dev\/mmcblk0p2" + echo "Root1: $ROOT_DEV_NAME" + + echo "Set hard device names in fstab (rootfs ro -> /boot uncommented)" + sed -i "s/BOOTDEV/${BOOT_DEV_NAME}/" "${MOUNTROOT}/etc/fstab" + sed -i "s/ROOTDEV/${ROOT_DEV_NAME}/" "${MOUNTROOT}/etc/fstab" + if [ "${TARGET_RASPI}" = "1" ]; then + echo "Set rootfs ro hard device name in cmdline, required" + sed -i "s/ROOTDEV/${ROOT_DEV_NAME}/" "${MOUNTROOT}/boot/sys_${TARGET_ARCH}_000/cmdline.txt" + fi + else echo "Setup PARTUUIDs" BOOT_PARTUUID="${IMGID}-01" echo "Boot: $BOOT_PARTUUID" @@ -402,26 +416,13 @@ function make_bootable_image() { echo "Root1: $ROOT_PARTUUID" if [ ! -z "$BOOT_PARTUUID" ] && [ ! -z "$ROOT_PARTUUID" ]; then - echo "Set UUIDs to make it bootable" + echo "Set UUIDs to make it bootable, required." sed -i "s/BOOTDEV/PARTUUID=${BOOT_PARTUUID}/" "${MOUNTROOT}/etc/fstab" sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" "${MOUNTROOT}/etc/fstab" if [ "${TARGET_RASPI}" = "1" ]; then sed -i "s/ROOTDEV/PARTUUID=${ROOT_PARTUUID}/" "${MOUNTROOT}/boot/sys_${TARGET_ARCH}_000/cmdline.txt" fi fi - else - echo "Setup hard devicenames" - BOOT_DEV_NAME="\/dev\/mmcblk0p1" - echo "Boot: $BOOT_DEV_NAME" - ROOT_DEV_NAME="\/dev\/mmcblk0p2" - echo "Root1: $ROOT_DEV_NAME" - - echo "Set hard device names to make it bootable" - sed -i "s/BOOTDEV/${BOOT_DEV_NAME}/" "${MOUNTROOT}/etc/fstab" - sed -i "s/ROOTDEV/${ROOT_DEV_NAME}/" "${MOUNTROOT}/etc/fstab" - if [ "${TARGET_RASPI}" = "1" ]; then - sed -i "s/ROOTDEV/${ROOT_DEV_NAME}/" "${MOUNTROOT}/boot/sys_${TARGET_ARCH}_000/cmdline.txt" - fi fi echo "Umount image ${EXPORT_IMAGE}" diff --git a/stage2/01-sys-tweaks/01-run.sh b/stage2/01-sys-tweaks/01-run.sh index 34cee22..c163bbb 100755 --- a/stage2/01-sys-tweaks/01-run.sh +++ b/stage2/01-sys-tweaks/01-run.sh @@ -2,6 +2,8 @@ if [ "${ROOTFS_RO}" = "1" ] ; then install -v -m 644 files/fstab-rootfs_ro "${ROOTFS_DIR}/etc/fstab" +else + install -v -m 644 files/fstab-rootfs_rw "${ROOTFS_DIR}/etc/fstab" fi install -m 644 files/overlay_mount.service "${ROOTFS_DIR}/lib/systemd/system/" install -m 755 files/overlay_mount "${ROOTFS_DIR}/etc/init.d/" @@ -13,7 +15,7 @@ install -m 755 files/rotatelog_init_rootfs "${ROOTFS_DIR}/etc/init.d/" install -m 644 files/resize2fs_once.service "${ROOTFS_DIR}/lib/systemd/system/" install -m 755 files/resize2fs_once "${ROOTFS_DIR}/etc/init.d/" -install -d "${ROOTFS_DIR}/etc/systemd/system/rc-local.service.d" +install -d "${ROOTFS_DIR}/etc/systemd/system/rc-local.service.d" install -m 644 files/ttyoutput.conf "${ROOTFS_DIR}/etc/systemd/system/rc-local.service.d/" if [ "${TARGET_RASPI}" = "1" ]; then @@ -54,6 +56,8 @@ on_chroot << EOF # without having a live mapping in /etc/fstab. systemctl disable systemd-remount-fs systemctl mask systemd-remount-fs + else + sed -i "s/vfat/${BOOT_FSTYPE}/g" /etc/fstab fi systemctl disable rsync @@ -75,13 +79,8 @@ on_chroot << EOF systemctl disable ssh systemctl mask ssh fi - if [ "${ROOTFS_RO}" = "1" ] ; then - systemctl disable regenerate_ssh_host_keys - systemctl mask regenerate_ssh_host_keys - else - systemctl unmask regenerate_ssh_host_keys - systemctl enable regenerate_ssh_host_keys - fi + systemctl disable regenerate_ssh_host_keys + systemctl mask regenerate_ssh_host_keys if [ "${ROOTFS_RO}" = "1" ] ; then sed -i -e 's/^D \/tmp/#D \/tmp/g' /usr/lib/tmpfiles.d/tmp.conf @@ -200,10 +199,13 @@ if [ "${ROOTFS_RO}" = "1" ] ; then install -m 755 files/initramfs/fsck_custom "${ROOTFS_DIR}/etc/initramfs-tools/hooks/" install -m 755 files/initramfs/extra_execs "${ROOTFS_DIR}/etc/initramfs-tools/hooks/" else + # Mutable rootfs if [ "${TARGET_RASPI}" = "1" ]; then install -m 644 files/boot/config-rootfs_rw.txt "${ROOTFS_DIR}/boot/config.txt" install -m 644 files/boot/config-rootfs_rw.txt "${ROOTFS_DIR}/boot/sys_${TARGET_ARCH}_000/config.txt" install -m 644 files/boot/sys_arm64_000/cmdline-rootfs_rw.txt "${ROOTFS_DIR}/boot/sys_${TARGET_ARCH}_000/cmdline.txt" + else + sed -i 's/quiet//g' "${ROOTFS_DIR}/etc/default/grub" fi fi @@ -226,13 +228,7 @@ on_chroot <<EOF KVERSION=\$(ls /lib/modules/ | tail -n 1) if [ "${ROOTFS_RO}" = "1" ]; then - rm -f /boot/sys_${TARGET_ARCH}_000/initrd.img - - if [ "${TARGET_RASPI}" = "1" ]; then - echo "mkinitramfs for kernel version: \${KVERSION}" - /usr/sbin/mkinitramfs -o /boot/sys_${TARGET_ARCH}_000/initrd.img \${KVERSION} - else - update-initramfs -u -k \${KVERSION} + if [ "${TARGET_RASPI}" != "1" ]; then if [ -f "/boot/vmlinuz-\${KVERSION}" ] ; then mv -f "/boot/vmlinuz-\${KVERSION}" /boot/sys_${TARGET_ARCH}_000/vmlinuz fi @@ -246,6 +242,10 @@ on_chroot <<EOF mv -f "/boot/System.map-\${KVERSION}" /boot/sys_${TARGET_ARCH}_000/System.map fi fi + rm -f /boot/sys_${TARGET_ARCH}_000/initrd.img + + echo "mkinitramfs for kernel version: \${KVERSION}" + /usr/sbin/mkinitramfs -o /boot/sys_${TARGET_ARCH}_000/initrd.img \${KVERSION} mkdir -p /data/sdcard find /boot/ -maxdepth 1 -type f \ @@ -264,12 +264,8 @@ on_chroot <<EOF grub-install --force-file-id --modules="gzio part_msdos fat ext2" /dev/${NBD_DEV} fi - # Remove storage device related 'search.fs_uuid' and allow multi homing + # Remove storage device related search.fs_uuid and allow multi homing rm -f /boot/grub/i386-pc/load.cfg fi EOF -if [ "${ROOTFS_RO}" != "1" ] ; then - rm -f "${ROOTFS_DIR}/etc/ssh/"ssh_host_*_key* -fi - diff --git a/stage2/01-sys-tweaks/files/boot/sys_arm64_000/cmdline-rootfs_rw.txt b/stage2/01-sys-tweaks/files/boot/sys_arm64_000/cmdline-rootfs_rw.txt index 42962cc..79ccf3b 100755 --- a/stage2/01-sys-tweaks/files/boot/sys_arm64_000/cmdline-rootfs_rw.txt +++ b/stage2/01-sys-tweaks/files/boot/sys_arm64_000/cmdline-rootfs_rw.txt @@ -1 +1 @@ -dwc_otg.lpm_enable=0 console=tty3 root=ROOTDEV rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait loglevel=3 logo.nologo splash quiet plymouth.ignore-serial-consoles vt.global_cursor_default=0 +dwc_otg.lpm_enable=0 console=tty3 root=ROOTDEV rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait diff --git a/stage2/01-sys-tweaks/files/fstab-rootfs_rw b/stage2/01-sys-tweaks/files/fstab-rootfs_rw new file mode 100644 index 0000000..5a4df6b --- /dev/null +++ b/stage2/01-sys-tweaks/files/fstab-rootfs_rw @@ -0,0 +1,3 @@ +proc /proc proc defaults 0 0 +BOOTDEV /boot vfat defaults 0 2 +ROOTDEV / ext4 defaults,noatime,errors=remount-ro 0 0 diff --git a/stage2/01-sys-tweaks/files/resize2fs_manual.sh b/stage2/01-sys-tweaks/files/resize2fs_manual.sh new file mode 100644 index 0000000..c7500b6 --- /dev/null +++ b/stage2/01-sys-tweaks/files/resize2fs_manual.sh @@ -0,0 +1,17 @@ + +ROOTFS_DIR= + +if true ; then + +install -m 644 resize2fs_once.service "${ROOTFS_DIR}/lib/systemd/system/" +install -m 755 resize2fs_once "${ROOTFS_DIR}/etc/init.d/" + +systemctl unmask resize2fs_once +systemctl enable resize2fs_once + +else + +systemctl disable resize2fs_once +systemctl mask resize2fs_once + +fi diff --git a/stage2/01-sys-tweaks/files/resize2fs_once b/stage2/01-sys-tweaks/files/resize2fs_once index f8e45a6..cd42e19 100755 --- a/stage2/01-sys-tweaks/files/resize2fs_once +++ b/stage2/01-sys-tweaks/files/resize2fs_once @@ -17,19 +17,32 @@ case "$1" in ROOT_DEV="/dev/${ROOT_DEV_BASE}" # Test ROOT_DEV deduction: (1) ROOT_DEV substring of ROOT_PART starting equal if [ -n "${ROOT_PART} -a -n "${ROOT_DEV} -a -z "${ROOT_PART##"${ROOT_DEV}"*}" ]; then - PARTED_OUT=`parted -s -m $ROOT_DEV unit B print` + PARTED_OUT=`parted -s -m ${ROOT_DEV} unit B print` PART_NO=`echo "$PARTED_OUT" | grep ext4 | awk -F: ' { print $1 } '` # Test ROOT_DEV deduction: (2) identified partition number if [ "${ROOT_PART}" = "${ROOT_DEV}p${PART_NO}" -o "${ROOT_PART}" = "${ROOT_DEV}${PART_NO}" ]; then + PART_START=`echo "${PARTED_OUT}" | grep "^${PART_NO}:" | awk -F: ' { print substr($2,1,length($2)-1) } '` PART_END=`echo "${PARTED_OUT}" | grep "^${PART_NO}:" | awk -F: ' { print substr($3,1,length($3)-1) } '` - PART_NEW_END=`parted -s -m $ROOT_DEV unit B print free | tail -1 | awk -F: ' { print substr($3,1,length($3)-1) } '` + PART_NEW_END=`parted -s -m ${ROOT_DEV} unit B print free | tail -1 | awk -F: ' { print substr($3,1,length($3)-1) } '` if [ -n "${PART_END}" -a -n "${PART_NEW_END}" -a ${PART_NEW_END} -gt ${PART_END} ]; then - echo "Resize partition ${PART_NO} from ${PART_END} to ${PART_NEW_END}" - parted -s $ROOT_DEV unit B resizepart ${PART_NO} ${PART_NEW_END} + echo "Resize partition ${PART_NO} from ${PART_START} - ${PART_END} to ${PART_NEW_END}" + if parted -s ${ROOT_DEV} unit B resizepart ${PART_NO} ${PART_NEW_END} ; then + echo "Resize partition OK (scripting mode)" + else + echo "Resize partition scripting mode failed, trying tty input..." + parted "${ROOT_DEV}" ---pretend-input-tty <<EOF +unit B +resizepart +${PART_NO} +Yes +${PART_NEW_END} +quit +EOF + fi echo "Resize fs on partition ${PART_NO}, ${ROOT_PART}" resize2fs $ROOT_PART else - echo "Resize partition 2 requirement failed: End ${PART_END} < new_end ${PART_NEW_END}" + echo "Resize partition 2 failed: End ${PART_END} >= new_end ${PART_NEW_END}" fi else echo "ROOT_PART ${ROOT_PART} not matching partition ${PART_NO} of ROOT_DEV ${ROOT_DEV}." @@ -37,8 +50,10 @@ case "$1" in else echo "ROOT_DEV ${ROOT_DEV} not a substring of ROOT_PART ${ROOT_PART}." fi - update-rc.d resize2fs_once remove - rm -f /etc/init.d/resize2fs_once + systemctl disable resize2fs_once.service + systemctl mask resize2fs_once.service + # mv /etc/init.d/resize2fs_once /etc/init.d/resize2fs_once.disabled + # mv /etc/init.d/resize2fs_disable /etc/init.d/resize2fs_disable.disabled log_end_msg $? ;; *) diff --git a/stage2/01-sys-tweaks/files/resize2fs_once.service b/stage2/01-sys-tweaks/files/resize2fs_once.service index 0c755a8..b808476 100644 --- a/stage2/01-sys-tweaks/files/resize2fs_once.service +++ b/stage2/01-sys-tweaks/files/resize2fs_once.service @@ -1,8 +1,8 @@ [Unit] Description=Resize the root filesystem to fill partition DefaultDependencies=no -After=systemd-udevd.service -Before=systemd-remount-fs.service systemd-random-seed.service systemd-journald.service local-fs-pre.target sysinit.target +After=systemd-remount-fs.service +Before=local-fs.target [Service] Type=oneshot @@ -10,6 +10,6 @@ RemainAfterExit=yes ExecStart=/etc/init.d/resize2fs_once start [Install] -WantedBy=systemd-remount-fs.service +WantedBy=local-fs.target Alias=resize2fs_once.service diff --git a/stage_rescue/00-install-packages/01-run.sh b/stage_rescue/00-install-packages/01-run.sh index 71a5620..b39a924 100755 --- a/stage_rescue/00-install-packages/01-run.sh +++ b/stage_rescue/00-install-packages/01-run.sh @@ -28,7 +28,7 @@ on_chroot <<EOF # Update grub.cfg for (1 ROOTFS_RO): timeout=5 or (2) normal memtest86+.bin menu entries update-grub - # Remove storage device related 'search.fs_uuid' and allow multi homing + # Remove storage device related search.fs_uuid and allow multi homing rm -f /boot/grub/i386-pc/load.cfg fi EOF |