"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "releng/jigdo-gen-md5-list" between
xorriso-1.5.2.tar.gz and xorriso-1.5.4.tar.gz

About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.

jigdo-gen-md5-list  (xorriso-1.5.2):jigdo-gen-md5-list  (xorriso-1.5.4)
#!/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 hexidecimal format and print to standard o # Create a list of checksums encoded in hexadecimal format and print to
utput # 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.
# #
# The byte size of the file content must be encoded in 12 decimal digits # The byte size of the file content must be encoded in 12 decimal digits
# or blanks. # or blanks.
# #
# Next come two blanks. # Next come two blanks.
# #
# The rest of the line up to the newline character is a semi-literal file # The rest of the line up to the newline character is a semi-literal file
skipping to change at line 40 skipping to change at line 42
# the address mapping (e.g. -jigdo-map) of the jigdo file generator. # the address mapping (e.g. -jigdo-map) of the jigdo file generator.
# The rest of the address must be usable as file address in both situations: # The rest of the address must be usable as file address in both situations:
# When the jigdo file gets generated, and when the jigdo file gets read # When the jigdo file gets generated, and when the jigdo file gets read
# to inflate the template file into the original payload image. # to inflate the template file into the original payload image.
# The address mappings at both occasions can be used to adapt to a change # The address mappings at both occasions can be used to adapt to a change
# of the absolute location of the listed files. # of the absolute location of the listed files.
# Between both mappings, the parent directory is represented by a symbolic # Between both mappings, the parent directory is represented by a symbolic
# 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
-h, --help print help -h, --help print help
-e, --examples print examples -e, --examples print examples
USAGE USAGE
} }
examples() { examples() {
cat << EXAMPLES cat << EXAMPLES
skipping to change at line 103 skipping to change at line 130
cd "$dn" || exit 1 cd "$dn" || exit 1
item=`pwd -P`/"$fn" # absolute physical file path, avoiding all symlinks item=`pwd -P`/"$fn" # absolute physical file path, avoiding all symlinks
cd "$od" || exit 1 cd "$od" || exit 1
fi fi
if test "$md5_cmd" = "md5sum" if test "$md5_cmd" = "md5sum"
then then
MD5=`md5sum "$item" | awk '{print $1}'` MD5=`md5sum "$item" | awk '{print $1}'`
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() {
DR="$1" DR="$1"
for item in `find "$DR" -type f` for item in `find "$DR" -type f`
do do
md5list "$item" md5list "$item"
done done
} }
# main() # main()
if test "$1" = "" ; then if test "$1" = "" ; then
usage usage
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;
;; ;;
--keep-literal|-l) --keep-literal|-l)
OPT_ABSOLUTE=0; OPT_ABSOLUTE=0;
shift; shift;
;; ;;
--version|-v) --version|-v)
printf '%s %s\n' "$SELF" "$VER" printf '%s %s\n' "$SELF" "$VER"
skipping to change at line 149 skipping to change at line 192
usage usage
exit 0 exit 0
;; ;;
--examples|-e) --examples|-e)
examples examples
exit 0 exit 0
# *) # *)
# 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
cd "$DR" || exit 1 cd "$DR" || exit 1
DR=`pwd -P` # absolute physical dir path, avoid ing all symlinks DR=`pwd -P` # absolute physical dir path, avoid ing all symlinks
cd "$od" || exit 1 cd "$od" || exit 1
fi fi
walkdir "$DR" walkdir "$DR"
elif test -f "$i" ; then elif test -f "$i" ; then
FL="$i" FL="$i"
 End of changes. 14 change blocks. 
22 lines changed or deleted 68 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)