add check for deps packages and REBUILD var

Signed-off-by: Ryan P.C. McQuen <ryan.q@linux.com>
pull/1/head
Ryan P.C. McQuen 9 years ago
parent 5a81270508
commit de2dd59167

@ -27,11 +27,18 @@
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# These need set here: # These need to be set here:
INST=1 INST=1
TMP=${TMP:-/tmp} TMP=${TMP:-/tmp}
ROOT=$(pwd) ROOT=$(pwd)
## Allow a rebuild of all dependencies,
## even if they are already installed.
##
## Run:
## REBUILD=yes ./build-deps.sh
REBUILD=${REBUILD:-no}
# Loop for all packages # Loop for all packages
for dir in \ for dir in \
Deps/GraphicsMagick \ Deps/GraphicsMagick \
@ -48,27 +55,31 @@ for dir in \
# Get the package name # Get the package name
package=$(echo $dir | cut -f2- -d /) package=$(echo $dir | cut -f2- -d /)
# Change to package directory if [ -z "`find /var/log/packages/ -name *$package-*`" ] || [ "${REBUILD}" = "yes" ]; then
cd $ROOT/$dir || exit 1 # Change to package directory
cd $ROOT/$dir || exit 1
# Get the version # Get the version
version=$(cat ${package}.SlackBuild | grep "VERSION:" | head -n1 | cut -d "-" -f2 | rev | cut -c 2- | rev) version=$(cat ${package}.SlackBuild | grep "VERSION:" | head -n1 | cut -d "-" -f2 | rev | cut -c 2- | rev)
# Get the build # Get the build
build=$(cat ${package}.SlackBuild | grep "BUILD:" | cut -d "-" -f2 | rev | cut -c 2- | rev) build=$(cat ${package}.SlackBuild | grep "BUILD:" | cut -d "-" -f2 | rev | cut -c 2- | rev)
# The real build starts here # The real build starts here
sh ${package}.SlackBuild || exit 1 sh ${package}.SlackBuild || exit 1
if [ "$INST" = "1" ]; then if [ "$INST" = "1" ]; then
PACKAGE=`ls --color=never $TMP/${package}-${version}-*-${build}*.txz` PACKAGE=`ls --color=never $TMP/${package}-${version}-*-${build}*.txz`
if [ -f "$PACKAGE" ]; then if [ -f "$PACKAGE" ]; then
upgradepkg --install-new --reinstall "$PACKAGE" upgradepkg --install-new --reinstall "$PACKAGE"
else else
echo "Error: package to upgrade "$PACKAGE" not found in $TMP" echo "Error: package to upgrade "$PACKAGE" not found in $TMP"
exit 1 exit 1
fi
fi fi
fi
# back to original directory # back to original directory
cd $ROOT cd $ROOT
else
echo "$package already installed."
fi
done done

Loading…
Cancel
Save