diff options
Diffstat (limited to 'functions.sh')
-rwxr-xr-x | functions.sh | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/functions.sh b/functions.sh index 76fd278..2c9773b 100755 --- a/functions.sh +++ b/functions.sh @@ -32,7 +32,7 @@ function cleanExit(){ unloopingImage fi fi - + exit $@ } @@ -99,7 +99,7 @@ function createchroot() { fi fi - if [ `arch` != "${ARM_VERSION}" ]; then + if [ `arch` != "${ARM_VERSION}" ]; then if ! [ -f /usr/bin/qemu-arm-static ]; then title "Qemu package not present : installing qemu packages" #/usr/bin/dnf --assumeyes --setopt=install_weak_deps=False install qemu-user-static @@ -203,7 +203,7 @@ function addurpmimedia() { if [ 0 -eq ${?} ]; then /sbin/urpmi.addmedia --urpmi-root "${BUILD_PATH}" --ignorearch --distrib "${MIRROR}" else - /sbin/urpmi.addmedia --urpmi-root "${BUILD_PATH}" --ignorearch --distrib "${MIRROR}/${ARM_VERSION}" + /sbin/urpmi.addmedia --urpmi-root "${BUILD_PATH}" --ignorearch --distrib "${MIRROR}/${ARM_VERSION}" fi else print_info "MIRROR variable not set, using mirrorlist." @@ -417,14 +417,14 @@ function unmountdevsysproc(){ function jumpchroot() { title "chrooting to ${BUILD_PATH}" - + print_info "Copying resolv.conf" /usr/bin/cp -v --preserve=mode /etc/resolv.conf "${BUILD_PATH}/etc/" if [ ${?} -ne 0 ]; then error "line ${LINENO} error copying ${BUILD_PATH}/etc/resolv.conf : exiting" cleanExit ${ERR_1} fi - + print_info "chrooting to ${BUILD_PATH}" if [ "$OPT" = "chroot" ]; then print_info "/sbin/chroot ${BUILD_PATH}" @@ -456,14 +456,14 @@ function createImageWrap() { cleanExit ${ERR_1} fi createimage - + # loopingImage partitionningimage - + BOOTFS=${BOOTFS:="ext4"} formatpartitions ${BOOTFS} ext4 - + loopingImage return 0 @@ -524,7 +524,7 @@ function partitionningimage() { ROOT_NB_SECTORS=$(echo "${ROOT_P_INFO}" | sed -e "s/^.*${IMAGE}[[:digit:]][[:space:]\*]\+//g" | cut -d ' ' -f 3) ROOT_SIZE_KB="$((${SECTOR_SIZE}*${ROOT_NB_SECTORS}/1024))" ROOT_OFFSET_B="$((${SECTOR_SIZE}*${ROOT_OFFSET_S}))" - + print_info "Root offset : ${ROOT_OFFSET_S}" print_info "Root offset (B) : ${ROOT_OFFSET_B}" print_info "Root sectors : ${ROOT_NB_SECTORS}" @@ -556,26 +556,26 @@ function loopingImage() { fi print_info "Image looped on ${DEVICE}" - - + + #Previous function give us a list of partition. It is easy to get it and define prior this list the partition. #But... How to distinguish between the boot p1 and the root p2 if both are empty and ext4 ? ... if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then BOOTP="${DEVICE}p1" ROOTP="${DEVICE}p2" - + # BOOT_UUID=$(/usr/sbin/blkid -s UUID -o value UUID "${BOOTP}") BOOT_UUID=$(/usr/bin/lsblk -n -o UUID "${BOOTP}") print_info "Boot UUID: ${BOOT_UUID}" else ROOTP="${DEVICE}p1" fi - + # ROOT_UUID=$(/usr/sbin/blkid -s UUID -o value UUID "${ROOTP}") ROOT_UUID=$(/usr/bin/lsblk -n -o UUID "${ROOTP}") print_info "Root UUID: ${ROOT_UUID}" - + return 0 } @@ -650,7 +650,7 @@ function copyingsystem() { print_info "Remove second_stage_install.sh" /usr/bin/rm -f "${BUILD_PATH}/second_stage_install.sh" - + ### BUG : rpi3b+64b is using a bootloader partition, in which only the bootloader lays. Here, everything is copying into. if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then ARM_BOOT="${BUILD_PATH}/mnt/arm_boot" @@ -693,7 +693,7 @@ function mountPartitions() { MOUNTED_ROOT=true print_info "Root partition mount in ${ROOT}" BUILD_PATH=${ROOT} - + if [ 1 -eq ${SEPARATE_BOOT_PARTITION} ]; then BOOT=$(/usr/bin/udisksctl mount -b ${BOOTP} | sed -e 's/^.* at //' -e 's/\.$//' ) if [ ${?} -ne 0 ]; then @@ -702,7 +702,7 @@ function mountPartitions() { fi print_info "boot partition mount in ${BOOT}" MOUNTED_BOOT=true - + mkdir -p "${BUILD_PATH}/boot/EFI" /usr/bin/mount -B ${BOOT} "${BUILD_PATH}/boot/EFI" fi @@ -755,7 +755,7 @@ function unmountingPartitions() { error "line ${LINENO} error unmounting ${ROOT}..." fi fi - + # if [ ! -z "${BOOTP}" ]; then # udisksctl unmount -b ${BOOTP} # if [ ${?} -eq 0 ]; then @@ -779,7 +779,7 @@ function unloopingImage() { title "Unlooping image..." # Syncing devices before unmounting /usr/bin/sync - + if [ "x" != "${DEVICE:="x"}" ]; then /usr/bin/udisksctl loop-delete -b ${DEVICE} else @@ -826,7 +826,7 @@ function mkfstab() { # cleaning build space function clean() { title "Cleaning" - + print_info "In case script failed or crash inside the chroot, need to unmount dev|sys|proc..." # TODO find what blocks the umount. @@ -872,7 +872,7 @@ function generateExtra() { GEN_CHECKSUM=${GEN_CHECKSUM:="false"} GEN_GZ=${GEN_GZ:="false"} GEN_SIGN=${GEN_SIGN:="false"} - if ${GEN_CHECKSUM} ; then + if ${GEN_CHECKSUM} ; then title "Generate checksum" md5sum "${INSTALL_PATH}/${IMAGE}" > "${INSTALL_PATH}/${IMAGE}.md5" sha512sum "${INSTALL_PATH}/${IMAGE}" > "${INSTALL_PATH}/${IMAGE}.sha512" @@ -881,7 +881,7 @@ function generateExtra() { print_info "${INSTALL_PATH}/${IMAGE}.sha512" print_info "${INSTALL_PATH}/${IMAGE}.sha3" fi - if ${GEN_GZ} ; then + if ${GEN_GZ} ; then title "Image compression" pv "${INSTALL_PATH}/${IMAGE}" | gzip -9 >"${INSTALL_PATH}/${IMAGE}.gz" fi |