diff options
author | Jybz <j.biernacki@free.fr> | 2020-08-30 22:45:32 +0200 |
---|---|---|
committer | Jybz <j.biernacki@free.fr> | 2020-08-30 22:45:32 +0200 |
commit | 2aec16abae47604b71d18501e1a186faa4db4a5d (patch) | |
tree | 4d964ff1cd0ad527c558f947cd88d07bf243f3a5 | |
parent | dd5ecf6785d417c0d01b3426252e5af1d69e48f1 (diff) | |
download | mageia4arm-2aec16abae47604b71d18501e1a186faa4db4a5d.tar mageia4arm-2aec16abae47604b71d18501e1a186faa4db4a5d.tar.gz mageia4arm-2aec16abae47604b71d18501e1a186faa4db4a5d.tar.bz2 mageia4arm-2aec16abae47604b71d18501e1a186faa4db4a5d.tar.xz mageia4arm-2aec16abae47604b71d18501e1a186faa4db4a5d.zip |
add compress option, sign option, checksum option in argument list. Define default values or it.
-rwxr-xr-x | create_arm_image.sh | 14 | ||||
-rwxr-xr-x | functions.sh | 10 |
2 files changed, 20 insertions, 4 deletions
diff --git a/create_arm_image.sh b/create_arm_image.sh index b46947a..a0d285c 100755 --- a/create_arm_image.sh +++ b/create_arm_image.sh @@ -75,7 +75,7 @@ fi # parsing commandline -TEMP=$(getopt -o h,a --long all,help,clean,create-chroot,prepare-chroot,jump-chroot,add-urpmimedia,create-image,config:,target:,target-version:,chroot,bootfs:,install-basesystem,update-mirror,build-path:,size:,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,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}" @@ -88,6 +88,10 @@ while true; do fi shift ;; + --add-checksum) + GEN_CHECKSUM="true" + shift + ;; -a|--all) OPT="all" shift 1 @@ -110,6 +114,10 @@ while true; do OPT="clean" shift ;; + --compress) + GEN_GZ="true" + shift + ;; --config) CONFIG_PATH="${PLATFORMS_PATH}/${2}" shift 2 @@ -152,6 +160,10 @@ while true; do fi shift ;; + --sign) + GEN_SIGN="true" + shift + ;; --size) IMAGE_SIZE_P=${2} shift 2 diff --git a/functions.sh b/functions.sh index cec3e55..677af95 100755 --- a/functions.sh +++ b/functions.sh @@ -714,17 +714,21 @@ function clean() function generateExtra() { - if [ ${GEN_CHECKSUM} ] ; then + #Set values by default to false. + GEN_CHECKSUM=${GEN_CHECKSUM:="false"} + GEN_GZ=${GEN_GZ:="false"} + GEN_SIGN=${GEN_SIGN:="false"} + if ${GEN_CHECKSUM} ; then title "Generate checksum" md5sum "${INSTALL_PATH}/${IMAGE}" > "${INSTALL_PATH}/${IMAGE}.md5" sha512sum "${INSTALL_PATH}/${IMAGE}" > "${INSTALL_PATH}/${IMAGE}.sha512" sha384sum "${INSTALL_PATH}/${IMAGE}" > "${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 - if [ ${GEN_SIGN} ]; then + if ${GEN_SIGN} ; then pushd "${INSTALL_PATH}" gpg --sign ${IMAGE}.md5 gpg --sign ${IMAGE}.sha512 |