blob: a5ed84ce3c28495c36a97efa38c26dc0336b3b3c (
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
#!/bin/sh
# $NetBSD: upload,v 1.21 2005/01/24 15:00:48 jschauma Exp $
#
# Upload non-restricted binary pkgs to ftp server
#
MD5="digest md5";
SHA1="digest sha1";
opsys=`uname -s`
case "$opsys" in
NetBSD) BMAKE=make;
BSDSUM="sum -o 1";
CKSUM="cksum";
SYSVSUM="sum -o 2";
;;
IRIX*) BMAKE=bmake;
# BSDSUM="sum -r";
# CKSUM="cksum";
# SYSVSUM="sum";
;;
*) BMAKE=bmake ;;
esac
export BMAKE
# Bring in variables for bulk-install
BATCH=1
DEPENDS_TARGET=bulk-install
export BATCH DEPENDS_TARGET
# Pull in RSYNC_DST, RSYNC_OPTS:
if [ -f "$BULK_BUILD_CONF" ]; then
. $BULK_BUILD_CONF
else
. `dirname $0`/build.conf
fi
cd $USR_PKGSRC
if [ "$RSYNC_DST_SPECIFIC" != "" -o "$RSYNC_DST_OTHER" != "" ]; then
echo Use of RSYNC_DST_SPECIFIC and RSYNC_DST_OTHER is deprecated.
echo Please just set RSYNC_DST in build.conf.
exit 1
fi
if [ -z "$RSYNC_DST" ]; then
echo "You must set the variable RSYNC_DST, see build.conf-example."
exit 1
fi
# Paths for both OS-version-specific and general pkgs:
RSYNC_DST_SPECIFIC=${RSYNC_DST}
RSYNC_DST_OTHER=${RSYNC_DST}
#
# Some temp files
#
umask 22
TMPDIR=${TMPDIR:-/tmp}
TMP=${TMPDIR}/pkg_upload.$$
mkdir $TMP
exf=$TMP/exclude
osf=$TMP/osversion_specific
upload=$TMP/upload
upload_specific=$TMP/upload_specific
upload_others=$TMP/upload_others
# May be different than $USR_PKGSRC:
pkgsrcdir=`cd pkgtools/pkglint ; ${BMAKE} show-var VARNAME=_PKGSRCDIR`
packages=`cd pkgtools/pkglint ; ${BMAKE} show-var VARNAME=PACKAGES`
distdir=`cd pkgtools/pkglint ; ${BMAKE} show-var VARNAME=DISTDIR`
# Pull in some pkgs needed
( cd pkgtools/pkglint ; ${BMAKE} bulk-install )
( cd net/rsync ; ${BMAKE} bulk-install )
( cd security/audit-packages ; ${BMAKE} bulk-install )
echo "Making sure vulnerability-list is upto date:"
if [ -z "$UPDATE_VULNERABILITY_LIST" -o "$UPDATE_VULNERABILITY_LIST" = "yes" ]
then
env PKGVULNDIR=${distdir} download-vulnerability-list
else
echo '(skipped)'
fi
case $LINTPKGSRC_CACHE in
yes|YES)
lintpkgsrc_cache="-I `cd pkgtools/pkglint ; ${BMAKE} show-var VARNAME=LINTPKGSRC_DB`"
;;
*)
lintpkgsrc_cache=''
;;
esac
echo "Checking for restricted, out of date, and vulnerable packages:"
# -p = report old versions of packages
# -R = report restricted packages
# -V = report vulnerable packages
lintpkgsrc $lintpkgsrc_cache -K $packages -P $pkgsrcdir -pRV | sed 's@'$packages'/@@' > $exf
echo "Checking for OSVERSION_SPECIFIC pkgs:"
lintpkgsrc $lintpkgsrc_cache -K $packages -P $pkgsrcdir -O | sed 's@'$packages'/@@' > $osf
RSFLAGS="-vap --progress $RSYNC_OPTS"
failed=no
cd $packages
if [ "${MKSUMS}" = "yes" -o "${MKSUMS}" = "YES" ]; then
SUMFILES="BSDSUM CKSUM MD5 SHA1 SYSVSUM"
rm -f ${SUMFILES}
if [ x"${SIGN_AS}" != x"" ]; then
( cd ${pkgsrcdir}/security/gnupg; ${BMAKE} bulk-install )
for i in ${SUMFILES}; do
echo > $i
echo "This file is signed with ${SIGN_AS}'s PGP key." >> $i
echo >> $i
done
fi
( cd ${pkgsrcdir}/pkgtools/digest; ${BMAKE} bulk-install )
[ -z "${BSDSUM}" ] && BSDSUM="echo"
[ -z "${CKSUM}" ] && CKSUM="echo"
[ -z "${SYSVSUM}" ] && SYSVSUM="echo"
for i in All/*; do
if ! grep -q $i $exf; then
${BSDSUM} $i >> BSDSUM
${CKSUM} $i >> CKSUM
${MD5} $i >> MD5
${SHA1} $i >> SHA1
${SYSVSUM} $i >> SYSVSUM
fi
done
[ "${BSDSUM}" = "echo" ] && rm BSDSUM
[ "${CKSUM}" = "echo" ] && rm CKSUM
[ "${SYSVSUM}" = "echo" ] && rm SYSVSUM
if [ x"${SIGN_AS}" != x"" ]; then
for i in ${SUMFILES}; do
if [ -s $i ]; then
echo "Signing $i"
gpg --clearsign $i && rm $i
echo ${i}.asc >> $osf
fi
done
fi
fi
echo "#!/bin/sh" > $upload
echo "packages=$packages" >> $upload
echo "if ! cd $packages ; then" >> $upload
echo " echo \"could not cd to $packages\"" >> $upload
echo " exit 1" >> $upload
echo "fi" >> $upload
echo "Uploading OSVERSION_SPECIFIC pkgs"
cmd="rsync $RSFLAGS --include '*/' --exclude-from=$exf --include-from=$osf \
--exclude '*' . $RSYNC_DST_SPECIFIC"
cp -f $upload $upload_specific
echo $cmd >> $upload_specific
chmod 755 $upload_specific
echo $cmd
. $upload_specific
if [ $? != 0 ]; then
echo "--------------------------------------------------"
echo " "
echo "WARNING rsync failed. To retry later, you can run"
echo " $upload_specific"
echo " "
echo "--------------------------------------------------"
failed=yes
fi
echo "Uploading non-OSVERSION_SPECIFIC pkgs"
cmd="rsync $RSFLAGS --exclude-from=$exf --exclude-from=$osf . $RSYNC_DST_OTHER"
cp -f $upload $upload_others
echo $cmd >> $upload_others
chmod 755 $upload_others
echo $cmd
. $upload_others
if [ $? != 0 ]; then
echo "--------------------------------------------------"
echo " "
echo "WARNING rsync failed. To retry later, you can run"
echo " $upload_others"
echo " "
echo "--------------------------------------------------"
failed=yes
fi
# clean up temp files
if [ "$failed" = "no" ]; then
rm -fr $TMP
fi
|