[pacman-dev] [PATCH] [makepkg] use double brackets
Andres P
aepd87 at gmail.com
Sat May 22 01:06:51 EDT 2010
Signed-off-by: Andres P <aepd87 at gmail.com>
---
scripts/makepkg.sh.in | 32 ++++++++++++++++----------------
1 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 1707245..be076a7 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -345,7 +345,7 @@ download_file() {
run_pacman() {
local ret=0
if (( ! ASROOT )) && [[ $1 != "-T" && $1 != "-Qq" ]]; then
- if [ "$(type -p sudo)" ] && sudo -l $PACMAN &>/dev/null; then
+ if [[ $(type -p sudo) ]] && sudo -l $PACMAN &>/dev/null; then
sudo $PACMAN $PACMAN_OPTS "$@" || ret=$?
else
su -c "$PACMAN $PACMAN_OPTS $*" || ret=$?
@@ -519,7 +519,7 @@ generate_checksums() {
msg "$(gettext "Generating checksums for source files...")"
plain ""
- if [ ! $(type -p openssl) ]; then
+ if [[ ! $(type -p openssl) ]]; then
error "$(gettext "Cannot find openssl.")"
exit 1 # $E_MISSING_PROGRAM
fi
@@ -580,7 +580,7 @@ generate_checksums() {
check_checksums() {
(( ! ${#source[@]} )) && return 0
- if [ ! $(type -p openssl) ]; then
+ if [[ ! $(type -p openssl) ]]; then
error "$(gettext "Cannot find openssl.")"
exit 1 # $E_MISSING_PROGRAM
fi
@@ -1296,7 +1296,7 @@ check_sanity() {
if (( ${#pkgname[@]} > 1 )); then
for pkg in ${pkgname[@]}; do
- if [ "$(type -t package_${pkg})" != "function" ]; then
+ if [[ $(type -t package_${pkg}) != "function" ]]; then
error "$(gettext "missing package function for split package '%s'")" "$pkg"
return 1
fi
@@ -1333,27 +1333,27 @@ devel_check() {
# Also do a brief check to make sure we have the VCS tool available.
oldpkgver=$pkgver
if [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] ; then
- [ $(type -p darcs) ] || return 0
+ [[ $(type -p darcs) ]] || return 0
msg "$(gettext "Determining latest darcs revision...")"
newpkgver=$(date +%Y%m%d)
elif [[ -n ${_cvsroot} && -n ${_cvsmod} ]] ; then
- [ $(type -p cvs) ] || return 0
+ [[ $(type -p cvs) ]] || return 0
msg "$(gettext "Determining latest cvs revision...")"
newpkgver=$(date +%Y%m%d)
elif [[ -n ${_gitroot} && -n ${_gitname} ]] ; then
- [ $(type -p git) ] || return 0
+ [[ $(type -p git) ]] || return 0
msg "$(gettext "Determining latest git revision...")"
newpkgver=$(date +%Y%m%d)
elif [[ -n ${_svntrunk} && -n ${_svnmod} ]] ; then
- [ $(type -p svn) ] || return 0
+ [[ $(type -p svn) ]] || return 0
msg "$(gettext "Determining latest svn revision...")"
newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p')
elif [[ -n ${_bzrtrunk} && -n ${_bzrmod} ]] ; then
- [ $(type -p bzr) ] || return 0
+ [[ $(type -p bzr) ]] || return 0
msg "$(gettext "Determining latest bzr revision...")"
newpkgver=$(bzr revno ${_bzrtrunk})
elif [[ -n ${_hgroot} && -n ${_hgrepo} ]] ; then
- [ $(type -p hg) ] || return 0
+ [[ $(type -p hg) ]] || return 0
msg "$(gettext "Determining latest hg revision...")"
if [[ -d ./src/$_hgrepo ]] ; then
cd ./src/$_hgrepo
@@ -1555,7 +1555,7 @@ There is NO WARRANTY, to the extent permitted by law.\n")"
# PROGRAM START
# determine whether we have gettext; make it a no-op if we do not
-if [ ! $(type -t gettext) ]; then
+if [[ ! $(type -t gettext) ]]; then
gettext() {
echo "$@"
}
@@ -1729,7 +1729,7 @@ if (( ! INFAKEROOT )); then
plain "$(gettext "Please rerun makepkg without the --asroot flag.")"
exit 1 # $E_USER_ABORT
elif [[ $(check_buildenv fakeroot) = "y" ]] && (( EUID > 0 )); then
- if [ ! $(type -p fakeroot) ]; then
+ if [[ ! $(type -p fakeroot) ]]; then
error "$(gettext "Fakeroot must be installed if using the 'fakeroot' option")"
plain "$(gettext "in the BUILDENV array in %s.")" "$MAKEPKG_CONF"
exit 1
@@ -1749,7 +1749,7 @@ fi
# check for sudo if we will need it during makepkg execution
if (( ! ( ASROOT || INFAKEROOT ) && ( DEP_BIN || RMDEPS || INSTALL ) )); then
- if [ ! "$(type -p sudo)" ]; then
+ if [[ ! $(type -p sudo) ]]; then
warning "$(gettext "Sudo can not be found. Will use su to acquire root privileges.")"
fi
fi
@@ -1810,9 +1810,9 @@ fi
if [[ $(! type -t build) = "function" ]]; then
BUILDFUNC=1
fi
-if [ "$(type -t package)" = "function" ]; then
+if [[ $(type -t package) = "function" ]]; then
PKGFUNC=1
-elif [ $SPLITPKG -eq 0 -a "$(type -t package_${pkgname})" = "function" ]; then
+elif [[ $SPLITPKG -eq 0 && $(type -t package_${pkgname}) = "function" ]]; then
SPLITPKG=1
fi
@@ -1921,7 +1921,7 @@ if (( NODEPS || ( (NOBUILD || REPKG) && !DEP_BIN ) )); then
if (( NODEPS || ( REPKG && PKGFUNC ) )); then
warning "$(gettext "Skipping dependency checks.")"
fi
-elif [ $(type -p "${PACMAN%% *}") ]; then
+elif [[ $(type -p "${PACMAN%% *}") ]]; then
if (( RMDEPS )); then
original_pkglist=($(run_pacman -Qq | sort)) # required by remove_dep
fi
--
1.7.1
More information about the pacman-dev
mailing list