signature-params: Optionally pass a specific salt value when signing
[strongswan.git] / src / sec-updater / sec-updater.sh
1 #!/bin/sh
2
3 DIR="/etc/pts"
4 DISTS_DIR="$DIR/dists"
5 DATE=`date +%Y%m%d-%H%M`
6 UBUNTU="http://security.ubuntu.com/ubuntu"
7 UBUNTU_VERSIONS="xenial"
8 UBUNTU_DIRS="main multiverse restricted universe"
9 UBUNTU_ARCH="binary-amd64"
10 DEBIAN="http://security.debian.org"
11 DEBIAN_VERSIONS="jessie wheezy"
12 DEBIAN_DIRS="main contrib non-free"
13 DEBIAN_ARCH="binary-amd64 binary-armhf"
14 RASPIAN="http://archive.raspberrypi.org/debian"
15 RASPIAN_VERSIONS="jessie wheezy"
16 RASPIAN_DIRS="main"
17 RASPIAN_ARCH="binary-armhf"
18 CMD=/usr/sbin/sec-updater
19 CMD_LOG="$DIR/logs/$DATE-sec-update.log"
20 DEL_LOG=1
21
22 mkdir -p $DIR/dists
23 cd $DIR/dists
24
25 # Download Ubuntu distribution information
26
27 for v in $UBUNTU_VERSIONS
28 do
29 for a in $UBUNTU_ARCH
30 do
31 mkdir -p $v-security/$a $v-updates/$a
32 for d in $UBUNTU_DIRS
33 do
34 wget -nv $UBUNTU/dists/$v-security/$d/$a/Packages.xz -O $v-security/$a/Packages-$d.xz
35 unxz -f $v-security/$a/Packages-$d.xz
36 wget -nv $UBUNTU/dists/$v-updates/$d/$a/Packages.xz -O $v-updates/$a/Packages-$d.xz
37 unxz -f $v-updates/$a/Packages-$d.xz
38 done
39 done
40 done
41
42 # Download Debian distribution information
43
44 for v in $DEBIAN_VERSIONS
45 do
46 for a in $DEBIAN_ARCH
47 do
48 mkdir -p $v-updates/$a
49 for d in $DEBIAN_DIRS
50 do
51 wget -nv $DEBIAN/dists/$v/updates/$d/$a/Packages.bz2 -O $v-updates/$a/Packages-$d.bz2
52 bunzip2 -f $v-updates/$a/Packages-$d.bz2
53 done
54 done
55 done
56
57 # Download Raspian distribution information
58
59 for v in $RASPIAN_VERSIONS
60 do
61 for a in $RASPIAN_ARCH
62 do
63 mkdir -p $v-raspian/$a
64 for d in $RASPIAN_DIRS
65 do
66 wget -nv $RASPIAN/dists/$v/$d/$a/Packages.gz -O $v-raspian/$a/Packages-$d.gz
67 gunzip -f $v-raspian/$a/Packages-$d.gz
68 done
69 done
70 done
71
72 # Run sec-updater in distribution information
73
74 for f in xenial-security/binary-amd64/*
75 do
76 echo "security: $f"
77 $CMD --os "Ubuntu 16.04" --arch "x86_64" --file $f --security \
78 --uri $UBUNTU >> $CMD_LOG 2>&1
79 if [ $? -eq 0 ]
80 then
81 DEL_LOG=0
82 fi
83 done
84
85 for f in xenial-updates/binary-amd64/*
86 do
87 echo "updates: $f"
88 $CMD --os "Ubuntu 16.04" --arch "x86_64" --file $f \
89 --uri $UBUNTU >> $CMD_LOG 2>&1
90 if [ $? -eq 0 ]
91 then
92 DEL_LOG=0
93 fi
94 done
95
96 for f in jessie-updates/binary-amd64/*
97 do
98 echo "security: $f"
99 $CMD --os "Debian 8.0" --arch "x86_64" --file $f --security \
100 --uri $DEBIAN >> $CMD_LOG 2>&1
101 if [ $? -eq 0 ]
102 then
103 DEL_LOG=0
104 fi
105 done
106
107 for f in wheezy-updates/binary-amd64/*
108 do
109 echo "security: $f"
110 $CMD --os "Debian 7.0" --arch "x86_64" --file $f --security \
111 --uri $DEBIAN >> $CMD_LOG 2>&1
112 if [ $? -eq 0 ]
113 then
114 DEL_LOG=0
115 fi
116 done
117
118 for f in jessie-updates/binary-armhf/*
119 do
120 echo "security: $f"
121 $CMD --os "Debian 8.0" --arch "armhf" --file $f --security \
122 --uri $DEBIAN >> $CMD_LOG 2>&1
123 if [ $? -eq 0 ]
124 then
125 DEL_LOG=0
126 fi
127 done
128
129 for f in wheezy-updates/binary-armhf/*
130 do
131 echo "security: $f"
132 $CMD --os "Debian 7.0" --arch "armhf" --file $f --security \
133 --uri $DEBIAN >> $CMD_LOG 2>&1
134 if [ $? -eq 0 ]
135 then
136 DEL_LOG=0
137 fi
138 done
139
140 for f in jessie-raspian/binary-armhf/*
141 do
142 echo "security: $f"
143 $CMD --os "Debian 8.0" --arch "armv7l" --file $f --security \
144 --uri $RASPIAN >> $CMD_LOG 2>&1
145 if [ $? -eq 0 ]
146 then
147 DEL_LOG=0
148 fi
149 done
150
151 for f in wheezy-raspian/binary-armhf/*
152 do
153 echo "security: $f"
154 $CMD --os "Debian 7.11" --arch "armv7l" --file $f --security \
155 --uri $RASPIAN >> $CMD_LOG 2>&1
156 if [ $? -eq 0 ]
157 then
158 DEL_LOG=0
159 fi
160 done
161
162 # Delete log file if no security updates were found
163
164 if [ $DEL_LOG -eq 1 ]
165 then
166 rm $CMD_LOG
167 echo "no security updates found"
168 fi