tools/scripts/update_linux.sh
5e5f3587
 #! /bin/sh
 
311a06ec
 specs="linux-api-headers/linux-api-headers.spec linux/linux.spec linux/linux-esx.spec linux/linux-secure.spec linux/linux-rt.spec"
5e5f3587
 
31109ffe
 tarball_url=`curl -s https://www.kernel.org  | grep -Eo 'https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.1.[0-9]*.tar.xz' | uniq`
5e5f3587
 tarball=$(basename $tarball_url)
 version=`echo $tarball | sed 's/linux-//; s/.tar.xz//'`
 echo latest linux version: $version
 test -f stage/SOURCES/$tarball && echo up to date && exit 0
 $(cd stage/SOURCES && wget $tarball_url)
9c699c93
 sha512=`sha512sum stage/SOURCES/$tarball | awk '{print $1}'`
5e5f3587
 changelog_entry=$(echo "`date +"%a %b %d %Y"` `git config user.name` <`git config user.email`> $version-1")
 for spec in $specs; do
31109ffe
 	sed -i '/^Version:/ s/6.1.[0-9]*/'$version'/' SPECS/$spec
5e5f3587
 	sed -i '/^Release:/ s/[0-9]*%/1%/' SPECS/$spec
9c699c93
 	sed -i '/^%define sha512 linux/ s/=[0-9a-f]*$/='$sha512'/' SPECS/$spec
 	sed -i '/^%changelog/a* '"$changelog_entry"'\n- Update to version '"$version"'' SPECS/$spec
5e5f3587
 done