2012-01-19 03:33:42 -06:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Copyright (C) 2012 Karel Zak <kzak@redhat.com>
|
|
|
|
#
|
2021-06-01 04:45:16 -05:00
|
|
|
# Usage: ko-release-gen [<directory> [<file>]]
|
2012-01-19 03:33:42 -06:00
|
|
|
#
|
|
|
|
# This script prepares a new release for publishing on kernel.org. The
|
|
|
|
# hierarchy of release files is created in the <directory> (default directory
|
|
|
|
# is "kernel.org"). Use case:
|
|
|
|
#
|
|
|
|
# make distcheck
|
|
|
|
# make changelog
|
|
|
|
# tools/ko-release-gen
|
|
|
|
# tools/ko-release-push
|
|
|
|
#
|
|
|
|
|
|
|
|
cd "$(git rev-parse --show-toplevel)" || {
|
|
|
|
echo "error: failed to chdir to git root"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
[ -f ".version" ] || \
|
|
|
|
echo "error: cannot found version file (call make distcheck)"
|
|
|
|
|
|
|
|
VERSION=$(cat .version)
|
2012-03-30 06:43:45 -05:00
|
|
|
VERSION_MAJOR=$(echo $VERSION | sed 's/-rc[0-9]//; s/\(.*\..*\)\..*/\1/')
|
|
|
|
VERSION_DOCS=$(echo $VERSION | sed 's/-rc[0-9]//')
|
2012-01-19 03:33:42 -06:00
|
|
|
DISTDIR=${1:-"kernel.org"}/v${VERSION_MAJOR}
|
|
|
|
|
2016-09-30 18:20:06 -05:00
|
|
|
GPG_PROG=${GPG_PROG:-"gpg"}
|
|
|
|
GPG_CMD="$GPG_PROG --use-agent --armor --detach-sign --quiet"
|
2012-01-19 03:33:42 -06:00
|
|
|
|
2012-03-18 15:45:11 -05:00
|
|
|
die() {
|
2012-01-19 03:33:42 -06:00
|
|
|
echo $1
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2012-03-18 15:45:11 -05:00
|
|
|
add_file() {
|
2012-01-19 03:33:42 -06:00
|
|
|
local src="$1"
|
|
|
|
local name=$(basename $1)
|
|
|
|
local subdir=$DISTDIR/${2:-""}
|
|
|
|
|
|
|
|
mkdir -p $subdir
|
|
|
|
cp $src $subdir || die "$src: copy failed"
|
|
|
|
|
|
|
|
[ -f $subdir/$name ] || die "$name not found"
|
|
|
|
echo -n " $subdir/$name ..."
|
|
|
|
|
|
|
|
case "$name" in
|
|
|
|
*.tar.xz)
|
|
|
|
local sig=$(echo "$name" | sed 's/\.tar\.xz/.tar.sign/')
|
|
|
|
xz -d -c $subdir/$name | $GPG_CMD --output $subdir/$sig
|
|
|
|
;;
|
2012-01-19 06:15:03 -06:00
|
|
|
*.tar.gz)
|
|
|
|
local sig=$(echo "$name" | sed 's/\.tar\.gz/.tar.sign/')
|
|
|
|
gzip -d -c $subdir/$name | $GPG_CMD --output $subdir/$sig
|
|
|
|
;;
|
|
|
|
*.tar.bz2)
|
|
|
|
local sig=$(echo "$name" | sed 's/\.tar\.bz2/.tar.sign/')
|
|
|
|
bzip2 -d -c $subdir/$name | $GPG_CMD --output $subdir/$sig
|
|
|
|
;;
|
2012-01-19 03:33:42 -06:00
|
|
|
*)
|
|
|
|
local sig="${name}.sign"
|
|
|
|
cat $subdir/$name | $GPG_CMD --output $subdir/$sig
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
echo " OK "
|
|
|
|
}
|
|
|
|
|
2012-03-18 15:45:11 -05:00
|
|
|
add_html_dir() {
|
2012-01-19 03:33:42 -06:00
|
|
|
local src="$1" # source dir
|
|
|
|
local tgt="$2" # target dir
|
2019-08-28 18:25:57 -05:00
|
|
|
|
2012-03-18 15:45:11 -05:00
|
|
|
for fl in $(ls $src/*.html $src/*.css $src/*.png); do
|
2012-01-19 03:33:42 -06:00
|
|
|
add_file $fl $tgt
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
rm -rf $DISTDIR
|
|
|
|
|
2012-02-07 04:30:56 -06:00
|
|
|
eval $(gpg-agent --daemon)
|
|
|
|
|
2021-06-01 04:45:16 -05:00
|
|
|
# Add just specified files only
|
|
|
|
if [ -f "$2" ]; then
|
|
|
|
shift
|
|
|
|
while (( "$#" )); do
|
|
|
|
add_file "$1"
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
killall gpg-agent
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2012-01-19 03:33:42 -06:00
|
|
|
add_file util-linux-${VERSION}.tar.xz
|
|
|
|
add_file v${VERSION}-ChangeLog
|
2012-03-30 06:43:45 -05:00
|
|
|
add_file Documentation/releases/v${VERSION_DOCS}-ReleaseNotes
|
2012-01-19 03:33:42 -06:00
|
|
|
add_html_dir libmount/docs/html libmount-docs
|
|
|
|
add_html_dir libblkid/docs/html libblkid-docs
|
2014-06-18 08:42:09 -05:00
|
|
|
add_html_dir libsmartcols/docs/html libsmartcols-docs
|
2015-02-19 06:43:42 -06:00
|
|
|
add_html_dir libfdisk/docs/html libfdisk-docs
|
2012-01-19 03:33:42 -06:00
|
|
|
|
2012-02-07 04:30:56 -06:00
|
|
|
killall gpg-agent
|
|
|
|
|