Added options --md5 and --sha256 to Jigdo releng test
This commit is contained in:
parent
9028117c01
commit
ea863307a4
|
@ -5,7 +5,8 @@ libisoburn/releng. By George Danchev <danchev@spnet.net>
|
|||
and Thomas Schmitt <scdbackup@gmx.net>
|
||||
|
||||
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.
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
|
@ -120,17 +121,18 @@ the user or require sysadmin considerations before they are run:
|
|||
as one single argument. On Solaris use:
|
||||
--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
|
||||
files. This test downloads a Debian daily image for i386 of about 270 MB,
|
||||
extracts its content and composes a new image. Thus it needs about 850 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 1100 MB
|
||||
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
|
||||
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/
|
||||
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.
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
#!/bin/sh
|
||||
|
||||
# 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 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
|
||||
# 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]
|
||||
#
|
||||
# Next come two blanks.
|
||||
|
@ -37,35 +39,61 @@
|
|||
# text, like "Debian:".
|
||||
|
||||
# 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
|
||||
# are neither resolved nor can they confuse the mapping.
|
||||
|
||||
set -e
|
||||
|
||||
SELF=jigdo-gen-md5-list
|
||||
VER=0.2
|
||||
VER=0.3
|
||||
|
||||
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".
|
||||
# Furthermore, the FreeBSD shell reports missing commands to inherited stderr,
|
||||
# regardless that the attempt itself has redirected stderr. Thus a sub shell
|
||||
# is needed to hide the protest.
|
||||
if ( md5sum --help ) >/dev/null 2>&1
|
||||
then
|
||||
md5_cmd=md5sum
|
||||
elif ( md5 -s test ) >/dev/null 2>&1
|
||||
then
|
||||
md5_cmd=md5
|
||||
else
|
||||
echo "$0 : Programs md5sum and md5 failed to work" >&2
|
||||
exit 2
|
||||
fi
|
||||
choose_checksum_cmd() {
|
||||
if test "$checksum_type" = "md5"
|
||||
then
|
||||
if ( md5sum --help ) >/dev/null 2>&1
|
||||
then
|
||||
md5_cmd=md5sum
|
||||
elif ( md5 -s test ) >/dev/null 2>&1
|
||||
then
|
||||
md5_cmd=md5
|
||||
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() {
|
||||
cat << USAGE
|
||||
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)
|
||||
-l, --keep-literal leave paths untouched, literally as supplied
|
||||
-v, --version print version
|
||||
|
@ -100,12 +128,18 @@ md5list() {
|
|||
elif test "$md5_cmd" = "md5"
|
||||
then
|
||||
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
|
||||
echo "$0 : No MD5 program found" >&2
|
||||
echo "$0 : Internal error : Checksum mode unknown : $md5_cmd" >&2
|
||||
exit 2
|
||||
fi
|
||||
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() {
|
||||
|
@ -123,7 +157,17 @@ if test "$1" = "" ; then
|
|||
exit 1
|
||||
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)
|
||||
OPT_ABSOLUTE=1;
|
||||
shift;
|
||||
|
@ -147,12 +191,15 @@ case "$1" in
|
|||
# usage
|
||||
# exit 1
|
||||
# ;;
|
||||
esac
|
||||
esac
|
||||
done
|
||||
choose_checksum_cmd
|
||||
|
||||
for i in "$@"
|
||||
do
|
||||
|
||||
if test -d "$i" ; then
|
||||
if echo "$i" | grep '^-' >/dev/null ; then
|
||||
dummy=dummy
|
||||
elif test -d "$i" ; then
|
||||
DR="$i"
|
||||
if test $OPT_ABSOLUTE -eq 1; then
|
||||
od=`pwd -P` # old dir
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Copyright 2011 Thomas Schmitt <scdbackup@gmx.net>
|
||||
# Copyright 2011, 2019 Thomas Schmitt <scdbackup@gmx.net>
|
||||
# Copyright 2011 George Danchev <danchev@spnet.net>
|
||||
# Licensed under GNU GPL version 2 or later
|
||||
|
||||
|
@ -16,7 +16,8 @@ not_in_releng_exit() {
|
|||
print_specific_help() {
|
||||
cat << HLP
|
||||
Specific options:
|
||||
none yet.
|
||||
--md5 use MD5 checksums (default)
|
||||
--sha256 use SHA256 checksums
|
||||
Overview:
|
||||
Match the resulting ISO image representation
|
||||
against the jigdo representation.
|
||||
|
@ -28,6 +29,33 @@ if test "$SPECIFIC_HELP" = 1; then
|
|||
exit 0
|
||||
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
|
||||
print_help
|
||||
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
|
||||
|
||||
# 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"
|
||||
if wget -V >/dev/null 2>&1
|
||||
then
|
||||
|
@ -206,9 +237,9 @@ JIGDO_MAP="Debian=${JIGDO_MAP_RHV}/"
|
|||
# create jigdo MD5 list in base64 format
|
||||
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
|
||||
./jigdo-gen-md5-list ${RELENG_DIR} > ${JIGDO_GEN_MD5}
|
||||
./jigdo-gen-md5-list "--""$checksum_type" ${RELENG_DIR} > ${JIGDO_GEN_MD5}
|
||||
ret=$?
|
||||
set -e
|
||||
|
||||
|
@ -224,12 +255,13 @@ fi
|
|||
|
||||
CMD="$CMD \
|
||||
-jigdo-template-compress gzip \
|
||||
-jigdo-checksum-algorithm "$checksum_type" \
|
||||
-checksum_algorithm_iso md5,sha1,sha256,sha512 \
|
||||
-checksum_algorithm_template md5,sha1,sha256,sha512 \
|
||||
-jigdo-jigdo ${JIGDO_JIGDO} \
|
||||
-jigdo-template ${JIGDO_TEMPLATE} \
|
||||
-jigdo-map ${JIGDO_MAP} \
|
||||
-md5-list ${JIGDO_GEN_MD5} \
|
||||
-checksum-list ${JIGDO_GEN_MD5} \
|
||||
-jigdo-min-file-size 1024 \
|
||||
"
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
#define Xorriso_timestamP "2019.11.26.192814"
|
||||
#define Xorriso_timestamP "2019.11.26.193722"
|
||||
|
|
Caricamento…
Fai riferimento in un nuovo problema