From 4e47dac7f9f4f9f8a1ef9495fb0a2b863fd76a98 Mon Sep 17 00:00:00 2001 From: Pascal Terjan Date: Tue, 22 Dec 2020 21:39:25 +0000 Subject: Mount /{proc,sys,dev} earlier This fixes many errors in scriptlets while installing basesystem (for example due to missing /dev/null). --- functions.sh | 22 ++++++++++------------ platforms/rpi1/specialFunctions.sh | 4 ++-- platforms/rpi2/specialFunctions.sh | 4 ++-- platforms/rpi3+/specialFunctions.sh | 4 ++-- platforms/rpi3+64/specialFunctions.sh | 4 ++-- platforms/rpi3/specialFunctions.sh | 4 ++-- platforms/rpi4/specialFunctions.sh | 4 ++-- platforms/xu4/specialFunctions.sh | 4 ++-- 8 files changed, 24 insertions(+), 26 deletions(-) diff --git a/functions.sh b/functions.sh index dfb3b16..655383d 100755 --- a/functions.sh +++ b/functions.sh @@ -28,7 +28,6 @@ function cleanExit(){ if [ 0 -ne ${#} ]; then if [ 0 -ne ${1} ]; then warning "unmounting all mounted files before exit" - unmountdevsysproc unmountingPartitions unloopingImage fi @@ -359,6 +358,7 @@ function preparechroot() { function mountdevsysproc(){ print_info "mounting dev, sys, proc directories in chroot" + mkdir -p "${BUILD_PATH}/dev" "${BUILD_PATH}/sys" "${BUILD_PATH}/proc" /usr/bin/mount -B /dev "${BUILD_PATH}/dev" # mkdir ${BUILD_PATH}/dev # ln -s ${DEVICE} ${BUILD_PATH}/dev/loop0 @@ -418,8 +418,6 @@ function unmountdevsysproc(){ function jumpchroot() { title "chrooting to ${BUILD_PATH}" - mountdevsysproc - print_info "Copying resolv.conf" /usr/bin/cp -v --preserve=mode /etc/resolv.conf "${BUILD_PATH}/etc/" if [ ${?} -ne 0 ]; then @@ -446,8 +444,6 @@ function jumpchroot() { fi fi - unmountdevsysproc - return 0 } @@ -663,12 +659,12 @@ function copyingsystem() { mkdir -p "${ARM_BOOT}" fi print_info "copying Mageia image to root partition" - /usr/bin/rsync -rlptogDH --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" - /usr/bin/rsync -rlptogDH "${ARM_BOOT}/" "${BOOT}/" - #/usr/bin/rsync -rlptogDH "${BUILD_PATH}/boot/" "${BOOT}/" + /usr/bin/rsync -rlptogDHx --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" + /usr/bin/rsync -rlptogDHx "${ARM_BOOT}/" "${BOOT}/" + #/usr/bin/rsync -rlptogDHx "${BUILD_PATH}/boot/" "${BOOT}/" else print_info "copying Mageia image to root partition" - /usr/bin/rsync -rlptogDH --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" + /usr/bin/rsync -rlptogDHx --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" fi copyingCustomSystem @@ -710,12 +706,15 @@ function mountPartitions() { mkdir -p "${BUILD_PATH}/boot/EFI" /usr/bin/mount -B ${BOOT} "${BUILD_PATH}/boot/EFI" fi + mountdevsysproc } function unmountingPartitions() { title "Unmounting partitions..." + unmountdevsysproc + # Syncing devices before unmounting /usr/bin/sync @@ -805,8 +804,8 @@ function unloopingImage() { # Copying files common to all systems function copyingcommon() { title "Copying common files and configuration" - rsync -rlptDH "${SOURCE_PATH}/common/" "${ROOT}/" - rsync -rlptDH "${SOURCE_PATH}/tools/"*.sh "${ROOT}/usr/local/bin/" + rsync -rlptDHx "${SOURCE_PATH}/common/" "${ROOT}/" + rsync -rlptDHx "${SOURCE_PATH}/tools/"*.sh "${ROOT}/usr/local/bin/" chown root:root "${ROOT}/usr/local/bin/" return 0 } @@ -831,7 +830,6 @@ function clean() { print_info "In case script failed or crash inside the chroot, need to unmount dev|sys|proc..." # TODO find what blocks the umount. - unmountdevsysproc unmountingPartitions unloopingImage diff --git a/platforms/rpi1/specialFunctions.sh b/platforms/rpi1/specialFunctions.sh index 3d09d3f..40e7124 100755 --- a/platforms/rpi1/specialFunctions.sh +++ b/platforms/rpi1/specialFunctions.sh @@ -141,7 +141,7 @@ function copyingCustomSystem() fi info "copying Mageia image to root partition" - /bin/rsync -rlptogDH --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" - /bin/rsync -rlptogDH "${ARM_BOOT}/" "${BOOT}/" + /bin/rsync -rlptogDHx --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" + /bin/rsync -rlptogDHx "${ARM_BOOT}/" "${BOOT}/" return 0 } diff --git a/platforms/rpi2/specialFunctions.sh b/platforms/rpi2/specialFunctions.sh index b63fa2a..472a06f 100755 --- a/platforms/rpi2/specialFunctions.sh +++ b/platforms/rpi2/specialFunctions.sh @@ -140,7 +140,7 @@ function copyingCustomSystem() fi info "copying Mageia image to root partition" - /bin/rsync -rlptogDH --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" - /bin/rsync -rlptogDH "${ARM_BOOT}/" "${BOOT}/" + /bin/rsync -rlptogDHx --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" + /bin/rsync -rlptogDHx "${ARM_BOOT}/" "${BOOT}/" return 0 } diff --git a/platforms/rpi3+/specialFunctions.sh b/platforms/rpi3+/specialFunctions.sh index 2dc08f5..83c62ee 100755 --- a/platforms/rpi3+/specialFunctions.sh +++ b/platforms/rpi3+/specialFunctions.sh @@ -141,7 +141,7 @@ function copyingCustomSystem() fi info "copying Mageia image to root partition" - /bin/rsync -rlptogDH --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" - /bin/rsync -rlptogDH "${ARM_BOOT}/" "${BOOT}/" + /bin/rsync -rlptogDHx --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" + /bin/rsync -rlptogDHx "${ARM_BOOT}/" "${BOOT}/" return 0 } diff --git a/platforms/rpi3+64/specialFunctions.sh b/platforms/rpi3+64/specialFunctions.sh index a62c794..ba54564 100755 --- a/platforms/rpi3+64/specialFunctions.sh +++ b/platforms/rpi3+64/specialFunctions.sh @@ -149,7 +149,7 @@ function copyingCustomSystem() fi info "copying Mageia image to root partition" - /bin/rsync -rlptogDH --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" - /bin/rsync -rlptogDH "${ARM_BOOT}/" "${BOOT}/" + /bin/rsync -rlptogDHx --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" + /bin/rsync -rlptogDHx "${ARM_BOOT}/" "${BOOT}/" return 0 } diff --git a/platforms/rpi3/specialFunctions.sh b/platforms/rpi3/specialFunctions.sh index b63fa2a..472a06f 100755 --- a/platforms/rpi3/specialFunctions.sh +++ b/platforms/rpi3/specialFunctions.sh @@ -140,7 +140,7 @@ function copyingCustomSystem() fi info "copying Mageia image to root partition" - /bin/rsync -rlptogDH --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" - /bin/rsync -rlptogDH "${ARM_BOOT}/" "${BOOT}/" + /bin/rsync -rlptogDHx --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" + /bin/rsync -rlptogDHx "${ARM_BOOT}/" "${BOOT}/" return 0 } diff --git a/platforms/rpi4/specialFunctions.sh b/platforms/rpi4/specialFunctions.sh index a5d6101..581baa5 100755 --- a/platforms/rpi4/specialFunctions.sh +++ b/platforms/rpi4/specialFunctions.sh @@ -153,7 +153,7 @@ function copyingCustomSystem() fi info "copying Mageia image to root partition" - /bin/rsync -rlptogDH --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" - /bin/rsync -rlptogDH "${ARM_BOOT}/" "${BOOT}/" + /bin/rsync -rlptogDHx --exclude "${ARM_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" + /bin/rsync -rlptogDHx "${ARM_BOOT}/" "${BOOT}/" return 0 } diff --git a/platforms/xu4/specialFunctions.sh b/platforms/xu4/specialFunctions.sh index 9860735..f0e8bbb 100755 --- a/platforms/xu4/specialFunctions.sh +++ b/platforms/xu4/specialFunctions.sh @@ -96,8 +96,8 @@ function copyingCustomSystem() info "Copying extlinux.conf on ${ODROID_BOOT}" cp --preserve=mode -R "${BUILD_PATH}/boot/extlinux" "${ODROID_BOOT}/" info "copying Mageia image to root partition" - /bin/rsync -rlptogDH --exclude "${ODROID_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" - /bin/rsync -rlptogDH "${ODROID_BOOT}/" "${BOOT}/" + /bin/rsync -rlptogDHx --exclude "${ODROID_BOOT}/" --exclude "qemu-arm-static*" "${BUILD_PATH}/" "${ROOT}/" + /bin/rsync -rlptogDHx "${ODROID_BOOT}/" "${BOOT}/" return 0 } -- cgit v1.2.1