From f090cffedd995cae04a1ed2823eb9fbe52cbb7ea Mon Sep 17 00:00:00 2001 From: Jybz Date: Thu, 19 Nov 2020 11:33:01 +0100 Subject: Move IMAGE= variable outside of configuration, improve clean function, prepare Desktop environment --- create_arm_image.sh | 15 +++++++++------ functions.sh | 29 +++++++++++------------------ platforms/bananaPro/mageia4arm.cfg | 6 +++--- platforms/generic_aarch64/mageia4arm.cfg | 3 --- platforms/rpi2/mageia4arm.cfg | 3 --- platforms/rpi3+/mageia4arm.cfg | 3 --- platforms/rpi3+64/mageia4arm.cfg | 3 --- platforms/rpi3/mageia4arm.cfg | 3 --- platforms/rpi4/mageia4arm.cfg | 3 --- platforms/xu4/mageia4arm.cfg | 3 --- 10 files changed, 23 insertions(+), 48 deletions(-) diff --git a/create_arm_image.sh b/create_arm_image.sh index 25f8e2b..01625b8 100755 --- a/create_arm_image.sh +++ b/create_arm_image.sh @@ -166,7 +166,8 @@ while true; do shift ;; --desktop) - DESKTOP="task-${2}" + DESKTOP="${2}" + DESKTOP_TASK="task-${DESKTOP}" shift 2 ;; -h|--help) @@ -266,6 +267,8 @@ else fi # VARIABLE_A=${VARIABLE_B_IF_EXISTS:=${VARIABLE_C_IF_B_DOESNT_EXISTS}} +IMAGE_SIZE=2 #Set a default size in case it is missing. +#Redefined priority : commandline, then specific board config file. IMAGE_SIZE="${IMAGE_SIZE_P:=${IMAGE_SIZE}}" INSTALL_PATH="${INSTALL_PATH_P:=${INSTALL_PATH}}" TARGET="${TARGET_P:=${TARGET}}" @@ -274,6 +277,10 @@ BOOTFS="${BOOTFS_P:=${BOOTFS}}" NONFREE="${NONFREE_P:=0}" TAINTED="${TAINTED_P:=0}" +#name of the image +DESKTOP_NAME="${DESKTOP:="noDE"}" +IMAGE_BASE="Mageia-${MAGEIA_VERSION}-${TARGET}" +IMAGE="${IMAGE_BASE}-${DESKTOP_NAME}.img" info "Option: "${OPT} @@ -296,11 +303,6 @@ info "Firmware path : ${FIRMWARE_PATH}" info "Firmware dir : ${FIRMWARE_DIR}" info "Installation method : ${INSTALL_METHOD}" -# Defining default image size to 7 go -# if [[ "${IMAGE_SIZE}" -lt 2 ]] || [[ "${IMAGE_SIZE}" -gt 128 ]]; then -# IMAGE_SIZE=7 -# fi - # change dir to install path and create it if not existing if [ "${OPT}" != "clean" ]; then info "cd ${INSTALL_PATH}" @@ -323,6 +325,7 @@ OPT=${OPT:="--help"} info "Image size is: ${IMAGE_SIZE} GB" + case ${OPT} in "clean") clean diff --git a/functions.sh b/functions.sh index 891803c..e0c33d0 100755 --- a/functions.sh +++ b/functions.sh @@ -793,29 +793,19 @@ function clean() { title "Cleaning" info "In case script failed or crash inside the chroot, need to unmount dev|sys|proc..." -# udisksctl unmount -b ${PARTITION} -# /bin/umount -lf "${BUILD_PATH}/dev" -# /bin/umount -lf "${BUILD_PATH}/sys" -# /bin/umount -lf "${BUILD_PATH}/proc" + # TODO find what blocks the umount. unmountdevsysproc unmountingPartitions unloopingImage - # Removing old Build directory -# if [ -d "${BUILD_PATH}" ]; then -# info "Removing ${BUILD_PATH}" -# /usr/bin/rm -Rf "${BUILD_PATH}" -# else -# warning "${BUILD_PATH} does not exists" -# fi # removing old image - if [ -e "${INSTALL_PATH}/${IMAGE}" ]; then - info "Removing ${IMAGE}" - /usr/bin/rm -f "${INSTALL_PATH}/${IMAGE}" - else - warning "${IMAGE} does not exists" - fi + info "Removing ${IMAGE_BASE}* files" + /usr/bin/rm -f "${INSTALL_PATH}/${IMAGE_BASE}*.img" + /usr/bin/rm -f "${INSTALL_PATH}/${IMAGE_BASE}*.gz" + /usr/bin/rm -f "${INSTALL_PATH}/${IMAGE_BASE}*.md5" + /usr/bin/rm -f "${INSTALL_PATH}/${IMAGE_BASE}*.sha512" + /usr/bin/rm -f "${INSTALL_PATH}/${IMAGE_BASE}*.sha3" return 0 } @@ -834,7 +824,10 @@ function check_extrapackage() { } function extrapackage() { - installpkg ${PACKAGE_VALID} + if [ "x${DESKTOP_TASK}" != "x" ]; then + installpkg ${DESKTOP_TASK} + fi + installpkg "${PACKAGE_VALID}" return 0 } diff --git a/platforms/bananaPro/mageia4arm.cfg b/platforms/bananaPro/mageia4arm.cfg index f5730fd..a701573 100644 --- a/platforms/bananaPro/mageia4arm.cfg +++ b/platforms/bananaPro/mageia4arm.cfg @@ -30,9 +30,6 @@ TARGET_VERSION="1" # URL of the Mageia mirror used to install ( see mirrors.mageia.org ) # MIRROR="http://ftp.free.fr/mirrors/mageia.org/distrib/${MAGEIA_VERSION}/${ARM_VERSION}" -#name of the image -IMAGE="Mageia-${MAGEIA_VERSION}-${TARGET}.img" - # Default user # If not set, no user will be defined. # ID_USER="user" @@ -53,5 +50,8 @@ BOOTFS="vfat" #kernel package to install KERNEL="kernel-desktop" +#Size of the image by default +IMAGE_SIZE=1 + #The arguments for the Kernel BOOT_ARGS='console=ttyS0,115200 disp.screen0_output_mode=EDID:1024x768p50 hdmi.audio=EDID:0 audit=0' diff --git a/platforms/generic_aarch64/mageia4arm.cfg b/platforms/generic_aarch64/mageia4arm.cfg index cb80e0e..1c3cedf 100644 --- a/platforms/generic_aarch64/mageia4arm.cfg +++ b/platforms/generic_aarch64/mageia4arm.cfg @@ -30,9 +30,6 @@ TARGET_VERSION="1" # URL of the Mageia mirror used to install ( see mirrors.mageia.org ) # MIRROR="http://ftp.free.fr/mirrors/mageia.org/distrib/${MAGEIA_VERSION}/${ARM_VERSION}" -#name of the image -IMAGE="Mageia-${MAGEIA_VERSION}-${TARGET}.img" - # Default user # If not set, no user will be defined. # ID_USER="user" diff --git a/platforms/rpi2/mageia4arm.cfg b/platforms/rpi2/mageia4arm.cfg index a466d97..f256c6f 100644 --- a/platforms/rpi2/mageia4arm.cfg +++ b/platforms/rpi2/mageia4arm.cfg @@ -28,9 +28,6 @@ TARGET_VERSION="2" MIRROR="http://ftp.free.fr/mirrors/mageia.org/distrib/$MAGEIA_VERSION/$ARM_VERSION" #MIRROR="/mnt/STOCK/mageia/distrib/$MAGEIA_VERSION/$ARM_VERSION" -#name of the image -IMAGE="Mageia-${MAGEIA_VERSION}-$TARGET$TARGET_VERSION.img" - #Default user ID_USER="pi" PASSWORD="raspberry" diff --git a/platforms/rpi3+/mageia4arm.cfg b/platforms/rpi3+/mageia4arm.cfg index 0100f89..fd48765 100644 --- a/platforms/rpi3+/mageia4arm.cfg +++ b/platforms/rpi3+/mageia4arm.cfg @@ -28,9 +28,6 @@ TARGET_VERSION="3+" MIRROR="http://ftp.free.fr/mirrors/mageia.org/distrib/${MAGEIA_VERSION}/${ARM_VERSION}" #MIRROR="/mnt/STOCK/mageia/distrib/$MAGEIA_VERSION/$ARM_VERSION" -#name of the image -IMAGE="Mageia-${MAGEIA_VERSION}-${TARGET}.img" - #Default user ID_USER="pi" PASSWORD="raspberry" diff --git a/platforms/rpi3+64/mageia4arm.cfg b/platforms/rpi3+64/mageia4arm.cfg index 70144c9..94b16f0 100644 --- a/platforms/rpi3+64/mageia4arm.cfg +++ b/platforms/rpi3+64/mageia4arm.cfg @@ -29,9 +29,6 @@ TARGET_VERSION="3+64" MIRROR="http://ftp.free.fr/mirrors/mageia.org/distrib/${MAGEIA_VERSION}/${ARM_VERSION}" #MIRROR="/mnt/STOCK/mageia/distrib/$MAGEIA_VERSION/$ARM_VERSION" -#name of the image -IMAGE="Mageia-${MAGEIA_VERSION}-${TARGET}.img" - #Default user # ID_USER="pi" # PASSWORD="raspberry" diff --git a/platforms/rpi3/mageia4arm.cfg b/platforms/rpi3/mageia4arm.cfg index 42a8315..c6d050e 100644 --- a/platforms/rpi3/mageia4arm.cfg +++ b/platforms/rpi3/mageia4arm.cfg @@ -32,9 +32,6 @@ TARGET_VERSION="3_32" MIRROR="http://ftp.free.fr/mirrors/mageia.org/distrib/$MAGEIA_VERSION/$ARM_VERSION" #MIRROR="/mnt/STOCK/mageia/distrib/$MAGEIA_VERSION/$ARM_VERSION" -#name of the image -IMAGE="Mageia-${MAGEIA_VERSION}-$TARGET.img" - #Default user ID_USER="pi" PASSWORD="raspberry" diff --git a/platforms/rpi4/mageia4arm.cfg b/platforms/rpi4/mageia4arm.cfg index b7ba0cb..6a8d914 100644 --- a/platforms/rpi4/mageia4arm.cfg +++ b/platforms/rpi4/mageia4arm.cfg @@ -29,9 +29,6 @@ TARGET_VERSION="4" MIRROR="http://ftp.free.fr/mirrors/mageia.org/distrib/${MAGEIA_VERSION}/${ARM_VERSION}" #MIRROR="/mnt/STOCK/mageia/distrib/$MAGEIA_VERSION/$ARM_VERSION" -#name of the image -IMAGE="Mageia-${MAGEIA_VERSION}-${TARGET}.img" - #Default user # ID_USER="pi" # PASSWORD="raspberry" diff --git a/platforms/xu4/mageia4arm.cfg b/platforms/xu4/mageia4arm.cfg index 11471b7..efda5e5 100644 --- a/platforms/xu4/mageia4arm.cfg +++ b/platforms/xu4/mageia4arm.cfg @@ -24,9 +24,6 @@ TARGET_VERSION="xu4" #MIRROR="http://ftp.free.fr/mirrors/mageia.org/distrib/$MAGEIA_VERSION/$ARM_VERSION" MIRROR="http://192.168.1.252/mageia/distrib/$MAGEIA_VERSION/$ARM_VERSION" -#name of the image -IMAGE="Mageia-${MAGEIA_VERSION}-$TARGET.img" - #Default user ID_USER="odroid" PASSWORD="xu4" -- cgit v1.2.1