]> git.ipfire.org Git - thirdparty/util-linux.git/blob - tools/ko-release-gen
libblkid: check status for the current CDROM slot
[thirdparty/util-linux.git] / tools / ko-release-gen
1 #!/bin/sh
2 #
3 # Copyright (C) 2012 Karel Zak <kzak@redhat.com>
4 #
5 # Usage: ko-release-gen [<directory>]
6 #
7 # This script prepares a new release for publishing on kernel.org. The
8 # hierarchy of release files is created in the <directory> (default directory
9 # is "kernel.org"). Use case:
10 #
11 # make distcheck
12 # make changelog
13 # tools/ko-release-gen
14 # tools/ko-release-push
15 #
16
17 cd "$(git rev-parse --show-toplevel)" || {
18 echo "error: failed to chdir to git root"
19 exit 1
20 }
21
22 [ -f ".version" ] || \
23 echo "error: cannot found version file (call make distcheck)"
24
25 VERSION=$(cat .version)
26 VERSION_MAJOR=$(echo $VERSION | sed 's/-rc[0-9]//; s/\(.*\..*\)\..*/\1/')
27 VERSION_DOCS=$(echo $VERSION | sed 's/-rc[0-9]//')
28 DISTDIR=${1:-"kernel.org"}/v${VERSION_MAJOR}
29
30 GPG_PROG=${GPG_PROG:-"gpg"}
31 GPG_CMD="$GPG_PROG --use-agent --armor --detach-sign --quiet"
32
33 die() {
34 echo $1
35 exit 1
36 }
37
38 add_file() {
39 local src="$1"
40 local name=$(basename $1)
41 local subdir=$DISTDIR/${2:-""}
42
43 mkdir -p $subdir
44 cp $src $subdir || die "$src: copy failed"
45
46 [ -f $subdir/$name ] || die "$name not found"
47 echo -n " $subdir/$name ..."
48
49 case "$name" in
50 *.tar.xz)
51 local sig=$(echo "$name" | sed 's/\.tar\.xz/.tar.sign/')
52 xz -d -c $subdir/$name | $GPG_CMD --output $subdir/$sig
53 ;;
54 *.tar.gz)
55 local sig=$(echo "$name" | sed 's/\.tar\.gz/.tar.sign/')
56 gzip -d -c $subdir/$name | $GPG_CMD --output $subdir/$sig
57 ;;
58 *.tar.bz2)
59 local sig=$(echo "$name" | sed 's/\.tar\.bz2/.tar.sign/')
60 bzip2 -d -c $subdir/$name | $GPG_CMD --output $subdir/$sig
61 ;;
62 *)
63 local sig="${name}.sign"
64 cat $subdir/$name | $GPG_CMD --output $subdir/$sig
65 ;;
66 esac
67 echo " OK "
68 }
69
70 add_html_dir() {
71 local src="$1" # source dir
72 local tgt="$2" # target dir
73
74 for fl in $(ls $src/*.html $src/*.css $src/*.png); do
75 add_file $fl $tgt
76 done
77 }
78
79 rm -rf $DISTDIR
80
81 eval $(gpg-agent --daemon)
82
83 add_file util-linux-${VERSION}.tar.xz
84 add_file v${VERSION}-ChangeLog
85 add_file Documentation/releases/v${VERSION_DOCS}-ReleaseNotes
86 add_html_dir libmount/docs/html libmount-docs
87 add_html_dir libblkid/docs/html libblkid-docs
88 add_html_dir libsmartcols/docs/html libsmartcols-docs
89 add_html_dir libfdisk/docs/html libfdisk-docs
90
91 killall gpg-agent
92