Added --rc option

This commit is contained in:
dbroqua 2020-05-05 16:07:01 +02:00
parent 7538c4195d
commit 6ae7ef48d0

View file

@ -8,9 +8,9 @@ DEFAULT='\033[0m'
# Defaults values # Defaults values
PREFIX='linux-' PREFIX='linux-'
EXTENSION='.tar.xz' EXTENSION='.tar.xz'
MAINLINE=1
SHOW_MENU_CONFIG=0 SHOW_MENU_CONFIG=0
# Function to script script if step fail # Function to script script if step fail
isPreviousStepOk () { isPreviousStepOk () {
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
@ -27,7 +27,8 @@ while [ $# -gt 0 ]; do
printf "* pkgkernel-auto: Usage\n" printf "* pkgkernel-auto: Usage\n"
printf "* --menu: show kernel menu\n" printf "* --menu: show kernel menu\n"
printf "* --archive <path to local kernel archive>: Use local kernel archive\n" printf "* --archive <path to local kernel archive>: Use local kernel archive\n"
printf "* --extension <archive extention>: if not a archive extension is not tar.xz (tar.xz or tar.gz))\n" printf "* --extension <archive extention>: if not a archive extension is not tar.xz (tar.xz or tar.gz)\n"
printf "* --rc: Get RC version instead of mainline\n"
printf "****************************************************************************************************\n" printf "****************************************************************************************************\n"
printf "Example with RC kernel: \n" printf "Example with RC kernel: \n"
printf "pkgkernel-auto.sh --archive /home/dbroqua/Downloads/linux-5.7-rc4.tar.gz --extension tar.gz \n" printf "pkgkernel-auto.sh --archive /home/dbroqua/Downloads/linux-5.7-rc4.tar.gz --extension tar.gz \n"
@ -41,6 +42,9 @@ while [ $# -gt 0 ]; do
ARCHIVE=$2 ARCHIVE=$2
shift shift
;; ;;
--rc)
MAINLINE=0
;;
--extension) --extension)
EXTENSION=$2 EXTENSION=$2
shift shift
@ -58,6 +62,7 @@ if [ "${ARCHIVE}" != "" ] ; then
FILE=`basename "$ARCHIVE"` FILE=`basename "$ARCHIVE"`
KERNEL=`echo ${FILE}|sed 's/linux-//'|sed "s/\.${EXTENSION}//"` KERNEL=`echo ${FILE}|sed 's/linux-//'|sed "s/\.${EXTENSION}//"`
else else
if [ ${MAINLINE} -eq 1 ] ; then
# Get last kernel version # Get last kernel version
INFO=`curl -Ls https://www.kernel.org/ | perl -lne 'BEGIN{$/=""} print "$1 $2" if \ INFO=`curl -Ls https://www.kernel.org/ | perl -lne 'BEGIN{$/=""} print "$1 $2" if \
/latest_link.*?<a.*?href=\"(.*?)\".*?>(.*?)</s'` /latest_link.*?<a.*?href=\"(.*?)\".*?>(.*?)</s'`
@ -65,7 +70,20 @@ else
KERNEL=`echo ${INFO} | cut -d' ' -f 2` KERNEL=`echo ${INFO} | cut -d' ' -f 2`
URL=`echo ${INFO} | cut -d' ' -f 1` URL=`echo ${INFO} | cut -d' ' -f 1`
FILE=`echo ${URL}|rev|cut -d'/' -f 1 | rev` FILE=`echo ${URL}|rev|cut -d'/' -f 1 | rev`
else
INFO=`curl -sS https://www.kernel.org/ |grep href |cut -f2 -d\" |grep rc |grep git |grep tar`
EXTENSION="tar.gz"
URL=${INFO}
FILE=`basename "$INFO"`
KERNEL=`echo ${FILE}|sed 's/linux-//'|sed "s/\.${EXTENSION}//"`
fi fi
fi
echo INFO: ${INFO}
echo KERNEL: ${KERNEL}
echo URL: ${URL}
echo EXTENSION: ${EXTENSION}
echo FILE: ${FILE}
# Directory to store tmp files # Directory to store tmp files
DIR="/usr/src/${KERNEL}" DIR="/usr/src/${KERNEL}"