source: obs/obs-service-dsc_filelist/usr/lib/obs/service/dsc_filelist@ 1131

Last change on this file since 1131 was 1131, checked in by joergs, on Jan 3, 2013 at 12:29:25 PM

cleanup

  • Property svn:executable set to *
File size: 1.5 KB
Line 
1#!/bin/bash
2
3# A simple script that adds the source file list to a dsc file.
4#
5# (C) 2012 by <joerg.steffens@dass-it.de>
6#
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
15MYVERSION=""
16FILES=""
17
18while 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.
30 echo 'Usage: dsc_filelist --file $FILE --outdir $OUT'
31 exit 1
32 ;;
33 esac
34 shift
35done
36
37if [ -z "$FILES" ]; then
38 echo "ERROR: no inputs files are given via --file parameter!"
39 exit 1
40fi
41
42filesize()
43{
44 stat --format='%s' $*
45}
46
47md5()
48{
49 md5sum $* | cut -f 1 -d ' '
50}
51
52export LANG=C
53
54FILES_DSC="*.dsc"
55
56# update the file list in the description file
57for FILE_DSC in $FILES_DSC; do
58 [ -e $FILE_DSC ] || continue
59 printf "$0: modifing file $FILE_DSC, adding "
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
67 printf "\n"
68done
69
70exit 0
Note: See TracBrowser for help on using the repository browser.