File: populate

package info (click to toggle)
apache 1.3.34-4.1%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 4,824 kB
  • ctags: 90
  • sloc: sh: 1,273; makefile: 686; perl: 215
file content (64 lines) | stat: -rw-r--r-- 1,537 bytes parent folder | download | duplicates (3)
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
#!/bin/bash

set -e

# $1 APACHEMAJOR
# $2 PERLMAJOR
# $3 DEBREVISION
# $4 APACHEMINOR

apachemajor=$1
perlmajor=$2
debrevision=$3
apacheminor=$4

# we already have ubersed ;)

leetsed() {
 sed \
 -e 's/@FLAVOUR@/'$x'/g' \
 -e 's/@INCLUDE@//g' \
 -e 's/@APACHEMAJOR@/'$apachemajor'/g' \
 -e 's/@APACHEMINOR@/'$apacheminor'/g' \
 -e 's/@PERLMAJOR@/'$perlmajor'/g' \
 -e 's/@DEBREVISION@/'$debrevision'/g'
}

cd debian/pkgtemplates

dest=../

# it doesn't perform sanity checks so be carefull in writing templates!
# and remember that it is not recursive.. so no keywords inside includes

for i in `ls flavours.*`; do
 target=`echo $i | sed -e 's/^flavours\.//g'`
 for x in apache apache-perl apache-ssl; do
  echo -n "Generating $x.$target... "
  if [ -e $x.$target.pre ]; then cat $x.$target.pre >> $dest/$x.$target; fi
  if [ -e $x.$target.inc ]; then
   middle=`grep -n @INCLUDE@ $i | cut -d ":" -f 1`
   last=`wc -l < $i`
   diff=`expr $last - $middle`
   head -n $middle $i | leetsed >> $dest/$x.$target
   cat $x.$target.inc >> $dest/$x.$target
   tail -n $diff $i | leetsed >> $dest/$x.$target
  else
   cat $i | leetsed >> $dest/$x.$target
  fi
  if [ -e $x.$target.post ]; then cat $x.$target.post >> $dest/$x.$target; fi
  if [ -e $x.$target.diff ]; then patch -d $dest -p 0 < $x.$target.diff; fi
  echo done
 done
done

# handling special cases (.sin = .special input)

for i in `ls *.sin`; do
 target=`echo $i | sed -e 's/\.sin$//g'`
 echo -n "Generating $target... "
 cat $i | leetsed > $dest/$target
 echo done
done

exit 0