Commit 7952d6fb authored by Lukas Fleischer's avatar Lukas Fleischer Committed by Pierre Schmitz
Browse files

checkpkg: Avoid unnecessary use of grep(1)/basename(1)



Use parameter expansion instead of invoking external binaries here.

Signed-off-by: default avatarLukas Fleischer <archlinux@cryptocrack.de>
Signed-off-by: default avatarPierre Schmitz <pierre@archlinux.de>
parent 3c175e98
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -52,14 +52,14 @@ for _pkgname in "${pkgname[@]}"; do

	oldpkg=${pkgurl##*://*/}

	if [[ "$(basename $oldpkg)" = "$(basename $pkgfile)" ]]; then
	if [[ ${oldpkg##*/} = ${pkgfile##*/} ]]; then
		echo "The built package ($_pkgname) is the one in the repo right now!"
		exit 1
	fi

	if [[ ! -f $oldpkg ]]; then
		if echo $pkgurl | grep '^file:///' > /dev/null 2>&1; then
			ln -s "${pkgurl#file://}" $(basename "${pkgurl#file://}")
		if [[ $pkgurl = file://* ]]; then
			ln -s "${pkgurl#file://}" "${pkgurl##file://*/}"
		elif [[ -f "$PKGDEST/$oldpkg" ]]; then
			ln -s "$PKGDEST/$oldpkg" "$oldpkg"
		elif [[ -f "$STARTDIR/$oldpkg" ]]; then