summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <d@falconindy.com>2011-06-13 03:41:49 +0200
committerThomas Bächler <thomas@archlinux.org>2011-06-25 12:25:45 +0200
commit733afaaa9c52e55d047d5e6a5d689131e1fde3e6 (patch)
tree633bac5cb1e5d54adffabeaa8e57e5e53f70dd8b
parent8ca2543c17819e754d2ebf467acfc65a636d25f2 (diff)
downloadmkinitcpio-733afaaa9c52e55d047d5e6a5d689131e1fde3e6.tar.gz
mkinitcpio-733afaaa9c52e55d047d5e6a5d689131e1fde3e6.tar.xz
mkinitcpio: allow absolute paths to preset files
Signed-off-by: Dave Reisner <d@falconindy.com>
-rwxr-xr-xmkinitcpio8
1 files 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[@]}")