Added options --md5 and --sha256 to Jigdo releng test

This commit is contained in:
Thomas Schmitt 2019-11-26 20:38:18 +01:00
parent 9028117c01
commit ea863307a4
4 changed files with 115 additions and 34 deletions

View File

@ -5,7 +5,8 @@ libisoburn/releng. By George Danchev <danchev@spnet.net>
and Thomas Schmitt <scdbackup@gmx.net> and Thomas Schmitt <scdbackup@gmx.net>
Test suite for xorriso and libburnia libraries. Test suite for xorriso and libburnia libraries.
Copyright (C) 2011 - 2012 George Danchev, Thomas Schmitt Copyright (C) 2011 - 2012 George Danchev
Copyright (C) 2011, 2012, 2019 Thomas Schmitt
Provided under GPL version 2 or later. Provided under GPL version 2 or later.
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
@ -120,17 +121,18 @@ the user or require sysadmin considerations before they are run:
as one single argument. On Solaris use: as one single argument. On Solaris use:
--priv_cmd pfexec --priv_cmd pfexec
./manual_isojigdo -x ../xorriso/xorriso ./manual_isojigdo -x ../xorriso/xorriso [-- [--md5 | --sha256]]
Exercises the production of a bootable Debian GNU/Linux image and its Jigdo Exercises the production of a bootable Debian GNU/Linux image and its Jigdo
files. This test downloads a Debian daily image for i386 of about 270 MB, files. This test downloads a Debian daily image for i386 of about 350 MB,
extracts its content and composes a new image. Thus it needs about 850 MB extracts its content and composes a new image. Thus it needs about 1100 MB
of disk space in releng/releng_generated_data when unpacked. Adding the daily of disk space in releng/releng_generated_data when unpacked. Adding the daily
image size itself, the total space used would peak at about 1.2 GB. image size itself, the total space used would peak at about 1.5 GB.
This test will only work with GNU xorriso or if libjte was installed already This test will only work with GNU xorriso or if libjte was installed already
when libisofs was built. Further it needs the program jigit-mkimage. Both when libisofs was built. Further it needs the program jigit-mkimage. Both
are part of package jigit, version >= 1.18, available at: are part of package jigit, version >= 1.22, available at:
http://www.einval.com/~steve/software/JTE/ http://www.einval.com/~steve/software/JTE/
Currently jigit builds only in GNU environments. Currently jigit builds only in GNU environments.
debian-cd currently uses the --md5 format. In future it will use --sha256.
Any auto_* script can be run on its own. Some of them demand option -x. Any auto_* script can be run on its own. Some of them demand option -x.

View File

@ -1,16 +1,18 @@
#!/bin/sh #!/bin/sh
# Copyright (c) 2010, 2011 George Danchev <danchev@spnet.net> # Copyright (c) 2010, 2011 George Danchev <danchev@spnet.net>
# Copyright (c) 2010, 2011 Thomas Schmitt <scdbackup@gmx.net> # Copyright (c) 2010, 2011, 2019 Thomas Schmitt <scdbackup@gmx.net>
# This script is distributed according to the terms of the GNU GPL v2. # This script is distributed according to the terms of the GNU GPL v2.
# This should be better rewritten in C at some future point. Ref: pwd code. # This should be better rewritten in C at some future point. Ref: pwd code.
# Create a list of MD5sums encoded in hexadecimal format and print to standard output # Create a list of checksums encoded in hexadecimal format and print to
# standard output. Checksum may be MD5 or SHA256.
# Format Description # Format Description
# A line in the emerging file is to be composed as follows: # A line in the emerging file is to be composed as follows:
# #
# The MD5 checksum of the file content must be encoded in 32 hex digits # The checksum of the file content must be encoded in the aprropriate number
# of hex digits.
# [0-9afAF] # [0-9afAF]
# #
# Next come two blanks. # Next come two blanks.
@ -37,35 +39,61 @@
# text, like "Debian:". # text, like "Debian:".
# A simple strategy to cope with this is to write absolute paths into the # A simple strategy to cope with this is to write absolute paths into the
# .md5 file, and to use matching absolute paths in the -jigdo-map # checksum file, and to use matching absolute paths in the -jigdo-map
# directives. Keep in mind that mapping is purely literal. Symbolic links # directives. Keep in mind that mapping is purely literal. Symbolic links
# are neither resolved nor can they confuse the mapping. # are neither resolved nor can they confuse the mapping.
set -e set -e
SELF=jigdo-gen-md5-list SELF=jigdo-gen-md5-list
VER=0.2 VER=0.3
OPT_ABSOLUTE=1 OPT_ABSOLUTE=1
# The checksum type to produce: md5 , sha256
checksum_type=md5
hex_length=32
md5_cmd=
# On FreeBSD there is "md5" rather than "md5sum". # On FreeBSD there is "md5" rather than "md5sum".
# Furthermore, the FreeBSD shell reports missing commands to inherited stderr, # Furthermore, the FreeBSD shell reports missing commands to inherited stderr,
# regardless that the attempt itself has redirected stderr. Thus a sub shell # regardless that the attempt itself has redirected stderr. Thus a sub shell
# is needed to hide the protest. # is needed to hide the protest.
if ( md5sum --help ) >/dev/null 2>&1 choose_checksum_cmd() {
then if test "$checksum_type" = "md5"
md5_cmd=md5sum then
elif ( md5 -s test ) >/dev/null 2>&1 if ( md5sum --help ) >/dev/null 2>&1
then then
md5_cmd=md5 md5_cmd=md5sum
else elif ( md5 -s test ) >/dev/null 2>&1
echo "$0 : Programs md5sum and md5 failed to work" >&2 then
exit 2 md5_cmd=md5
fi else
echo "$0 : Programs md5sum and md5 failed to work" >&2
exit 2
fi
elif test "$checksum_type" = "sha256"
then
if ( sha256sum --help ) >/dev/null 2>&1
then
md5_cmd=sha256sum
elif ( sha256 -s test ) >/dev/null 2>&1
then
md5_cmd=sha256
else
echo "$0 : Programs sha256sum and sha256 failed to work" >&2
exit 2
fi
fi
}
usage() { usage() {
cat << USAGE cat << USAGE
usage: $SELF [option] DIR FILE ... usage: $SELF [option] DIR FILE ...
Print a Jigdo checksum file to stdout. One line per FILE and per file in DIR.
-m, --md5 produce MD5 checksums (default)
-s, --sha256 produce SHA256 checksums
-a, --make-absolute make absolute paths, avoiding any symlinks (default) -a, --make-absolute make absolute paths, avoiding any symlinks (default)
-l, --keep-literal leave paths untouched, literally as supplied -l, --keep-literal leave paths untouched, literally as supplied
-v, --version print version -v, --version print version
@ -100,12 +128,18 @@ md5list() {
elif test "$md5_cmd" = "md5" elif test "$md5_cmd" = "md5"
then then
MD5=`md5 -q "$item"` MD5=`md5 -q "$item"`
elif test "$md5_cmd" = "sha256sum"
then
MD5=`sha256sum "$item" | awk '{print $1}'`
elif test "$md5_cmd" = "sha256"
then
MD5=`sha256 -q "$item"`
else else
echo "$0 : No MD5 program found" >&2 echo "$0 : Internal error : Checksum mode unknown : $md5_cmd" >&2
exit 2 exit 2
fi fi
SIZ=`ls -ld "$item" | awk '{print $5}'` SIZ=`ls -ld "$item" | awk '{print $5}'`
printf '%32s %12s %s\n' "$MD5" "$SIZ" "$item" printf '%'"$hex_length"'s %12s %s\n' "$MD5" "$SIZ" "$item"
} }
walkdir() { walkdir() {
@ -123,7 +157,17 @@ if test "$1" = "" ; then
exit 1 exit 1
fi fi
case "$1" in for i in "$@"
do
case "$i" in
--md5|-m)
checksum_type=md5
hex_length=32
;;
--sha256|-s)
checksum_type=sha256
hex_length=64
;;
--make-absolute|-a) --make-absolute|-a)
OPT_ABSOLUTE=1; OPT_ABSOLUTE=1;
shift; shift;
@ -147,12 +191,15 @@ case "$1" in
# usage # usage
# exit 1 # exit 1
# ;; # ;;
esac esac
done
choose_checksum_cmd
for i in "$@" for i in "$@"
do do
if echo "$i" | grep '^-' >/dev/null ; then
if test -d "$i" ; then dummy=dummy
elif test -d "$i" ; then
DR="$i" DR="$i"
if test $OPT_ABSOLUTE -eq 1; then if test $OPT_ABSOLUTE -eq 1; then
od=`pwd -P` # old dir od=`pwd -P` # old dir

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# Copyright 2011 Thomas Schmitt <scdbackup@gmx.net> # Copyright 2011, 2019 Thomas Schmitt <scdbackup@gmx.net>
# Copyright 2011 George Danchev <danchev@spnet.net> # Copyright 2011 George Danchev <danchev@spnet.net>
# Licensed under GNU GPL version 2 or later # Licensed under GNU GPL version 2 or later
@ -16,7 +16,8 @@ not_in_releng_exit() {
print_specific_help() { print_specific_help() {
cat << HLP cat << HLP
Specific options: Specific options:
none yet. --md5 use MD5 checksums (default)
--sha256 use SHA256 checksums
Overview: Overview:
Match the resulting ISO image representation Match the resulting ISO image representation
against the jigdo representation. against the jigdo representation.
@ -28,6 +29,33 @@ if test "$SPECIFIC_HELP" = 1; then
exit 0 exit 0
fi fi
# Set default values for specific option variables.
checksum_type=md5
# Interpret specific options, they begin after the first --.
next_is=ignore
for i in "$@"
do
if test "$next_is" = "ignore"
then
if test "$i" = "--"
then
next_is=""
fi
elif test "$i" = "--md5"
then
checksum_type=md5
elif test "$i" = "--sha256"
then
checksum_type=sha256
else
echo >&2
echo "Unknown test specific option: $i" >&2
print_help
print_specific_help
exit 31
fi
done
if [ ! -x $RELENG_XORRISO ]; then if [ ! -x $RELENG_XORRISO ]; then
print_help print_help
printf "\n${SELF}: -x absolute or relative path to binary to be run.\n\n" printf "\n${SELF}: -x absolute or relative path to binary to be run.\n\n"
@ -87,7 +115,10 @@ case ${RETCODE_VER_JTE} in
esac esac
# grab remote ISO image, to decompose # grab remote ISO image, to decompose
if [ ! -f "${TMP_DATA_DIR}"/"${REMOTE_IMG}" ]; then if [ -L "${TMP_DATA_DIR}"/"${REMOTE_IMG}" ]; then
printf "\n${SELF}: Found symbolic link ${TMP_DATA_DIR}"/"${REMOTE_IMG}\n"
ls -ld ${TMP_DATA_DIR}"/"${REMOTE_IMG}
elif [ ! -f "${TMP_DATA_DIR}"/"${REMOTE_IMG}" ]; then
printf "\n${SELF}: Downloading ${REMOTE_URL}/${REMOTE_IMG}\n" printf "\n${SELF}: Downloading ${REMOTE_URL}/${REMOTE_IMG}\n"
if wget -V >/dev/null 2>&1 if wget -V >/dev/null 2>&1
then then
@ -206,9 +237,9 @@ JIGDO_MAP="Debian=${JIGDO_MAP_RHV}/"
# create jigdo MD5 list in base64 format # create jigdo MD5 list in base64 format
JIGDO_GEN_MD5=${GEN_DATA_DIR}/${RELENG_IMG}.md5 JIGDO_GEN_MD5=${GEN_DATA_DIR}/${RELENG_IMG}.md5
printf "${SELF}: Creating MD5 list in hex format in ${JIGDO_GEN_MD5}..." printf "${SELF}: Creating $checksum_type list in hex format in ${JIGDO_GEN_MD5}..."
set +e set +e
./jigdo-gen-md5-list ${RELENG_DIR} > ${JIGDO_GEN_MD5} ./jigdo-gen-md5-list "--""$checksum_type" ${RELENG_DIR} > ${JIGDO_GEN_MD5}
ret=$? ret=$?
set -e set -e
@ -224,12 +255,13 @@ fi
CMD="$CMD \ CMD="$CMD \
-jigdo-template-compress gzip \ -jigdo-template-compress gzip \
-jigdo-checksum-algorithm "$checksum_type" \
-checksum_algorithm_iso md5,sha1,sha256,sha512 \ -checksum_algorithm_iso md5,sha1,sha256,sha512 \
-checksum_algorithm_template md5,sha1,sha256,sha512 \ -checksum_algorithm_template md5,sha1,sha256,sha512 \
-jigdo-jigdo ${JIGDO_JIGDO} \ -jigdo-jigdo ${JIGDO_JIGDO} \
-jigdo-template ${JIGDO_TEMPLATE} \ -jigdo-template ${JIGDO_TEMPLATE} \
-jigdo-map ${JIGDO_MAP} \ -jigdo-map ${JIGDO_MAP} \
-md5-list ${JIGDO_GEN_MD5} \ -checksum-list ${JIGDO_GEN_MD5} \
-jigdo-min-file-size 1024 \ -jigdo-min-file-size 1024 \
" "

View File

@ -1 +1 @@
#define Xorriso_timestamP "2019.11.26.192814" #define Xorriso_timestamP "2019.11.26.193722"