diff options
author | Dave Reisner <dreisner@archlinux.org> | 2012-09-01 22:11:54 +0200 |
---|---|---|
committer | Dave Reisner <dreisner@archlinux.org> | 2012-09-01 22:11:54 +0200 |
commit | c0b975a8e3efacd965ec5166af4d572253f51143 (patch) | |
tree | 965b103b2f146583d837f264e7082817e8e0b35f | |
parent | 8291fd0f3965fa7ea2790d17d2e53c8b9c252863 (diff) | |
download | mkinitcpio-c0b975a8e3efacd965ec5166af4d572253f51143.tar.gz mkinitcpio-c0b975a8e3efacd965ec5166af4d572253f51143.tar.xz |
mkinitcpio: refuse to run if image path isn't writeable
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
-rwxr-xr-x | mkinitcpio | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -323,6 +323,13 @@ fi if [[ -z $GENIMG ]]; then msg "Starting dry run: %s" "$KERNELVERSION" else + # check for permissions. if the image doesn't already exist, + # then check the directory + if [[ ( -e $GENIMG && ! -w $GENIMG ) || + ( ! -d ${GENIMG%/*} || ! -w ${GENIMG%/*} ) ]]; then + die 'Unable to write to %s' "$GENIMG" + fi + COMPRESSION=${optcompress:-$COMPRESSION} if ! type -P "$COMPRESSION" >/dev/null; then die "Unable to locate compression method: %s" "$COMPRESSION" |