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
|
||||
PREFIX='linux-'
|
||||
EXTENSION='.tar.xz'
|
||||
MAINLINE=1
|
||||
SHOW_MENU_CONFIG=0
|
||||
|
||||
|
||||
# Function to script script if step fail
|
||||
isPreviousStepOk () {
|
||||
if [ $? -ne 0 ]; then
|
||||
|
@ -27,7 +27,8 @@ while [ $# -gt 0 ]; do
|
|||
printf "* pkgkernel-auto: Usage\n"
|
||||
printf "* --menu: show kernel menu\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 "Example with RC kernel: \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
|
||||
shift
|
||||
;;
|
||||
--rc)
|
||||
MAINLINE=0
|
||||
;;
|
||||
--extension)
|
||||
EXTENSION=$2
|
||||
shift
|
||||
|
@ -58,15 +62,29 @@ if [ "${ARCHIVE}" != "" ] ; then
|
|||
FILE=`basename "$ARCHIVE"`
|
||||
KERNEL=`echo ${FILE}|sed 's/linux-//'|sed "s/\.${EXTENSION}//"`
|
||||
else
|
||||
# Get last kernel version
|
||||
INFO=`curl -Ls https://www.kernel.org/ | perl -lne 'BEGIN{$/=""} print "$1 $2" if \
|
||||
/latest_link.*?<a.*?href=\"(.*?)\".*?>(.*?)</s'`
|
||||
# Extract some values from kernel name
|
||||
KERNEL=`echo ${INFO} | cut -d' ' -f 2`
|
||||
URL=`echo ${INFO} | cut -d' ' -f 1`
|
||||
FILE=`echo ${URL}|rev|cut -d'/' -f 1 | rev`
|
||||
if [ ${MAINLINE} -eq 1 ] ; then
|
||||
# Get last kernel version
|
||||
INFO=`curl -Ls https://www.kernel.org/ | perl -lne 'BEGIN{$/=""} print "$1 $2" if \
|
||||
/latest_link.*?<a.*?href=\"(.*?)\".*?>(.*?)</s'`
|
||||
# Extract some values from kernel name
|
||||
KERNEL=`echo ${INFO} | cut -d' ' -f 2`
|
||||
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
|
||||
|
||||
echo INFO: ${INFO}
|
||||
echo KERNEL: ${KERNEL}
|
||||
echo URL: ${URL}
|
||||
echo EXTENSION: ${EXTENSION}
|
||||
echo FILE: ${FILE}
|
||||
|
||||
# Directory to store tmp files
|
||||
DIR="/usr/src/${KERNEL}"
|
||||
|
||||
|
|
Loading…
Reference in a new issue