#!/bin/bash #installs from source with given mage-file # version: 0.3.6-r12 [ -z "$1" ] && echo "no mage-file given ..." && exit 1 MAGENAME=$1 SMSUFFIX=smage2 source /etc/mage.rc #cuts full pathnames or versioniezed names down to basename choppkgname(){ #we want this only if full name was used if [ -n "$(echo ${MAGENAME}|fgrep .mage)" ] then #cuts ARCH and PBUILD #ARCH comes from /etc/mage.rc #MAGENAME=$(echo ${MAGENAME} |sed -e "s:-${ARCH}-r*.::g") #MAGENAME=$(echo ${MAGENAME} |sed -e "s:-r*.::g") MAGENAME=$(basename ${MAGENAME%-*} .mage) #cuts version number MAGENAME=$(basename ${MAGENAME%-*} .mage) fi } choppkgname #VERSION=$(basename $1 .mage|sed -e "s:${MAGENAME}::g") #VERSION=$(echo ${VERSION#-*}|sed -e "s:-${ARCH}.*::g") #BUILD=$(basename $1 .mage|sed -e "s:${MAGENAME}::g" -e "s:-${VERSION}::g" -e "s:-${ARCH}-::g") VERSION=$(basename $1 .mage|sed -e "s:${MAGENAME}::g"|cut -d- -f2) BUILD=$(basename $1 .mage|sed -e "s:${MAGENAME}::g"|cut -d- -f3) echo M:${MAGENAME} echo V:${VERSION} echo B:${BUILD} #read SMAGEFILE=${SMAGESCRIPTSDIR}/${MAGENAME}/${MAGENAME}-${VERSION}-${BUILD}.${SMSUFFIX} if [ -e ${SMAGEFILE} ] then echo ${SMAGEFILE} else echo echo "$(basename ${SMAGEFILE}) not found." echo "update your smage-tree and try it again." echo exit 1 fi #starts package build smage2 ${SMAGEFILE} || exit 1 # sometimes we only want to build a package with its dependencies # but don't want to install it ... so it's decided here # with a global variable NOINSTALL=true¦TRUE¦yes¦y case ${NOINSTALL} in TRUE|true|yes|y) echo echo "NOINSTALL=true; Package will not be installed ..." echo sleep 1 ;; *) #installs package mage install ${MAGENAME} || exit 1 ;; esac #clean-up builddir if [ -d ${BUILDDIR} ] then rm -rf ${BUILDDIR}/* fi