Added --rc option
This commit is contained in:
parent
7538c4195d
commit
6ae7ef48d0
1 changed files with 27 additions and 9 deletions
|
@ -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,15 +62,29 @@ 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
|
||||||
# Get last kernel version
|
if [ ${MAINLINE} -eq 1 ] ; then
|
||||||
INFO=`curl -Ls https://www.kernel.org/ | perl -lne 'BEGIN{$/=""} print "$1 $2" if \
|
# Get last kernel version
|
||||||
/latest_link.*?<a.*?href=\"(.*?)\".*?>(.*?)</s'`
|
INFO=`curl -Ls https://www.kernel.org/ | perl -lne 'BEGIN{$/=""} print "$1 $2" if \
|
||||||
# Extract some values from kernel name
|
/latest_link.*?<a.*?href=\"(.*?)\".*?>(.*?)</s'`
|
||||||
KERNEL=`echo ${INFO} | cut -d' ' -f 2`
|
# Extract some values from kernel name
|
||||||
URL=`echo ${INFO} | cut -d' ' -f 1`
|
KERNEL=`echo ${INFO} | cut -d' ' -f 2`
|
||||||
FILE=`echo ${URL}|rev|cut -d'/' -f 1 | rev`
|
URL=`echo ${INFO} | cut -d' ' -f 1`
|
||||||
|
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}"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue