summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2011-07-03 18:35:31 +0200
committerDave Reisner <dreisner@archlinux.org>2011-07-04 22:11:55 +0200
commitff1b729f956889973994dcc24eb208c7e99a014f (patch)
tree505d8279cda37fa69b560664d87e366d2a2b2758
parentab9e920b52ca2d178e174b04d89b3eec875deed7 (diff)
downloadmkinitcpio-ff1b729f956889973994dcc24eb208c7e99a014f.tar.gz
mkinitcpio-ff1b729f956889973994dcc24eb208c7e99a014f.tar.xz
unify error messaging, both in grammar and output
This also removes a superfluous check on MODULEDIR, which is already covered by get_kernver. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
-rw-r--r--functions8
-rwxr-xr-xmkinitcpio19
2 files changed, 14 insertions, 13 deletions
diff --git a/functions b/functions
index ffb00ec..ac0617c 100644
--- a/functions
+++ b/functions
@@ -162,7 +162,7 @@ add_module() {
done < <(modinfo -b "$BASEDIR" -k "$KERNELVERSION" -0 "$module" 2>/dev/null)
if [[ -z $path ]]; then
- error "module '$module' not found"
+ error "module not found: \`%s'" "$module"
return 1
fi
@@ -229,11 +229,11 @@ add_file() {
src=$BASEDIR$1
- [[ -f "$src" ]] || { error "$src: No such file"; return 1; }
+ [[ -f "$src" ]] || { error "file not found: \`%s'" "$src"; return 1; }
mode=$(stat -c %a "$src")
if [[ -z "$mode" ]]; then
- error "failed to stat file: \`$src'"
+ error "failed to stat file: \`%s'." "$src"
return 1
fi
@@ -251,7 +251,7 @@ add_binary() {
binary=$BASEDIR$1
- [[ -f "$binary" ]] || { error "$binary not found"; return 1; }
+ [[ -f "$binary" ]] || { error "file not found: \`%s'" "$binary"; return 1; }
dest=${2:-$binary}
mode=$(stat -c %a "$binary")
diff --git a/mkinitcpio b/mkinitcpio
index 434172e..0b2a573 100755
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -163,7 +163,7 @@ readonly NC BOLD BLUE GREEN RED YELLOW
if [[ $BASEDIR ]]; then
# resolve the path. it might be a relative path and/or contain symlinks
if ! pushd "$BASEDIR" &>/dev/null; then
- die "base directory '$BASEDIR' does not exist or is not a directory"
+ die "base directory does not exist or is not a directory: \`%s'" "$BASEDIR"
fi
BASEDIR=$(pwd -P)
BASEDIR=${BASEDIR%/}
@@ -172,13 +172,14 @@ fi
if [[ $optkver ]]; then
if ! KERNELVERSION=$(get_kernver "$optkver"); then
- die "'$optkver' is an invalid kernel specifier"
+ [[ ${optkver:0:1} == / ]] && optkver=$BASEDIR$optkver
+ die "invalid kernel specifier: \`%s'" "$optkver"
fi
fi
if [[ $TMPDIR ]]; then
if [[ ! -d $TMPDIR ]]; then
- error "'$TMPDIR' does not exist or is not a directory"
+ error "Temporary directory does not exist or is not a directory: \`%s'" "$TMPDIR"
unset TMPDIR
cleanup 1
fi
@@ -207,7 +208,7 @@ if [[ $PRESET ]]; then
if [[ ${!preset_kver:-$ALL_kver} ]]; then
preset_cmd+=(-k "${!preset_kver:-$ALL_kver}")
else
- warning "No kernel version specified. Skipping image '%s'" "$p"
+ warning "No kernel version specified. Skipping image \`%s'" "$p"
continue
fi
@@ -215,7 +216,7 @@ if [[ $PRESET ]]; then
if [[ ${!preset_config:-$ALL_config} ]]; then
preset_cmd+=(-c "$BASEDIR${!preset_config:-$ALL_config}")
else
- warning "No configuration file specified. Skipping image '%s'" "$p"
+ warning "No configuration file specified. Skipping image \`%s'" "$p"
continue
fi
@@ -223,7 +224,7 @@ if [[ $PRESET ]]; then
if [[ ${!preset_image} ]]; then
preset_cmd+=(-g "$BASEDIR${!preset_image}")
else
- warning "No image file specified. Skipping image '%s'" "$p"
+ warning "No image file specified. Skipping image \`%s'" "$p"
continue
fi
@@ -237,19 +238,19 @@ if [[ $PRESET ]]; then
done
cleanup 0
else
- die "Preset $PRESET does not exist. Exiting."
+ die "Preset not found: \`%s'" "$PRESET"
fi
fi
if [[ $GENIMG ]]; then
IMGPATH=$(readlink -f "$GENIMG")
if [[ -z $IMGPATH || ! -w ${IMGPATH%/*} ]]; then
- die "error: unable to write to path: '$GENIMG'"
+ die "error: unable to write to path: \`%s'" "$GENIMG"
fi
fi
if [[ ! -f "$CONFIG" ]]; then
- die "config file '$CONFIG' cannot be found, aborting..."
+ die "Config file does not exist: \`%s'" " $CONFIG"
fi
. "$CONFIG"