1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00

makepkg: ensure PKGBUILD does not contain CRLF characters

Do a simple check before sourcing the file to ensure we are a valid bash
script.

Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2008-12-06 23:32:34 -06:00
parent 69be73f68c
commit 818fae320f

View File

@ -1354,6 +1354,12 @@ if [ ! -f "$BUILDSCRIPT" ]; then
# PKGBUILD passed through a pipe # PKGBUILD passed through a pipe
BUILDSCRIPT=/dev/stdin BUILDSCRIPT=/dev/stdin
fi fi
else
crlftest=$(file $BUILDSCRIPT | grep -F 'CRLF' || true)
if [ "$crlftest" != "" ]; then
error "$(gettext "%s contains CRLF characters and cannot be sourced.")" "$BUILDSCRIPT"
exit 1
fi
fi fi
source "$BUILDSCRIPT" source "$BUILDSCRIPT"