summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--makekernel.in111
1 files changed, 76 insertions, 35 deletions
diff --git a/makekernel.in b/makekernel.in
index be7615c..8a788d2 100644
--- a/makekernel.in
+++ b/makekernel.in
@@ -5,18 +5,25 @@ set -e
usage () {
>&2 echo 'makekernel version #VERSION#'
>&2 echo 'usage:'
- >&2 echo ' makekernel [ -a | --allowDownload ] [ -c $version | --compileVersion=$version ]:'
+ >&2 echo ' makekernel [ -a | --allowDownload ] [ -c $version | --compileVersion=$version ] [ -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 ' -n | --noAction:'
+ >&2 echo ' do not do anything, just print what would be done'
>&2 echo ' makekernel ( -s | --showVersion ):'
>&2 echo ' show version of most current stable kernel'
exit 1
}
dlExVer () {
+ if ${noAction}
+ then
+ echo "download and verify '$1.xz'"
+ return 0
+ fi
wget -nd "${proxyPrefix}$1.xz" || wget -nd "$1.xz"
wget -nd "${proxyPrefix}$1.sign" || wget -nd "$1.sign"
xz -d "$2.xz"
@@ -46,9 +53,10 @@ then
fi
eval set -- "$(
- getopt -o ac:s \
+ getopt -o ac:ns \
--long allowDownload \
--long compileVersion: \
+ --long noAction \
--long showVersion \
-n "$(basename "$0")" \
-- "$@" || echo usage
@@ -57,6 +65,7 @@ eval set -- "$(
allowDownload=false
forceVersion=false
showVersion=false
+noAction=false
while true
do
@@ -73,10 +82,15 @@ do
forceVersion=true
shift
;;
+ -n|--noAction)
+ ${showVersion} && usage
+ noAction=true
+ ;;
-s|--showVersion)
${allowDownload} && usage
${forceVersion} && usage
${showVersion} && usage
+ ${noAction} && usage
showVersion=true
;;
--)
@@ -174,47 +188,74 @@ echo "update type: ${updateType}"
if [ -n "${patchSrc}" ]
then
dlExVer "${patchSrc}" "${patch}"
- cp -r "${srcDir}" "linux-${curVer}"
- cd "linux-${curVer}"
- patch -p1 -i "../${patch}"
- rm "../${patch}"
+ if ${noAction}
+ then
+ echo "copy '${srcDir}' to 'linux-${curVer}' and patch via '${patch}'"
+ else
+ cp -r "${srcDir}" "linux-${curVer}"
+ cd "linux-${curVer}"
+ patch -p1 -i "../${patch}"
+ rm "../${patch}"
+ fi
elif [ -n "${dlSrc}" ]
then
dlExVer "${dlSrc}" "linux-${curVer}.tar"
- tar -xf "linux-${curVer}.tar"
- rm "linux-${curVer}.tar"
+ if ! ${noAction}
+ then
+ tar -xf "linux-${curVer}.tar"
+ rm "linux-${curVer}.tar"
+ fi
fi
-cd "${kernelDir}/linux-${curVer}"
-[ ! -r .config ] && zcat /proc/config.gz > .config
-
-make clean
-make oldconfig
-make
-grep -q '^# CONFIG_MODULES is not set$' .config || make modules_install
-
-kernelImg="$(find ${kernelDir}/linux-${curVer}/arch/ -type f -iname '*image')"
-if [ $(echo "${kernelImg}" | wc -l) -ne 1 ]
+if ${noAction}
then
- >&2 echo 'ERROR: Did not find exactly one compiled kernel image:'
- >&2 echo "${kernelImg}"
- >&2 echo 'Closing.'
- exit 1
+ echo "copy config (can't say, from where, right now)"
+else
+ cd "${kernelDir}/linux-${curVer}"
+ [ ! -r .config ] && zcat /proc/config.gz > .config
fi
-echo 'becoming root ...'
+if ${noAction}
+then
+ echo "make clean"
+ echo "make oldconfing"
+ echo "make"
+ echo "possibly: make modules_install"
+ echo
+ echo "as root:"
+ echo " before_install_hook &&"
+ echo ' install -m644 --owner=root "${kernelImg}" "/boot/vmlinuz-'"${curVer}"'" &&'
+ echo " grub-mkconfig -o /boot/grub/grub.cfg &&"
+ echo " after_install_hook"
+else
+ make clean
+ make oldconfig
+ make
+ grep -q '^# CONFIG_MODULES is not set$' .config || make modules_install
-err=1
-while [ ${err} -eq 1 ]
-do
- su -c ' \
- . #ETCDIR#/makekernel.conf && \
- before_install_hook && \
- install -m644 --owner=root "'"${kernelImg}"'" "/boot/vmlinuz-'"${curVer}"'" && \
- grub-mkconfig -o /boot/grub/grub.cfg && \
- after_install_hook || \
- exit 2 \
- ' && err=0 || err=$?
-done
+ kernelImg="$(find ${kernelDir}/linux-${curVer}/arch/ -type f -iname '*image')"
+ if [ $(echo "${kernelImg}" | wc -l) -ne 1 ]
+ then
+ >&2 echo 'ERROR: Did not find exactly one compiled kernel image:'
+ >&2 echo "${kernelImg}"
+ >&2 echo 'Closing.'
+ exit 1
+ fi
+
+ echo 'becoming root ...'
+
+ err=1
+ while [ ${err} -eq 1 ]
+ do
+ su -c ' \
+ . #ETCDIR#/makekernel.conf && \
+ before_install_hook && \
+ install -m644 --owner=root "'"${kernelImg}"'" "/boot/vmlinuz-'"${curVer}"'" && \
+ grub-mkconfig -o /boot/grub/grub.cfg && \
+ after_install_hook || \
+ exit 2 \
+ ' && err=0 || err=$?
+ done
+fi
echo 'Success.'