summaryrefslogtreecommitdiffstats
path: root/prepare_mirror.sh
blob: 0e07ef9f5328c68947f65cf927ec3c8ed6fe3c24 (plain)
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
#!/bin/sh

if [ "$1" != "" ]; then
  VAR_WWW=$1
else
  VAR_WWW=/var/www/tcos
fi

mkdir -p $VAR_WWW/conf
mkdir -p $VAR_WWW/incoming

cat << EOF > $VAR_WWW/conf/distributions
Origin: TCOS
Label: TCOS debian packages
Suite: stable
Codename: stable
Version: 3.1
Architectures: i386 all source
Components: main
Description: TCOS debian stable packages
DscIndices: Sources Release . .gz bzip2.sh
DebIndices: Packages Release . .gz bzip2.sh
UDebIndices: Packages . .gz bzip2.sh


Origin: TCOS
Label: TCOS debian packages
Suite: unstable
Codename: unstable
Architectures: i386 all source
Components: main
Description: TCOS debian unstable packages
DscIndices: Sources Release . .gz bzip2.sh
DebIndices: Packages Release . .gz bzip2.sh
UDebIndices: Packages . .gz bzip2.sh

EOF

cat << EOF > $VAR_WWW/conf/bzip2.sh
#!/bin/sh
# since reprepro 0.8 this is no longer needed, as it can
# create .bz2 files on its own (when compiled with libbz2-dev
# present). It's still here for reference how to such a filter works.

# Copy this script to your conf/ dir as bzip2.sh, make it executable
# and add to some definition in conf/distributions
# DscIndices: Sources Release . .gz bzip2.sh
# DebIndices: Packages Release . .gz bzip2.sh
# UDebIndices: Packages . .gz bzip2.sh
# and you have .bz2'd Packages and Sources.
# (alternatively, if you are very brave, put the full path to this file in there)

DIROFDIST="\$1"
NEWNAME="\$2"
OLDNAME="\$3"
# this can be old(\$3 exists), new(\$2 exists) or change (both):
STATUS="\$4"
BASENAME="`basename "\$OLDNAME"`"

# with reprepro <= 0.7 this could also be Packages.gz or Sources.gz,
# but now only the uncompressed name is given. (even if not generated)
if [ "xPackages" = "x\$BASENAME" ] || [ "xSources" = "x\$BASENAME" ] ; then
        if [ "x\$STATUS" == "xold" ] ; then
                if [ -f "\$DIROFDIST/\$OLDNAME.bz2" ] ; then
                        echo "\$OLDNAME.bz2" >&3
                else
                        bzip2 -c -- "\$DIROFDIST/\$OLDNAME" >"\$DIROFDIST/\$OLDNAME.bz2.new" 3>/dev/null
                        echo "\$OLDNAME.bz2.new" >&3
                fi
        else
                bzip2 -c -- "\$DIROFDIST/\$NEWNAME" >"\$DIROFDIST/\$OLDNAME.bz2.new" 3>/dev/null
                echo "\$OLDNAME.bz2.new" >&3
        fi
fi

EOF

chmod +x $VAR_WWW/conf/bzip2.sh