diff options
Diffstat (limited to 'makekernel.in')
-rw-r--r-- | makekernel.in | 21 |
1 files changed, 19 insertions, 2 deletions
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|' |