buildiso: do checksum for sfs images

This commit is contained in:
udeved 2016-10-19 16:01:16 +02:00
parent f19be5470a
commit f0743a5ce2
6 changed files with 21 additions and 56 deletions

View file

@ -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 <name> 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 ;;

View file

@ -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"

View file

@ -241,25 +241,6 @@ along with systemd; If not, see <http://www.gnu.org/licenses/>.
</para></listitem>
</varlistentry>
<varlistentry>
<!-- TODO: Need list of other available compressions -->
<term><varname>sfs_compress=</varname></term>
<listitem><para>Defaults compression that will be used
when creating the various images. Defaults to xz.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>sfs_checksum=</varname></term>
<listitem><para>Checksum that will be created against the
final .iso file. Can be <option>md5</option> (the default),
<option>sha1</option>, <option>sha256</option>,
<option>sha384</option> or <option>sha512</option>.
</para></listitem>
</varlistentry>
<varlistentry>
<term><varname>initsys=</varname></term>

View file

@ -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
}

View file

@ -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}"

View file

@ -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"