Use shell builtin to list files for package inclusion

On BSD systems, as super user, the 'ls' command displays all dot files by
default, causing these to get included when not intended. If we use the bash
glob operator, we can avoid issues with ls on different platforms; however,
we need to turn the nullglob shell option on first to ensure we don't have
problems in empty directories.

Originally-noticed-by: Sebastian Nowicki <sebnow@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dan McGee 2008-06-12 19:06:14 -05:00
parent 1824bc6ee6
commit 7fc306cd41
1 changed files with 5 additions and 1 deletions

View File

@ -36,6 +36,10 @@ export TEXTDOMAINDIR='@localedir@'
# file -i does not work on Mac OSX unless legacy mode is set
export COMMAND_MODE='legacy'
# when fileglobbing, we want * in an empty directory to expand to the null
# string rather than itself
shopt -s nullglob
myver='@PACKAGE_VERSION@'
confdir='@sysconfdir@'
startdir="$PWD"
@ -849,7 +853,7 @@ create_package() {
local pkg_file="$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
if ! bsdtar -czf "$pkg_file" $comp_files $(ls); then
if ! bsdtar -czf "$pkg_file" $comp_files *; then
error "$(gettext "Failed to create package file.")"
exit 1 # TODO: error code
fi