summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2016-05-14 09:29:41 -0400
committerAnthony G. Basile <blueness@gentoo.org>2016-05-14 09:29:41 -0400
commita54d71c671e6d944bc4c4c5d9f415e734f1494fc (patch)
tree2b3a22e4c54c35c964acac1bfa33c6630b03f110
parentgrsecurity-3.1-4.5.4-201605131918 (diff)
downloadhardened-patchset-a54d71c671e6d944bc4c4c5d9f415e734f1494fc.tar.gz
hardened-patchset-a54d71c671e6d944bc4c4c5d9f415e734f1494fc.tar.bz2
hardened-patchset-a54d71c671e6d944bc4c4c5d9f415e734f1494fc.zip
scripts: intelligently obtain KMAJOR
-rwxr-xr-xscripts/ap.patch.sh11
-rwxr-xr-xscripts/re.patch.sh11
2 files changed, 8 insertions, 14 deletions
diff --git a/scripts/ap.patch.sh b/scripts/ap.patch.sh
index 9ad2c24..19c4bb3 100755
--- a/scripts/ap.patch.sh
+++ b/scripts/ap.patch.sh
@@ -1,14 +1,11 @@
#!/bin/bash
-SCRIPT="${0}"
-KMAJOR="${1}"
+SCRIPT="$0"
+KMAJOR="$1"
+DIRVER="$(basename $(pwd) | sed -e 's/linux-//' -e 's/-hardened.*//')"
+: ${KMAJOR:=$DIRVER}
PATCHSET="/root/hardened-patchset/${KMAJOR}"
-if [[ -z "${KMAJOR}" ]] ; then
- echo "Usage: ${SCRIPT} <kernel_major>"
- exit
-fi
-
if [[ ! -d ${PATCHSET} ]] ; then
echo "Patchset ${KMAJOR} doesn't exist"
exit
diff --git a/scripts/re.patch.sh b/scripts/re.patch.sh
index d1ac153..0daafc3 100755
--- a/scripts/re.patch.sh
+++ b/scripts/re.patch.sh
@@ -1,14 +1,11 @@
#!/bin/bash
-SCRIPT="${0}"
-KMAJOR="${1}"
+SCRIPT="$0"
+KMAJOR="$1"
+DIRVER="$(basename $(pwd) | sed -e 's/linux-//' -e 's/-hardened.*//')"
+: ${KMAJOR:=$DIRVER}
PATCHSET="/root/hardened-patchset/${KMAJOR}"
-if [[ -z "${KMAJOR}" ]] ; then
- echo "Usage: ${SCRIPT} <kernel_major>"
- exit
-fi
-
if [[ ! -d ${PATCHSET} ]] ; then
echo "Patchset ${KMAJOR} doesn't exist"
exit