Browse Source

kernel.sh+README: Add option to install

master
Riyyi 3 years ago
parent
commit
68470003a1
  1. 6
      README.org
  2. 37
      kernel.sh

6
README.org

@ -11,3 +11,9 @@ Disables incomplete reports in ~i2c-hid-code.c~ to stop logging spam.
$ mkdir build
$ ./kernel.sh
#+END_SRC
* Install
#+BEGIN_SRC sh
$ ./kernel.sh install
#+END_SRC

37
kernel.sh

@ -5,7 +5,7 @@
# SPDX-License-Identifier: GPL-2.0-only
#
# Build the Linux kernel
# Depends: asp, base-devel
# Depends: asp, base-devel, coreutils
# Setup
# --------------------------------------
@ -37,6 +37,7 @@ checkDependencies()
dependencies="
asp
base-devel
coreutils
"
for dependency in $dependencies; do
@ -74,8 +75,42 @@ build()
time makepkg -s
}
install()
{
cdSafe build
packages="$(find . -name "*.tar.zst" -type f)"
found="$(echo "$packages" | wc -l)"
if [ "$found" -ne 2 ]; then
echo "${b}${red}Error:${n} kernel was not build yet." >&2
exit 1
fi
if ! sudo -v; then
echo "${b}${red}Error:${n} you cannot perform this operation uness you are root." >&2
exit 1
fi
echo "$packages" | xargs --open-tty sudo pacman -U --needed
}
# Execute
# --------------------------------------
checkDependencies
script="$(basename "$0")"
case "$1" in
build | "")
build
;;
install)
install
;;
*)
echo "$script: invalid option '$1'" >&2
echo "Try '$script -h' for more information." >&2
exit 1
;;
esac

Loading…
Cancel
Save