From 0c7ada6d6769d2c9f55891e6b0e52e776196644e Mon Sep 17 00:00:00 2001 From: Jybz Date: Tue, 1 Dec 2020 09:22:56 +0100 Subject: add --mga-version option and rearrange bashcompletion jump list --- create_arm_image.sh | 51 ++++++++++++++++++++++++++++------------------- mageia4arm.bashcompletion | 21 +++++++++++++------ 2 files changed, 46 insertions(+), 26 deletions(-) diff --git a/create_arm_image.sh b/create_arm_image.sh index 75c7f7b..14de0a1 100755 --- a/create_arm_image.sh +++ b/create_arm_image.sh @@ -25,26 +25,27 @@ source "$(dirname $(realpath "$0"))/functions.sh" function help() { echo -e "${CMDNAME} [option]" echo -e "Options:" - echo -e "--all create ready to burn image of Mageia ${MAGEIA_VERSION}" - echo -e "--build-path Path to the build directory of the image of Mageia ${MAGEIA_VERSION}" - echo -e "--clean Clean all (suppress all) to make a new image" - echo -e "--log [file] logs the output into mga4arm-YYYY-MM-DD-HH-MM-\${config}.log or specific file." - echo -e "--config [name | path] A name of a default config or a path to a config files" - echo -e "--target target system (for now rpi, odroid)" - echo -e "--target-version version of the target (0, 1, 2, 3 for rpi, 3 or 4 for odroid)" -# echo -e "--bootfs filesystem of boot partition (ext4 or vfat) default: ext4" - echo -e "--nonfree activate nonfree repos" - echo -e "--size size of image default: 7Go" - echo -e "--tainted activate tainted repos" - echo -e "--desktop [xfce|...] add a desktop environment task" - echo -e "--package \"pkg1 pkg2\" One space separated list of package to install" + echo -e "--all create ready to burn image of Mageia ${MAGEIA_VERSION}" + echo -e "--build-path Path to the build directory of the image of Mageia ${MAGEIA_VERSION}" + echo -e "--clean Clean all (suppress all) to make a new image" + echo -e "--log [file] logs the output into mga4arm-YYYY-MM-DD-HH-MM-\${config}.log or specific file." + echo -e "--config [name | path] A name of a default config or a path to a config files" + echo -e "--target target system (for now rpi, odroid)" + echo -e "--target-version version of the target (0, 1, 2, 3 for rpi, 3 or 4 for odroid)" +# echo -e "--bootfs filesystem of boot partition (ext4 or vfat) default: ext4" + echo -e "--mga-version [1-7,cauldron] define which version of mageia to build" + echo -e "--nonfree activate nonfree repos" + echo -e "--size size of image default: 7Go" + echo -e "--tainted activate tainted repos" + echo -e "--desktop [xfce|...] add a desktop environment task" + echo -e "--package \"pkg1 pkg2\" One space separated list of package to install" - echo -e "\nBuild levels:" - echo -e "--create-chroot Create the chroot directory" - echo -e "--install-basesystem install base system" - echo -e "--add-urpmimedia add mirrors for urpmi" - echo -e "--chroot chroot to arm directory and launch packages installation" - echo -e "--create-image Create the image of Mageia ${MAGEIA_VERSION}" + echo -e "\nBuild levels:" + echo -e "--create-chroot Create the chroot directory" + echo -e "--install-basesystem install base system" + echo -e "--add-urpmimedia add mirrors for urpmi" + echo -e "--chroot chroot to arm directory and launch packages installation" + echo -e "--create-image Create the image of Mageia ${MAGEIA_VERSION}" echo -e "\nFor image size, make sure it fit on physical support. (Default size is 7 Go)" } @@ -102,7 +103,7 @@ fi # parsing commandline -TEMP=$(getopt -o h,a --long add-urpmimedia,add-checksum,all,help,clean,create-chroot,prepare-chroot,jump-chroot,create-image,config:,compress,target:,target-version:,chroot,bootfs:,install-basesystem,update-mirror,build-path:,size:,sign,nonfree,tainted -n ${CMDNAME} -- "${@}") +TEMP=$(getopt -o h,a --long add-urpmimedia,add-checksum,all,help,clean,create-chroot,prepare-chroot,jump-chroot,create-image,config:,compress,mga-version:,target:,target-version:,chroot,bootfs:,install-basesystem,update-mirror,build-path:,size:,sign,nonfree,tainted -n ${CMDNAME} -- "${@}") if [ ${?} -ne 0 ] ; then error "line ${LINENO} Failed parsing options." >&2 ; exit ${ERR_1} ; fi eval set -- "${TEMP}" @@ -188,6 +189,16 @@ while true; do fi shift ;; + --mga-version) + if [ "xcauldron" = "x${2}" ]; then + MAGEIA_VERSION="${2}" + elif [ "${2}" -gt 0 ]; then + MAGEIA_VERSION="${2}" + else + exit ${ERR_1} + fi + shift 2 + ;; --nonfree) NONFREE_P=1 shift diff --git a/mageia4arm.bashcompletion b/mageia4arm.bashcompletion index b2f4007..c790e83 100644 --- a/mageia4arm.bashcompletion +++ b/mageia4arm.bashcompletion @@ -2,12 +2,14 @@ _mageia4arm_completions() { local cur prev commands i PLATFORMS_PATH - commands="--all --build-path --clean --log --config --target --target-version --nonfree --size --tainted --compress --add-checksum --add-urpmimedia --chroot --create-chroot --create-image --help --install-basesystem --jump-chroot --prepare-chroot --sign --update-mirror --desktop --package " + commands="--all --build-path --clean --log --config --target --target-version --mga-version --nonfree --size --tainted --compress --add-checksum --add-urpmimedia --chroot --create-chroot --create-image --help --install-basesystem --jump-chroot --prepare-chroot --sign --update-mirror --desktop --package " COMPREPLY=() cur=${COMP_WORDS[COMP_CWORD]} DESKTOP_LIST="cinnamon cinnamon-minimal enlightenment enlightenment-minimal gnome gnome-minimal lxde lxde-minimal lxqt lxqt-minimal mate mate-minimal plasma5 plasma5-minimal sugar windowmaker xfce xfce-minimal fvwm2" + MGA_VERSION_LIST="1 2 3 4 5 6 7 cauldron" + if [ -e /usr/share/mageia4arm/platforms ]; then if [ -d /usr/share/mageia4arm/platforms ]; then PLATFORMS_PATH="/usr/share/mageia4arm/platforms" @@ -43,18 +45,22 @@ _mageia4arm_completions() prev=${COMP_WORDS[COMP_CWORD-1]} pprev=${COMP_WORDS[COMP_CWORD-2]} - if [ ${pprev} == "--config" ]; then + if [ ${pprev} == "--build-path" ]; then prev=jump - elif [ ${pprev} == "--size" ]; then + elif [ ${pprev} == "--config" ]; then + prev=jump + elif [ ${pprev} == "--desktop" ]; then + prev=jump + elif [ ${pprev} == "--mga-version" ]; then + prev=jump + elif [ ${pprev} == "--package" ]; then prev=jump - elif [ ${pprev} == "--build-path" ]; then + elif [ ${pprev} == "--size" ]; then prev=jump elif [ ${pprev} == "--target" ]; then prev=jump elif [ ${pprev} == "--target-version" ]; then prev=jump - elif [ ${pprev} == "--package" ]; then - prev=jump fi @@ -62,6 +68,9 @@ _mageia4arm_completions() --all|--clean|--nonfree|--tainted|--log|--compress|--add-checksum|--add-urpmimedia|--chroot|--create-chroot|--create-image|--help|--install-basesystem|--jump-chroot|--prepare-chroot|--sign|--update-mirror|jump) COMPREPLY=( $( compgen -W "${commands} " -- "$cur" ) ) ;; + --mga-version) + COMPREPLY=( $( compgen -W "${MGA_VERSION_LIST}" -- "$cur" ) ) + ;; --desktop) COMPREPLY=( $( compgen -W "${DESKTOP_LIST}" -- "$cur" ) ) ;; -- cgit v1.2.1