diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 131519f..861fb1c 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -66,6 +66,7 @@ NODEPS=0 NOEXTRACT=0 RMDEPS=0 REPKG=0 ++QUESTION=0 LOGGING=0 SOURCEONLY=0 IGNOREARCH=0 @@ -1470,6 +1471,7 @@ usage() { echo "$(gettext " -m, --nocolor Disable colorized output messages")" echo "$(gettext " -o, --nobuild Download and extract files only")" printf "$(gettext " -p Use an alternate build script (instead of '%s')")\n" "$BUILDSCRIPT" + echo "$(gettext " -q, --question Just return zero if pacakge is already built, nonzero otherwise")" echo "$(gettext " -r, --rmdeps Remove installed dependencies after a successful build")" echo "$(gettext " -R, --repackage Repackage contents of the package without rebuilding")" echo "$(gettext " -s, --syncdeps Install missing dependencies with pacman")" @@ -1511,11 +1513,11 @@ fi ARGLIST=("$@") # Parse Command Line Options. -OPT_SHORT="AcCdefFghiLmop:rRsV" -OPT_LONG="allsource,asroot,ignorearch,clean,cleancache,nodeps" -OPT_LONG="$OPT_LONG,noextract,force,forcever:,geninteg,help,holdver" -OPT_LONG="$OPT_LONG,install,log,nocolor,nobuild,pkg:,rmdeps,repackage,skipinteg" -OPT_LONG="$OPT_LONG,source,syncdeps,version,config:" +OPT_SHORT="AcCdefFghiLmop:qrRsV" +OPT_LONG="allsource,asroot,ignorearch,clean,cleancache,config:,force" +OPT_LONG="$OPT_LONG,force,forcever:,geninteg,help,holdver,install,log" +OPT_LONG="$OPT_LONG,nodeps,noextract,nocolor,nobuild,pkg:,question" +OPT_LONG="$OPT_LONG,rmdeps,repackage,skipinteg,source,syncdeps,version" # Pacman Options OPT_LONG="$OPT_LONG,noconfirm,noprogressbar" OPT_TEMP="$(parse_options $OPT_SHORT $OPT_LONG "$@" || echo 'PARSE_OPTIONS FAILED')" @@ -1552,6 +1554,7 @@ while true; do -m|--nocolor) USE_COLOR='n' ;; -o|--nobuild) NOBUILD=1 ;; -p) shift; BUILDFILE=$1 ;; + -q|--question) QUESTION=1 ;; --pkg) shift; PKGLIST=$1 ;; -r|--rmdeps) RMDEPS=1 ;; -R|--repackage) REPKG=1 ;; @@ -1777,6 +1780,9 @@ if (( ! SPLITPKG )); then if [[ -f $PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT} \ || -f $PKGDEST/${pkgname}-${pkgver}-${pkgrel}-any${PKGEXT} ]] \ && ! (( FORCE || SOURCEONLY || NOBUILD )); then + if (( QUESTION )); then + exit 0 + fi if (( INSTALL )); then warning "$(gettext "A package has already been built, installing existing package...")" install_package @@ -1799,6 +1805,9 @@ else done if ! (( FORCE || SOURCEONLY || NOBUILD )); then if (( allpkgbuilt )); then + if (( QUESTION )); then + exit 0 + fi if (( INSTALL )); then warning "$(gettext "The package group has already been built, installing existing packages...")" install_package @@ -1816,6 +1825,10 @@ else unset allpkgbuilt somepkgbuilt fi +if (( QUESTION )); then + exit 1 +fi + # Run the bare minimum in fakeroot if (( INFAKEROOT )); then if (( ! SPLITPKG )); then