@@ -51,7 +51,7 @@ build_pkgs="linux-headers,linux-image-unsigned,linux-modules"
5151# # DON'T CHANGE THESE MANUALLY
5252# ####
5353
54- # (internal) If cleanup_files=1 then before exiting all downloaded/temporaryfiles
54+ # (internal) If cleanup_files=1 then before exiting all downloaded/temporary files
5555# are removed
5656cleanup_files=1
5757
@@ -264,8 +264,9 @@ while (( "$#" )); do
264264 run_action=" help"
265265 ;;
266266 * )
267- run_action=" help"
268- err " Unknown argument $1 "
267+ err " Unknown argument: $1 "
268+ err " Try '--help' for more information."
269+ exit 1
269270 ;;
270271 esac
271272
293294# ####
294295
295296containsElement () {
296- local e
297- for e in " ${@: 2} " ; do [[ " $e " == " $1 " ]] || [[ " $e " =~ $1 - ]] && return 0; done
298- return 1
297+ local e
298+ for e in " ${@: 2} " ; do [[ " $e " == " $1 " ]] || [[ " $e " =~ $1 - ]] && return 0; done
299+ return 1
299300}
300301
301302monitor_background_command () {
@@ -430,14 +431,14 @@ load_remote_versions () {
430431 local line
431432
432433 [[ -n " $2 " ]] && {
433- REMOTE_VERSIONS=()
434+ REMOTE_VERSIONS=()
434435 }
435436
436437 if [ ${# REMOTE_VERSIONS[@]} -eq 0 ]; then
437438 if [ -z " $remote_html_cache " ]; then
438- [ -z " $1 " ] && logn " Downloading index from $ppa_host "
439- remote_html_cache=$( download $ppa_host $ppa_index )
440- [ -z " $1 " ] && log
439+ [ -z " $1 " ] && logn " Downloading index from $ppa_host "
440+ remote_html_cache=$( download $ppa_host $ppa_index )
441+ [ -z " $1 " ] && log
441442 fi
442443
443444 if [ -n " $remote_html_cache " ]; then
@@ -480,12 +481,12 @@ check_requested_version () {
480481 fi
481482
482483 if containsElement " $version " " ${LOCAL_VERSIONS[@]} " ; then
483- logn " Latest version is $version but seems its already installed"
484+ logn " Latest version is $version but seems it's already installed"
484485 else
485486 logn " Latest version is: $version "
486487 fi
487488
488- if [ $do_install -gt 0 ] && [ $assume_yes -eq 0 ]; then
489+ if [ $do_install -gt 0 ] && [ $assume_yes -eq 0 ]; then
489490 logn " , continue? (y/N) "
490491 [ $quiet -eq 0 ] && read -rsn1 continue
491492 log
@@ -541,16 +542,16 @@ check_environment () {
541542}
542543
543544guard_run_as_root () {
544- if [ " $( id -u) " -ne 0 ]; then
545- echo " The '$run_action ' command requires root privileges"
546- exit 2
547- fi
545+ if [ " $( id -u) " -ne 0 ]; then
546+ echo " The '$run_action ' command requires root privileges"
547+ exit 2
548+ fi
548549}
549550
550551# execute requested action
551552case $run_action in
552553 help)
553- echo " Usage: $0 -c|-l|-r|-u
554+ echo " Usage: $0 -c|-b|-i|- l|-r|-u
554555
555556Download & install the latest kernel available from $ppa_host$ppa_uri
556557
@@ -567,7 +568,7 @@ Arguments:
567568 -u [VERSION] Uninstall the specified kernel version. If version is omitted,
568569 a list of max 10 installed kernel versions is displayed
569570 --update Update this script by redownloading it from github
570- -h Show this message
571+ -h, --help Show this message
571572
572573Optional:
573574 -s, --signed Only install signed kernel packages (not implemented)
@@ -580,12 +581,13 @@ Optional:
580581 -do, --download-only Only download the deb files, do not install them
581582 -ns, --no-signature Do not check the gpg signature of the checksums file
582583 -nc, --no-checksum Do not check the sha checksums of the .deb files
583- -d, --debug Show debug information, all internal command's echo their output
584+ -d, --debug Show debug information, all internal commands echo their output
584585 --rc Also include release candidates
585586 --yes Assume yes on all questions (use with caution!)
586587"
587- exit 2
588+ exit 0
588589 ;;
590+
589591 update)
590592 check_environment
591593
@@ -602,6 +604,7 @@ Optional:
602604 echo " Script updated"
603605 fi
604606 ;;
607+
605608 check)
606609 check_environment
607610
@@ -626,7 +629,7 @@ Optional:
626629
627630 index=$( download $ppa_host " $ppa_uri " )
628631 if [[ ! $index =~ $build_succeeded_text ]]; then
629- log " A newer kernel version ($latest_version ) was found but the build was not successful"
632+ log " A newer kernel version ($latest_version ) was found but the build was not successful"
630633
631634 [ -n " $DISPLAY " ] && [ -x " $( command -v notify-send) " ] && notify-send --icon=info -t 12000 \
632635 " Kernel $latest_version available" \
@@ -643,8 +646,8 @@ Optional:
643646 latest_minor_version=$( latest_remote_version " ${installed_version% .* } " )
644647
645648 if [ " $installed_version " != " $latest_minor_version " ]; then
646- latest_minor_text=" , latest in current branch is ${latest_minor_version} "
647- latest_minor_notify=" Version ${latest_minor_version} is available in the current ${installed_version% .* } branch\n\n"
649+ latest_minor_text=" , latest in current branch is ${latest_minor_version} "
650+ latest_minor_notify=" Version ${latest_minor_version} is available in the current ${installed_version% .* } branch\n\n"
648651 fi
649652 fi
650653
@@ -657,6 +660,7 @@ Optional:
657660 exit 1
658661 fi
659662 ;;
663+
660664 local-list)
661665 load_local_versions
662666
@@ -669,6 +673,7 @@ Optional:
669673 fi
670674 done) | $column
671675 ;;
676+
672677 remote-list)
673678 check_environment
674679 load_remote_versions
@@ -682,6 +687,7 @@ Optional:
682687 fi
683688 done) | $column
684689 ;;
690+
685691 build)
686692 # only ensure running if the kernel files should be installed
687693 guard_run_as_root
850856 rmdir " $workdir "
851857 fi
852858 ;;
859+
853860 install)
854861 # only ensure running if the kernel files should be installed
855862 [ $do_install -eq 1 ] && guard_run_as_root
887894 index=$( download $ppa_host " $ppa_uri " )
888895
889896 if [[ ! $index =~ $build_succeeded_text ]]; then
890- err " Abort, the ${arch} build has not succeeded"
891- exit 1
897+ err " Abort, the ${arch} build has not succeeded"
898+ exit 1
892899 fi
893900
894901 index=${index%%* <table}
@@ -900,12 +907,12 @@ EOF
900907 section_end=" ^[[:space:]]*<br>[[:space:]]*$"
901908 for line in $index ; do
902909 if [[ $line =~ $build_succeeded_text ]]; then
903- found_arch=1
904- continue
910+ found_arch=1
911+ continue
905912 elif [ $found_arch -eq 0 ]; then
906- continue
913+ continue
907914 elif [[ $line =~ $section_end ]]; then
908- break
915+ break
909916 fi
910917
911918 [[ " $line " =~ linux-(image(-(un)? signed)? | headers| modules)-[0-9]+\. [0-9]+\. [0-9]+-[0-9]{6}.*? _(${arch} | all).deb ]] || continue
921928 line=${line%% \" >* }
922929
923930 if [ $uses_subfolders -eq 0 ] && [[ $line =~ ${arch} /linux ]]; then
924- uses_subfolders=1
931+ uses_subfolders=1
925932 fi
926933
927934 FILES+=(" $line " )
@@ -1025,12 +1032,12 @@ EOF
10251032 if [ $sign_kernel -eq 1 ]; then
10261033 kernelImg=" "
10271034 for deb in " ${debs[@]} " ; do
1028- # match deb file that starts with linux-image-
1035+ # Match deb file that starts with linux-image-
10291036 if [[ " $deb " == " linux-image-" * ]]; then
10301037 imagePkgName=" ${deb/ _* } "
10311038
10321039 # The image deb normally only adds one file (the kernal image) to
1033- # the /boot folder, find it so we can sign it
1040+ # the /boot folder, find it so we can sign it
10341041 kernelImg=" $( grep /boot/ <<< " $(dpkg -L " $imagePkgName " )" ) "
10351042 fi
10361043 done
@@ -1055,6 +1062,7 @@ EOF
10551062 rmdir " $workdir "
10561063 fi
10571064 ;;
1065+
10581066 uninstall)
10591067 guard_run_as_root
10601068 load_local_versions
0 commit comments