From 3fb3f6d6389bc347b7472bcfab3484b84f8c8e3b Mon Sep 17 00:00:00 2001 From: dbroqua Date: Thu, 7 May 2020 08:42:35 +0200 Subject: [PATCH] Renamed script --- README.md | 6 -- pkgkernel-auto.sh | 182 ---------------------------------------------- pkgkernel.sh | 151 +++++++++++++++++++++++++++++++++----- 3 files changed, 133 insertions(+), 206 deletions(-) delete mode 100755 pkgkernel-auto.sh diff --git a/README.md b/README.md index 8c591b5..d5167a0 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,3 @@ Simple outils permettant de compiler le kernel sur GNU/Debian Based on https://debian-facile.org/doc:systeme:kernel:compiler - -Merci d'utiliser `pkgkernel-auto.sh`. La différence principale avec pkgkernel.sh -c'est que ce script est totalement automique. Il récupère les sources depuis -[kernel.org](https://www.kernel.org), les compile et les installe. - -A terme le premier script disparaitra. diff --git a/pkgkernel-auto.sh b/pkgkernel-auto.sh deleted file mode 100755 index 94d9e45..0000000 --- a/pkgkernel-auto.sh +++ /dev/null @@ -1,182 +0,0 @@ -#! /bin/bash - -# Some colors -GREEN='\033[0;32m' -RED='\033[0;31m' -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 - echo "${RED} Error!${DEFAULT}" - exit 1 - fi -} - -# Get arguments from command line -while [ $# -gt 0 ]; do - case "$1" in - --help) - printf "****************************************************************************************************\n" - printf "* pkgkernel-auto: Usage\n" - printf "* --menu: show kernel menu\n" - printf "* --archive : Use local kernel archive\n" - printf "* --extension : 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" - printf "****************************************************************************************************\n" - exit 1 - ;; - --menu) - SHOW_MENU_CONFIG=1 - ;; - --archive) - ARCHIVE=$2 - shift - ;; - --rc) - MAINLINE=0 - ;; - --extension) - EXTENSION=$2 - shift - ;; - *) - printf "***************************\n" - printf "* Error: Invalid argument.*\n" - printf "***************************\n" - exit 1 - esac - shift -done - -if [[ $EUID -ne 0 ]]; then - echo "This script must be run as root" 1>&2 - sudo $0 - exit 1 -fi - - -if [ "${ARCHIVE}" != "" ] ; then - FILE=`basename "$ARCHIVE"` - KERNEL=`echo ${FILE}|sed 's/linux-//'|sed "s/\.${EXTENSION}//"` -else - 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.*?(.*?): Use local kernel archive\n" + printf "* --extension : 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" + printf "****************************************************************************************************\n" + exit 1 + ;; + --menu) + SHOW_MENU_CONFIG=1 + ;; + --archive) + ARCHIVE=$2 + shift + ;; + --rc) + MAINLINE=0 + ;; + --extension) + EXTENSION=$2 + shift + ;; + *) + printf "***************************\n" + printf "* Error: Invalid argument.*\n" + printf "***************************\n" + exit 1 + esac + shift +done + +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root" 1>&2 + sudo $0 + exit 1 fi -KERNEL=${1} -KERNEL=${KERNEL#$PREFIX} -# Get kernel version from argument -KERNEL=${KERNEL%$EXTENSION} +if [ "${ARCHIVE}" != "" ] ; then + FILE=`basename "$ARCHIVE"` + KERNEL=`echo ${FILE}|sed 's/linux-//'|sed "s/\.${EXTENSION}//"` +else + 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.*?(.*?)