From f0743a5ce2f459b4547396632116a30d198388f3 Mon Sep 17 00:00:00 2001 From: udeved Date: Wed, 19 Oct 2016 16:01:16 +0200 Subject: [PATCH] buildiso: do checksum for sfs images --- bin/buildiso.in | 12 +++++------- data/manjaro-tools.conf | 7 ------- docbook/manjaro-tools.conf.xml | 19 ------------------- lib/util-iso-boot.sh | 1 + lib/util-iso.sh | 34 +++++++++++++++------------------- lib/util.sh | 4 ---- 6 files changed, 21 insertions(+), 56 deletions(-) diff --git a/bin/buildiso.in b/bin/buildiso.in index fc3bc4b..cb1564c 100755 --- a/bin/buildiso.in +++ b/bin/buildiso.in @@ -90,7 +90,7 @@ display_settings(){ msg2 "images_only: %s" "${images_only}" msg2 "iso_only: %s" "${iso_only}" msg2 "persist: %s" "${persist}" - msg2 "sign: %s" "${sign}" +# msg2 "sign: %s" "${sign}" msg2 "torrent: %s" "${torrent}" msg "DIST SETTINGS:" @@ -102,8 +102,6 @@ display_settings(){ msg2 "iso_label: %s" "${iso_label}" msg2 "iso_publisher: %s" "${iso_publisher}" msg2 "iso_app_id: %s" "${iso_app_id}" - msg2 "sfs_compress: %s" "${sfs_compress}" - msg2 "sfs_checksum: %s" "${sfs_checksum}" msg2 "use_overlayfs: %s" "${use_overlayfs}" ${verbose} && msg2 "iso_fs: %s" "${iso_fs}" @@ -125,7 +123,7 @@ pretend=false images_only=false iso_only=false verbose=false -sign=false +# sign=false torrent=false persist=false @@ -143,7 +141,7 @@ usage() { echo ' -i Init system to use' echo " [default: ${initsys}]" echo ' -m Set SquashFS image mode to persistence' - echo ' -s Sign the iso' +# echo ' -s Sign the sfs images' echo ' -c Disable clean work dir' echo ' -x Build images only' echo ' -z Generate iso only' @@ -159,7 +157,7 @@ usage() { orig_argv=("$@") -opts='p:a:b:r:t:k:i:czxsmwvqh' +opts='p:a:b:r:t:k:i:czxmwvqh' while getopts "${opts}" arg; do case "${arg}" in @@ -170,7 +168,7 @@ while getopts "${opts}" arg; do t) cache_dir_iso="$OPTARG" ;; k) kernel="$OPTARG" ;; i) initsys="$OPTARG" ;; - s) sign=true ;; +# s) sign=true ;; c) clean_first=false ;; x) images_only=true ;; z) iso_only=true ;; diff --git a/data/manjaro-tools.conf b/data/manjaro-tools.conf index 824f738..f6db0af 100644 --- a/data/manjaro-tools.conf +++ b/data/manjaro-tools.conf @@ -61,13 +61,6 @@ # iso app id # iso_app_id="Manjaro Linux Live/Rescue CD" -# compression used, possible values xz (default, best compression), gzip, lzma, lzo, lz4 -# lz4 is faster but worst compression, may be useful for locally testing isos -# sfs_compress=xz - -# valid: md5, sha1, sha256, sha384, sha512 -# sfs_checksum=md5 - # possible values: openrc,systemd # initsys="systemd" diff --git a/docbook/manjaro-tools.conf.xml b/docbook/manjaro-tools.conf.xml index 9234c9b..a5b0d92 100644 --- a/docbook/manjaro-tools.conf.xml +++ b/docbook/manjaro-tools.conf.xml @@ -241,25 +241,6 @@ along with systemd; If not, see . - - - sfs_compress= - - Defaults compression that will be used - when creating the various images. Defaults to xz. - - - - - sfs_checksum= - - Checksum that will be created against the - final .iso file. Can be (the default), - , , - or . - - - initsys= diff --git a/lib/util-iso-boot.sh b/lib/util-iso-boot.sh index 744be08..797ecc8 100644 --- a/lib/util-iso-boot.sh +++ b/lib/util-iso-boot.sh @@ -20,6 +20,7 @@ set_mkinicpio_hooks(){ sed -e 's/plymouth //' -i $1 fi if ! ${use_overlayfs};then + msg2 "Setting aufs hook" sed -e 's/miso /miso_aufs /' -i $1 fi } diff --git a/lib/util-iso.sh b/lib/util-iso.sh index 463042f..c968437 100644 --- a/lib/util-iso.sh +++ b/lib/util-iso.sh @@ -97,6 +97,18 @@ prepare_ext4_img(){ umount_img "${mnt}" } +sign_iso(){ + su ${OWNER} -c "signfile ${iso_dir}/$1" +} + +# $1: file +make_checksum(){ + msg2 "Creating md5sum ..." + cd $1 + md5sum $2.sfs > $2.md5 + cd ${OLDPWD} +} + # $1: image path make_sfs() { local src="$1" @@ -134,20 +146,19 @@ make_sfs() { mksfs_args+=(${sfs} -noappend) - local highcomp="-b 256K -Xbcj x86" - [[ "${sfs_compress}" != "xz" ]] && highcomp="" + local highcomp="-b 256K -Xbcj x86" comp='xz' if [[ "${name}" == "mhwdfs" && ${used_kernel} < "4" ]]; then mksfs_args+=(-comp lz4) else - mksfs_args+=(-comp ${sfs_compress} ${highcomp}) + mksfs_args+=(-comp ${comp} ${highcomp}) fi if ${verbose};then mksquashfs "${mksfs_args[@]}" >/dev/null else mksquashfs "${mksfs_args[@]}" fi - + make_checksum "${dest}" "${name}" ${persist} && rm "${src}.img" show_elapsed_time "${FUNCNAME}" "${timer_start}" @@ -455,9 +466,6 @@ check_requirements(){ import ${LIBDIR}/util-iso-${iso_fs}.sh } -sign_iso(){ - su ${OWNER} -c "signfile ${iso_dir}/$1" -} make_torrent(){ local fn=${iso_file}.torrent @@ -466,21 +474,9 @@ make_torrent(){ mktorrent ${mktorrent_args[*]} -o ${iso_dir}/${fn} ${iso_dir}/${iso_file} } -# $1: file -make_checksum(){ - msg "Creating [%s] sum ..." "${sfs_checksum}" - cd ${iso_dir} - local cs=$(${sfs_checksum}sum $1) - msg2 "%s sum: %s" "${sfs_checksum}" "${cs##*/}" - echo "${cs}" > ${iso_dir}/$1.${sfs_checksum} - msg "Done [%s] sum" "${sfs_checksum}" -} - compress_images(){ local timer=$(get_timer) run_safe "make_iso" - make_checksum "${iso_file}" - ${sign} && sign_iso "${iso_file}" ${torrent} && make_torrent user_own "${iso_dir}" "-R" show_elapsed_time "${FUNCNAME}" "${timer}" diff --git a/lib/util.sh b/lib/util.sh index 9f80551..dc14a99 100644 --- a/lib/util.sh +++ b/lib/util.sh @@ -301,10 +301,6 @@ init_buildiso(){ [[ -z ${iso_app_id} ]] && iso_app_id='Manjaro Linux Live/Rescue CD' - [[ -z ${sfs_compress} ]] && sfs_compress='xz' - - [[ -z ${sfs_checksum} ]] && sfs_checksum='md5' - [[ -z ${initsys} ]] && initsys="systemd" [[ -z ${kernel} ]] && kernel="linux44"