Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorCarlo Bersani <carlocci@gmail.com>2008-06-22 21:21:05 -0500
committerDan McGee <dan@archlinux.org>2008-06-22 21:21:05 -0500
commitb15fb504a19831200b86a43646d8def89560b61c (patch)
tree8ed3e0e77307e6921b97e7b02e566c23d34aa875 /contrib
parent74eb2f5c6132b0529dd22b33a14232e7059551c1 (diff)
bacman: fix issue with symlink early copy
test -e tries to resolve the link before testing, so if the link is copied before the actual file, the script exited. This fixes the issue. [Dan: also add some improved quoting in the script] Signed-off-by: Carlo Bersani <carlocci@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/bacman19
1 files changed, 10 insertions, 9 deletions
diff --git a/contrib/bacman b/contrib/bacman
index 410482f4..95b362ed 100755
--- a/contrib/bacman
+++ b/contrib/bacman
@@ -111,7 +111,7 @@ fi
#
echo Package: ${pkg_namver}
work_dir=$(mktemp -d -p /tmp)
-cd $work_dir || exit 1
+cd "$work_dir" || exit 1
#
# File copying
@@ -136,12 +136,12 @@ while read i; do
bsdtar -cnf - "/$i" 2> /dev/null | bsdtar -xpf -
# Workaround to bsdtar not reporting a missing file as an error
- if [ ! -e "$work_dir"/"$i" ]; then
+ if [ ! -e "$work_dir/$i" ] && [ -L "$work_dir/$i"]; then
echo ""
echo "ERROR: unable to add /$i to the package"
echo " If your user does not have permssion to read this file then"
echo " you will need to run $progname as root"
- rm -rf $work_dir
+ rm -rf "$work_dir"
exit 1
fi
else
@@ -157,7 +157,7 @@ done
ret=$?
if [ $ret -ne 0 ]; then
- rm -rf $work_dir
+ rm -rf "$work_dir"
exit 1
fi
@@ -256,8 +256,8 @@ done
#
# Fixes owner:group and permissions for .PKGINFO, .CHANGELOG, .INSTALL
#
-chown root:root $work_dir/{.PKGINFO,.CHANGELOG,.INSTALL} 2> /dev/null
-chmod 644 $work_dir/{.PKGINFO,.CHANGELOG,.INSTALL} 2> /dev/null
+chown root:root "$work_dir"/{.PKGINFO,.CHANGELOG,.INSTALL} 2> /dev/null
+chmod 644 "$work_dir"/{.PKGINFO,.CHANGELOG,.INSTALL} 2> /dev/null
#
# Generate the package
@@ -269,14 +269,15 @@ bsdtar -czf "$pkg_dest/$pkg_namver-$pkg_arch.tar.gz" $(ls -A) || ret=$?
if [ $ret -ne 0 ]; then
echo "ERROR: unable to write package to $pkg_dest"
echo " Maybe the disk is full or you do not have write access"
- rm -rf $work_dir
+ rm -rf "$work_dir"
exit 1
fi
-rm -rf $work_dir
+rm -rf "$work_dir"
echo Done
exit 0
-# vim: set ts=2 sw=2 noet: \ No newline at end of file
+# vim: set ts=2 sw=2 noet:
+