forked from untangle/ngfw_pkgtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease-binary-packages.sh
executable file
·48 lines (36 loc) · 1.14 KB
/
release-binary-packages.sh
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
#! /bin/bash
set -e
usage() {
echo "Usage: $0 -r <repository> -d <distribution> [-h host] [-A architecture] [-a]"
echo -e "\t-a : all (recurse into subdirectories)"
echo -e "\t-A <arch> : only act on architecture <arch>"
exit 1
}
MAX_DEPTH="-maxdepth 1"
while getopts "r:d:A:ah?" opt ; do
case "$opt" in
r) REPOSITORY=$OPTARG ;;
d) DISTRIBUTION=$OPTARG ;;
h) HOST=$OPTARG ;;
a) MAX_DEPTH="" ;;
A) ARCH="$OPTARG" ;;
h|\?) usage ;;
esac
done
ARCH=${ARCH:-amd64}
HOST=${HOST:-package-server}
[ -z "$REPOSITORY" ] || [ -z "$DISTRIBUTION" ] && usage
DEBS=$(find . $MAX_DEPTH -iregex '.+_'$ARCH'\.u?deb$' | xargs)
[ $ARCH = amd64 ] && DEBS="$DEBS $(find . $MAX_DEPTH -iregex '.+_all\.u?deb$' | xargs)"
echo "About to upload:"
if [ -n "$DEBS" ] ; then
for p in $DEBS ; do
echo $p
manifest=$(echo $p | perl -pe 's/u?deb$/'${REPOSITORY}_${DISTRIBUTION}.manifest'/')
touch $manifest
echo $manifest
done
MANIFESTS=$(find . $MAXDEPTH -name "*.manifest" | xargs)
[ -n "$MANIFESTS" ] && lftp -e "set net:max-retries 1 ; cd $REPOSITORY/incoming ; put $DEBS $UDEBS $MANIFESTS ; exit" $HOST
rm -f $MANIFESTS
fi