We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1d97e2d commit dbf87cfCopy full SHA for dbf87cf
ubuntu-mainline-kernel.sh
@@ -415,6 +415,13 @@ check_environment () {
415
fi
416
}
417
418
+guard_run_as_root () {
419
+ if [ "$(id -u)" -ne 0 ]; then
420
+ echo "The '$run_action' command requires root privileges"
421
+ exit 2
422
+ fi
423
+}
424
+
425
# execute requested action
426
case $run_action in
427
help)
@@ -529,6 +536,9 @@ Optional:
529
536
done) | $column
530
537
;;
531
538
install)
539
+ # only ensure running if the kernel files should be installed
540
+ [ $do_install -eq 1 ] && guard_run_as_root
541
532
542
check_environment
533
543
load_local_versions
534
544
@@ -738,6 +748,7 @@ Optional:
738
748
739
749
740
750
uninstall)
751
+ guard_run_as_root
741
752
742
753
743
754
if [ ${#LOCAL_VERSIONS[@]} -eq 0 ]; then
0 commit comments