summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancis Rowe <info@gluglug.org.uk>2015-08-30 10:49:01 (EDT)
committer Francis Rowe <info@gluglug.org.uk>2015-08-30 10:49:01 (EDT)
commit82e5f8d5fc8aa8bfe013b84460b296ce188ab7da (patch)
tree0f6b4f64bba0e9bc6babe197f8a57fdc9acc9e2d
parenta8de16a388680e179f97fe2fdfbdb307fabc9b8e (diff)
downloadlibreboot-82e5f8d5fc8aa8bfe013b84460b296ce188ab7da.zip
libreboot-82e5f8d5fc8aa8bfe013b84460b296ce188ab7da.tar.gz
libreboot-82e5f8d5fc8aa8bfe013b84460b296ce188ab7da.tar.bz2
build/config/coreboot{replace,update}: for function for for loop
-rwxr-xr-xresources/scripts/helpers/build/config/corebootreplace29
-rwxr-xr-xresources/scripts/helpers/build/config/corebootupdate33
2 files changed, 30 insertions, 32 deletions
diff --git a/resources/scripts/helpers/build/config/corebootreplace b/resources/scripts/helpers/build/config/corebootreplace
index d5fdcb2..0c41c9e 100755
--- a/resources/scripts/helpers/build/config/corebootreplace
+++ b/resources/scripts/helpers/build/config/corebootreplace
@@ -25,23 +25,22 @@
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
-cd "resources/libreboot/config/grub/"
+hackconfig () {
+ cd "coreboot/"
-if [ $# -lt 1 ]; then
- configs="$(for config in *; do printf "%s\n" "${config}"; done)"
-else
- configs="${*}"
-fi
-
-cd "../../../../coreboot/"
-for config in ${configs}; do
- printf "Replacing or creating new config for %s\n" "${config}"
+ printf "Replacing or creating new config for %s\n" "${1}"
sleep 2
-
+
make menuconfig
- [ ! -d "../resources/libreboot/config/grub/${config}/" ] && mkdir -p "../resources/libreboot/config/grub/${config}/"
- mv ".config" "../resources/libreboot/config/grub/${config}/config"
-done
+ [ ! -d "../resources/libreboot/config/grub/${1}/" ] && mkdir -p "../resources/libreboot/config/grub/${1}/"
+ mv ".config" "../resources/libreboot/config/grub/${1}/config"
-cd "../"
+ cd "../"
+}
+
+if [ $# -lt 1 ]; then
+ for config in resources/libreboot/config/grub/*; do hackconfig "${config##*/}"; done
+else
+ for config in "${@}"; do hackconfig "${config}"; done
+fi
diff --git a/resources/scripts/helpers/build/config/corebootupdate b/resources/scripts/helpers/build/config/corebootupdate
index 64fcd75..6e612a8 100755
--- a/resources/scripts/helpers/build/config/corebootupdate
+++ b/resources/scripts/helpers/build/config/corebootupdate
@@ -25,27 +25,26 @@
[ "x${DEBUG+set}" = 'xset' ] && set -v
set -u -e
-cd "resources/libreboot/config/grub/"
+hackconfig () {
+ cd "coreboot/"
-if [ $# -lt 1 ]; then
- configs="$(for i in *; do printf "%s\n" "${i}"; done)"
-else
- configs="${*}"
-fi
-
-cd "../../../../coreboot/"
-for config in ${configs}; do
- printf "Updating config for %s\n" "${config}"
+ printf "Updating config for %s\n" "${1}"
sleep 2
- if [ ! -d "../resources/libreboot/config/grub/${config}/" ]; then
- printf "build/config/corebootupdate WARNING: config '%s' does not exist. Skipping.\n" "${config}"
- continue
+ if [ ! -d "../resources/libreboot/config/grub/${1}/" ]; then
+ printf "build/config/corebootupdate WARNING: config '%s' does not exist. Skipping.\n" "${1}"
+ return
fi
- mv "../resources/libreboot/config/grub/${config}/config" ".config"
+ mv "../resources/libreboot/config/grub/${1}/config" ".config"
make oldconfig
- mv ".config" "../resources/libreboot/config/grub/${config}/config"
-done
+ mv ".config" "../resources/libreboot/config/grub/${1}/config"
-cd "../"
+ cd "../"
+}
+
+if [ $# -lt 1 ]; then
+ for config in resources/libreboot/config/grub/*; do hackconfig "${config##*/}"; done
+else
+ for config in "${@}"; do hackconfig "${config}"; done
+fi