From 733afaaa9c52e55d047d5e6a5d689131e1fde3e6 Mon Sep 17 00:00:00 2001 From: Dave Reisner Date: Sun, 12 Jun 2011 21:41:49 -0400 Subject: mkinitcpio: allow absolute paths to preset files Signed-off-by: Dave Reisner --- mkinitcpio | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mkinitcpio b/mkinitcpio index 0cc6f50..85e81b2 100755 --- a/mkinitcpio +++ b/mkinitcpio @@ -175,13 +175,17 @@ declare BUILDROOT=$TMPDIR/root # use preset $PRESET if [[ $PRESET ]]; then - if [[ -f "$PRESETDIR/$PRESET.preset" ]]; then + # allow absolute path to preset file, else resolve it + if [[ "${PRESET:0:1}" != '/' ]]; then + printf -v PRESET '%s/%s.preset' "$PRESETDIR" "$PRESET" + fi + if [[ -f "$PRESET" ]]; then # Use -b, -m and -v options specified earlier declare -a preset_mkopts preset_cmd [[ $BASEDIR ]] && preset_mkopts+=(-b "$BASEDIR") (( QUIET )) || preset_mkopts+=(-v) # Build all images - . "$PRESETDIR/$PRESET.preset" + . "$PRESET" for p in "${PRESETS[@]}"; do msg "Building image from preset: '$p'" preset_cmd=("${preset_mkopts[@]}") -- cgit v1.2.3-24-g4f1b