forked from pool/kernel-source
9cc54beab0
Accepted submit request 60424 from user michal-m OBS-URL: https://build.opensuse.org/request/show/60424 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/kernel-source?expand=0&rev=127
73 lines
1.6 KiB
Bash
73 lines
1.6 KiB
Bash
#! /bin/bash
|
|
|
|
export LANG=POSIX
|
|
|
|
path=(.)
|
|
while test $# -gt 0; do
|
|
case "$1" in
|
|
--patches)
|
|
path[${#path[@]}]=$2
|
|
shift 2
|
|
;;
|
|
*)
|
|
echo "Usage $0 [--patches <dir>]" >&2
|
|
exit 1
|
|
esac
|
|
done
|
|
if test "${path[*]}" = "."; then
|
|
path=(. ..)
|
|
fi
|
|
|
|
|
|
source $(dirname $0)/config.sh
|
|
set -- $(echo $SRCVERSION | sed -rn 's/([0-9]+)\.([0-9]+)\.([0-9]+)(.*)/\1 \2 \3 \4/p')
|
|
|
|
VERSION=$1
|
|
PATCHLEVEL=$2
|
|
SUBLEVEL=$3
|
|
EXTRAVERSION=$4
|
|
|
|
EXTRA_SYMBOLS=$(set -- $([ -e $(dirname $0)/extra-symbols ] && cat $(dirname $0)/extra-symbols) ; echo $*)
|
|
|
|
series=$(mktemp)
|
|
tmp_files="$series"
|
|
trap 'rm -rf $tmp_files' EXIT
|
|
warned=false
|
|
while read patch; do
|
|
dir=${patch%/*}
|
|
for p in "${path[@]}"; do
|
|
if test -d "$p/$dir"; then
|
|
echo "$p/$patch"
|
|
continue 2
|
|
fi
|
|
done
|
|
for p in "${path[@]}"; do
|
|
if test -e "$p/$dir.tar.bz2"; then
|
|
echo "unpacking $p/$dir.tar.bz2" >&2
|
|
if ! $warned; then
|
|
echo "pass --patches <directory with unpacked tarballs> to avoid this" >&2
|
|
warned=true
|
|
fi
|
|
tmp_files="$tmp_files $dir"
|
|
tar -xjf "$p/$dir.tar.bz2"
|
|
echo "$patch"
|
|
continue 2
|
|
fi
|
|
done
|
|
echo "Can't find $patch" >&2
|
|
exit 1
|
|
done >"$series" < <($(dirname $0)/guards $EXTRA_SYMBOLS <series.conf)
|
|
|
|
# Parse all the changes to KERNELRELEASE out of all patches and
|
|
# convert them to shell code that can be evaluated. Evaluate it.
|
|
eval "$(
|
|
<"$series" xargs awk '
|
|
/^--- |^+++ / \
|
|
{ M = match($2, /^[^\/]+\/Makefile( \t|$)/) }
|
|
M && /^+(VERSION|PATCHLEVEL|SUBLEVEL|EXTRAVERSION)/ \
|
|
{ print }
|
|
' \
|
|
| sed -e 's,^+,,' -e 's, *= *\(.*\),="\1",'
|
|
)"
|
|
echo "$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
|