summaryrefslogtreecommitdiff
path: root/sys-boot/linux/files/config_prepare.sh
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2017-04-28 22:30:14 +0200
committerKarel Kočí <cynerd@email.cz>2017-04-29 11:09:39 +0200
commitff32725fff6b3bd40a87f0b21152764084f9d33a (patch)
tree8d118a03310cbc96dd98ddea1f2108f826ff1e6a /sys-boot/linux/files/config_prepare.sh
parent13f491a430735286fecb767ca0abe5d1ab42c046 (diff)
downloadgentoo-personal-overlay-ff32725fff6b3bd40a87f0b21152764084f9d33a.tar.gz
gentoo-personal-overlay-ff32725fff6b3bd40a87f0b21152764084f9d33a.tar.bz2
gentoo-personal-overlay-ff32725fff6b3bd40a87f0b21152764084f9d33a.zip
Add package for linux
Diffstat (limited to 'sys-boot/linux/files/config_prepare.sh')
-rwxr-xr-xsys-boot/linux/files/config_prepare.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/sys-boot/linux/files/config_prepare.sh b/sys-boot/linux/files/config_prepare.sh
new file mode 100755
index 0000000..729e53c
--- /dev/null
+++ b/sys-boot/linux/files/config_prepare.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+set -e
+
+CNF="$(dirname $0)/configs"
+
+CONFS="base gentoo"
+
+while [ $# -gt 0 ]; do
+ case "$1" in
+ --help|-h)
+ echo "Usage: $0 [OPTION]... CONFIG..."
+ echo "Combine configurations and esure that we have corrent ones."
+ exit
+ ;;
+ --repeat|-r)
+ shift
+ REPEAT="$1"
+ ;;
+ -*)
+ echo "Warning: ignoring uknown option: $1" >&2
+ ;;
+ *)
+ if [ -f "$CNF/$1" ]; then
+ CONFS="$CONFS $1"
+ else
+ echo "Warning: ignoring requested missing configuration: $1" >&2
+ fi
+ ;;
+ esac
+ shift
+done
+
+if [ -z "$ARCH" ]; then
+ CONFS="$CONFS $(uname -m)"
+elif [ "$ARCH" = "x86_64" ]; then
+ CONFS="$CONFS x86_64"
+fi
+
+for C in $CONFS; do
+ while read L; do
+ echo "$L" | grep -qE "^[[:space:]]*$" && continue # ignore empty lines
+ echo "$L" | grep -qE "#.*" && continue # Ignore comments
+ # Remove lines with changed settings
+ OPTION="$(echo "$L" | grep -oE '^CONFIG_.*=')"
+ sed -i "#^$OPTION#d" .config
+ # Put config
+ echo "$L" >> .config
+ done < "$CNF/$C"
+done
+# Append small version
+#sed -i "#^CONFIG_LOCALVERSION=#g" .config
+#echo "CONFIG_LOCALVERSION=\".$VERSION\"" >> .config