#!/bin/bash OUTPUT=${OUTPUT:-/tmp} if [ -z "$ARCH" ]; then case "$( uname -m )" in i?86) ARCH=i486 ;; arm*) ARCH=arm ;; *) ARCH=$( uname -m ) ;; esac fi # if no package name, see if we're in a SlackBuild dir. # if so, build a package if one doesn't exist in $OUTPUT. # either way, install the package for the current dir. if [ -z "$@" ]; then pkgname=$(basename `pwd`) if [ ! -e "$pkgname.info" ]; then echo "not in a proper SlackBuild dir and no package given, bailing" 1>&2 exit 1 fi source ./$pkgname.info if [ -z "$PRGNAM" -o -z "$VERSION" ]; then echo "bad/incomplete .info file, bailing" 1>&2 exit 1 fi if [ "$PRGNAM" != "$pkgname" ]; then echo "bad PRGNAM=$PRGNAM in $pkgname.info" exit 1 fi for myarch in noarch "$ARCH"; do myglob="$OUTPUT/$PRGNAM-$VERSION-$myarch*t?z" myfile=$( echo $myglob ) if [ "$myglob" = "$myfile" ]; then : # do naught elif [ "$( /bin/ls $myfile 2>/dev/null | wc -l )" -gt "1" ]; then echo "Multiple packages match, not installing anything:" /bin/ls $myfile exit 1 else if [ -n "$found" ]; then echo "Multiple packages/arches, not installing anything:" echo $myfile $found exit 1 else found=$myfile echo found $found fi fi done if [ -z "$found" ]; then #echo "No package in $OUTPUT, building" #sudo ./$pkgname.SlackBuild && exec $0 echo "No package in $OUTPUT, build one!" exit 1 fi set "$found" fi sudo upgradepkg --reinstall --install-new "$@"