summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2022-03-28 21:13:49 +0200
committerErich Eckner <git@eckner.net>2022-03-28 21:13:49 +0200
commit2f1b285214845b232d0fb8af41e6fe0d2468bb3d (patch)
treeb7c1ac9e2e244132dd6bd3acd582c64b417cedfb
parent86bf1fd9fff54ca1045d69ae153ca8ee3fda8cee (diff)
downloadmakekernel-2f1b285214845b232d0fb8af41e6fe0d2468bb3d.tar.xz
new option: -f|--force
-rw-r--r--makekernel.8.in14
-rw-r--r--makekernel.in21
2 files changed, 29 insertions, 6 deletions
diff --git a/makekernel.8.in b/makekernel.8.in
index e8de042..d11a07d 100644
--- a/makekernel.8.in
+++ b/makekernel.8.in
@@ -5,7 +5,7 @@ makekernel \- small script to compile linux kernel
.TP
\fBmakekernel [\-s|\-\-showVersion]\fP
.TP
-\fBmakekernel [\-c|\-\-compileVersion \fIversion\fB] [\-a|\-\-allowDownload]\fP
+\fBmakekernel [\-a|\-\-allowDownload] [\-c|\-\-compileVersion \fIversion\fB] [\-f|\-\-force] [\-n|\-\-noAction]\fP
.SH DESCRIPTION
\fBmakekernel\fP downloads and compiles the linux kernel, preferably downloading a patch instead of the full source.
.SH OPTIONS
@@ -15,12 +15,18 @@ Show version of most current available stable kernel.
Does not compile or download any source code nor patch.
Conflicts with all other options.
.TP
-.B "\-c, \-\-compileVersion \fIversion\fP"
-Force current version to \fIversion\fP.
-.TP
.B "\-a, \-\-allowDownload"
Allow to download a full source if necessary.
\fBmakekernel\fP will still download a patch if available.
+.TP
+.B "\-c, \-\-compileVersion \fIversion\fP"
+Force current version to \fIversion\fP.
+.TP
+.B "\-f, \-\-force"
+Build kernel even if it appears to be up to date.
+.TP
+.B "\-n, \-\-noAction"
+Do not do anything, just print what would be done.
.SH CONFIGURATION
The configfile \fB#ETCDIR#/makekernel.conf\fP is a bash script, which defines the following variables and routines:
.TP
diff --git a/makekernel.in b/makekernel.in
index c165b47..099b604 100644
--- a/makekernel.in
+++ b/makekernel.in
@@ -5,12 +5,14 @@ set -e
usage () {
>&2 echo 'makekernel version #VERSION#'
>&2 echo 'usage:'
- >&2 echo ' makekernel [ -a | --allowDownload ] [ -c $version | --compileVersion=$version ] [ -n | --noAction ]:'
+ >&2 echo ' makekernel [ -a | --allowDownload ] [ -c $version | --compileVersion=$version ] [ -f | --force ] [ -n | --noAction ]:'
>&2 echo ' download and compile kernel'
>&2 echo ' -a | --allowDownload:'
>&2 echo ' allow to download complete source instead of patch if necessary'
>&2 echo ' -c | --compileVersion $version:'
>&2 echo ' download and compile version $version instead of most current stable'
+ >&2 echo ' -f | --force:'
+ >&2 echo ' build kernel even if it appears to be up to date'
>&2 echo ' -n | --noAction:'
>&2 echo ' do not do anything, just print what would be done'
>&2 echo ' makekernel ( -s | --showVersion ):'
@@ -46,9 +48,10 @@ then
fi
eval set -- "$(
- getopt -o ac:ns \
+ getopt -o ac:fns \
--long allowDownload \
--long compileVersion: \
+ --long force \
--long noAction \
--long showVersion \
-n "$(basename "$0")" \
@@ -56,6 +59,7 @@ eval set -- "$(
)"
allowDownload=false
+forceBuild=false
forceVersion=false
showVersion=false
noAction=false
@@ -77,12 +81,18 @@ do
forceVersion=true
shift
;;
+ -f|--force)
+ ${showVersion} && usage
+ forceBuild=true
+ shift
+ ;;
-n|--noAction)
${showVersion} && usage
noAction=true
;;
-s|--showVersion)
${allowDownload} && usage
+ ${forceBuild} && usage
${forceVersion} && usage
${showVersion} && usage
${noAction} && usage
@@ -137,6 +147,13 @@ then
fi
[ -z "${curVer}" ] && curVer="$("$0" -s)"
+
+if ! ${forceBuild} \
+&& [ -f '/boot/vmlinuz-'"${curVer}" ]; then
+ >&2 echo 'kernel is up to date.'
+ exit
+fi
+
mainVer="$(
echo "${curVer}" | \
sed 's|^\([0-9]\+\.[0-9]\+\)\(\..*\)\?$|\1|'