]> git.ipfire.org Git - thirdparty/util-linux.git/blame - tools/ko-release-push
kill: add missing ifdefs
[thirdparty/util-linux.git] / tools / ko-release-push
CommitLineData
704d6ddb
KZ
1#!/bin/sh
2#
2bb3aa36 3# Copyright (C) 2012 Karel Zak <kzak@redhat.com>
704d6ddb 4#
abbc7b4a
KZ
5# Usage: ko-release-push [<directory> [<version>]]
6#
704d6ddb 7# This script pushs files from <directory>/v<version> to kernel.org. The
abbc7b4a
KZ
8# default <directory> is "kernel.org" and the default <version> is the current
9# package version.
704d6ddb
KZ
10#
11# The <directory>/v<version> files should be generated by ko-release-gen script.
12#
13
14cd "$(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
abbc7b4a 22VERSION=${2:-$(cat .version)}
916a7438 23VERSION_MAJOR=$(echo $VERSION | sed 's/-rc[0-9]//; s/\(.*\..*\)\..*/\1/')
704d6ddb
KZ
24BASEDIR=${1:-"kernel.org"}
25DISTDIR="${BASEDIR}/v${VERSION_MAJOR}"
26
27KO_DIR="/pub/linux/utils/util-linux/v${VERSION_MAJOR}"
28
7e08b7d3 29die() {
704d6ddb
KZ
30 echo $1
31 exit 1
32}
33
34function push_file {
35 local sig="$1"
36
37 case "$sig" in
38 *.tar.sign)
abbc7b4a
KZ
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
704d6ddb
KZ
45 ;;
46 *)
47 fl=$(echo "$sig" | sed 's/\.sign//')
48 ;;
49 esac
50
abbc7b4a 51 echo -n " PUSH $fl ..."
704d6ddb
KZ
52 kup put $fl $sig ${KO_DIR}/${fl##${DISTDIR}/}
53 echo " OK "
54}
55
56[ -d "$DISTDIR" ] || die "$DISTDIR: Not such directory"
57
58FILES=$(find $DISTDIR -name "*.sign" | sort)
59DIRS=$(for f in $FILES; do echo $(dirname ${KO_DIR}/${f##${DISTDIR}/}); done | sort -u)
60
61for d in $DIRS; do
62 echo -n " MKDIR $d ..."
63 kup mkdir $d
64 echo " OK "
65done
66
67for f in $FILES; do
68 push_file $f
69done
70