This file is indexed.

/usr/bin/jigdo-gen-md5-list is in jigit 1.20-1.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/bin/sh

# Copyright (c) 2010, 2011 George Danchev <danchev@spnet.net>
# Copyright (c) 2010, 2011 Thomas Schmitt <scdbackup@gmx.net>
# Copyright (c) 2010, 2011 Steve McIntyre <steve@einval.com>
# 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 hexidecimal format and print to standard output

# 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
# [0-9afAF]
#
# Next come two blanks.
#
# The byte size of the file content must be encoded in 12 decimal digits
# or blanks.
#
# Next come two blanks.
#
# The rest of the line up to the newline character is a semi-literal file
# address. Its basename has to be the same as the basename of the data file
# when it is used as one of the input files for the jigdo file generator.

# The semi-literal address and the address mapping define what will be
# listed as file address in the jigdo file.
# The address may bear at its start a literal text that shall be recognized by
# 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:
# When the jigdo file gets generated, and when the jigdo file gets read
# to inflate the template file into the original payload image.
# The address mappings at both occasions can be used to adapt to a change
# of the absolute location of the listed files.
# Between both mappings, the parent directory is represented by a symbolic
# 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
# 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.1

OPT_ABSOLUTE=1

usage() {
    cat << USAGE
usage: $SELF [option] DIR FILE ...
 -a, --make-absolute    make absolute paths, avoiding any symlinks (default)
 -l, --keep-literal     leave paths untouched, literally as supplied
 -v, --version          print version
 -h, --help             print help
 -e, --examples         print examples
USAGE
}

examples() {
    cat << EXAMPLES
examples:
 $SELF datadir datafile
 $SELF --keep-literal datadir datafile
 find . -type f | xargs $SELF
 find . -exec $SELF '{}' ';'
EXAMPLES
}

SYSTEM=`uname -s`
case $SYSTEM in
    Linux|GNU/kFreeBSD)
        MD5_LIST=md5list_gnu;;
    FreeBSD)
        MD5_LIST=md5list_freebsd;;
    *)
        echo "System type $SYSTEM unsupported"
        echo "Abort."
        exit 1;;
esac

md5list_gnu() {
    item="$1"
    if [ $OPT_ABSOLUTE -eq 1 ] ; then
        dn=`dirname "$item"`  # dirname
        fn=`basename "$item"` # filename
        od=`pwd -P`           # old dir
        cd "$dn" || exit 1
        item=`pwd -P`/"$fn"   # absolute physical file path, avoiding all symlinks
        cd "$od" || exit 1
    fi
    MD5=`md5sum "$item" | awk '{print $1}'`
    SIZ=`/usr/bin/stat -c %s "$item"`
    printf '%32s  %12s  %s\n' "$MD5" "$SIZ" "$item"
}

md5list_freebsd() {
    item="$1"
    if [ $OPT_ABSOLUTE -eq 1 ] ; then
        dn=`dirname "$item"`  # dirname
        fn=`basename "$item"` # filename
        od=`pwd -P`           # old dir
        cd "$dn" || exit 1
        item=`pwd -P`/"$fn"   # absolute physical file path, avoiding all symlinks
        cd "$od" || exit 1
    fi
    MD5=`md5 -q "$item"`
    SIZ=`/usr/bin/stat -f %z "$item"`
    printf '%32s  %12s  %s\n' "$MD5" "$SIZ" "$item"
}

walkdir() {
    DR="$1"
    for item in `find "$DR" -type f` ; do
        $MD5_LIST "$item"
    done
}


# main()
if [ "$1" = "" ] ; then
    usage
    exit 1
fi

case "$1" in
    --make-absolute|-a)
        OPT_ABSOLUTE=1;
        shift;
        ;;
    --keep-literal|-l)
        OPT_ABSOLUTE=0;
        shift;
        ;;
    --version|-v)
        printf '%s %s\n' "$SELF" "$VER"
        exit 0
        ;;
    --help|-h)
        usage
        exit 0
        ;;
    --examples|-e)
        examples
        exit 0
#   *)
#       usage
#       exit 1
#       ;;
esac

for i in "$@" ; do
    if [ -d "$i" ] ; then
        DR="$i"
        if [ $OPT_ABSOLUTE -eq 1 ] ; then
            od=`pwd -P`           # old dir
            cd "$DR" || exit 1
            DR=`pwd -P`           # absolute physical dir path, avoiding all symlinks
            cd "$od" || exit 1
        fi
        walkdir "$DR"
    elif [ -f "$i" ] ; then
        FL="$i"
        $MD5_LIST "$FL"
    else
        usage
        exit 1
    fi;

done

exit 0