]> git.ipfire.org Git - thirdparty/util-linux.git/blob - tools/ko-release-push
libfdisk: (dos) be more robust about max number of partitions
[thirdparty/util-linux.git] / tools / ko-release-push
1 #!/bin/sh
2 #
3 # Copyright (C) 2012 Karel Zak <kzak@redhat.com>
4 #
5 # Usage: ko-release-push [<directory> [<version>]]
6 #
7 # This script pushs files from <directory>/v<version> to kernel.org. The
8 # default <directory> is "kernel.org" and the default <version> is the current
9 # package version.
10 #
11 # The <directory>/v<version> files should be generated by ko-release-gen script.
12 #
13
14 cd "$(git rev-parse --show-toplevel)" || {
15 echo "error: failed to chdir to git root"
16 exit 1
17 }
18
19 [ -f ".version" ] || \
20 echo "error: cannot found version file (call make distcheck)"
21
22 VERSION=${2:-$(cat .version)}
23 VERSION_MAJOR=$(echo $VERSION | sed 's/-rc[0-9]//; s/\(.*\..*\)\..*/\1/')
24 BASEDIR=${1:-"kernel.org"}
25 DISTDIR="${BASEDIR}/v${VERSION_MAJOR}"
26
27 KO_DIR="/pub/linux/utils/util-linux/v${VERSION_MAJOR}"
28
29 die() {
30 echo $1
31 exit 1
32 }
33
34 function push_file {
35 local sig="$1"
36
37 case "$sig" in
38 *.tar.sign)
39 fl=${sig%%.sign}
40 if [ -f ${fl}.xz ]; then fl=${fl}.xz
41 elif [ -f ${fl}.gz ]; then fl=${fl}.gz
42 elif [ -f ${fl}.bz2 ]; then fl=${fl}.bz2
43 else die "cannot found original file for $sig"
44 fi
45 ;;
46 *)
47 fl=$(echo "$sig" | sed 's/\.sign//')
48 ;;
49 esac
50
51 echo -n " PUSH $fl ..."
52 kup put $fl $sig ${KO_DIR}/${fl##${DISTDIR}/}
53 echo " OK "
54 }
55
56 [ -d "$DISTDIR" ] || die "$DISTDIR: Not such directory"
57
58 FILES=$(find $DISTDIR -name "*.sign" | sort)
59 DIRS=$(for f in $FILES; do echo $(dirname ${KO_DIR}/${f##${DISTDIR}/}); done | sort -u)
60
61 for d in $DIRS; do
62 echo -n " MKDIR $d ..."
63 kup mkdir $d
64 echo " OK "
65 done
66
67 for f in $FILES; do
68 push_file $f
69 done
70