summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2013-12-06 02:31:42 +0100
committerDave Reisner <dreisner@archlinux.org>2013-12-06 02:31:42 +0100
commitfe786a6b8d6cb82d972fd47b0033d5f42e00acdd (patch)
tree42754befcf4f2d80cd31d0a67d0e0761e9075f36
parent4d0d81aacf6ea5aaa3a7dd1d538203460b216963 (diff)
downloadmkinitcpio-fe786a6b8d6cb82d972fd47b0033d5f42e00acdd.tar.gz
mkinitcpio-fe786a6b8d6cb82d972fd47b0033d5f42e00acdd.tar.xz
prevent calling a preset from a preset
This is surely a configuration error as it's an infinite loop.
-rwxr-xr-xmkinitcpio7
1 files changed, 6 insertions, 1 deletions
diff --git a/mkinitcpio b/mkinitcpio
index 39aa4d9..cb94d62 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -241,6 +241,11 @@ process_preset() (
local preset=$1 preset_image= preset_options=
local -a preset_mkopts preset_cmd
+ if (( MKINITCPIO_PROCESS_PRESET )); then
+ error "You appear to be calling a preset from a preset. This is a configuration error."
+ cleanup 1
+ fi
+
# allow path to preset file, else resolve it in $_d_presets
if [[ $preset != */* ]]; then
printf -v preset '%s/%s.preset' "$_d_presets" "$preset"
@@ -287,7 +292,7 @@ process_preset() (
fi
msg2 "${preset_cmd[*]}"
- "$0" "${preset_cmd[@]}"
+ MKINITCPIO_PROCESS_PRESET=1 "$0" "${preset_cmd[@]}"
(( $? )) && ret=1
done