Rev | Line | |
---|
[1127] | 1 | #!/bin/bash
|
---|
| 2 |
|
---|
[1131] | 3 | # A simple script that adds the source file list to a dsc file.
|
---|
[1127] | 4 | #
|
---|
| 5 | # (C) 2012 by <joerg.steffens@dass-it.de>
|
---|
[1130] | 6 | #
|
---|
[1127] | 7 | # This program is free software; you can redistribute it and/or
|
---|
| 8 | # modify it under the terms of the GNU General Public License
|
---|
| 9 | # as published by the Free Software Foundation; either version 2
|
---|
| 10 | # of the License, or (at your option) any later version.
|
---|
| 11 | # See http://www.gnu.org/licenses/gpl-2.0.html for full license text.
|
---|
| 12 |
|
---|
| 13 |
|
---|
| 14 | # defaults
|
---|
| 15 | MYVERSION=""
|
---|
| 16 | FILES=""
|
---|
| 17 |
|
---|
| 18 | while test $# -gt 0; do
|
---|
| 19 | case $1 in
|
---|
| 20 | *-file)
|
---|
| 21 | FILES="$FILES $2"
|
---|
| 22 | shift
|
---|
| 23 | ;;
|
---|
| 24 | *-outdir)
|
---|
| 25 | MYOUTDIR="$2"
|
---|
| 26 | shift
|
---|
| 27 | ;;
|
---|
| 28 | *)
|
---|
| 29 | echo Unknown parameter $1.
|
---|
[1131] | 30 | echo 'Usage: dsc_filelist --file $FILE --outdir $OUT'
|
---|
[1127] | 31 | exit 1
|
---|
| 32 | ;;
|
---|
| 33 | esac
|
---|
| 34 | shift
|
---|
| 35 | done
|
---|
| 36 |
|
---|
| 37 | if [ -z "$FILES" ]; then
|
---|
| 38 | echo "ERROR: no inputs files are given via --file parameter!"
|
---|
| 39 | exit 1
|
---|
| 40 | fi
|
---|
| 41 |
|
---|
| 42 | filesize()
|
---|
| 43 | {
|
---|
[1131] | 44 | stat --format='%s' $*
|
---|
[1127] | 45 | }
|
---|
| 46 |
|
---|
| 47 | md5()
|
---|
| 48 | {
|
---|
[1131] | 49 | md5sum $* | cut -f 1 -d ' '
|
---|
[1127] | 50 | }
|
---|
| 51 |
|
---|
| 52 | export LANG=C
|
---|
| 53 |
|
---|
| 54 | FILES_DSC="*.dsc"
|
---|
| 55 |
|
---|
| 56 | # update the file list in the description file
|
---|
| 57 | for FILE_DSC in $FILES_DSC; do
|
---|
[1129] | 58 | [ -e $FILE_DSC ] || continue
|
---|
[1127] | 59 | printf "$0: modifing file $FILE_DSC, adding "
|
---|
[1129] | 60 | grep -q "^Files:" $FILE_DSC || echo "Files: " >> $FILE_DSC
|
---|
| 61 | for filename in $FILES; do
|
---|
| 62 | path=`ls -1 "$filename 2>/dev/null" || eval ls -1 "_service:*:$filename 2>/dev/null"`
|
---|
| 63 | [ -e $path ] || continue
|
---|
| 64 | printf "${path##*:} (${path})"
|
---|
| 65 | printf ' %s %s %s\n' `md5 $path` `filesize $path` ${path##*:} >> $FILE_DSC
|
---|
| 66 | done
|
---|
[1127] | 67 | printf "\n"
|
---|
| 68 | done
|
---|
| 69 |
|
---|
| 70 | exit 0
|
---|
Note:
See
TracBrowser
for help on using the repository browser.