kernel.sh+README: Add option to install
This commit is contained in:
+8
-2
@@ -8,6 +8,12 @@ Disables incomplete reports in ~i2c-hid-code.c~ to stop logging spam.
|
||||
* Build instructions
|
||||
|
||||
#+BEGIN_SRC sh
|
||||
$ mkdir build
|
||||
$ ./kernel.sh
|
||||
$ mkdir build
|
||||
$ ./kernel.sh
|
||||
#+END_SRC
|
||||
|
||||
* Install
|
||||
|
||||
#+BEGIN_SRC sh
|
||||
$ ./kernel.sh install
|
||||
#+END_SRC
|
||||
|
||||
@@ -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
|
||||
build
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user