diff options
author | rudson <rudson@04377dda-e619-0410-9926-eae83683ac58> | 2007-04-10 03:09:32 +0000 |
---|---|---|
committer | rudson <rudson@04377dda-e619-0410-9926-eae83683ac58> | 2007-04-10 03:09:32 +0000 |
commit | 830071d7a3783f89adb1fa450fbbc83de54897e9 (patch) | |
tree | ae17ff467091bfae193b739fb2f508e56da8fd75 /trunk/utils/exec-slackbuild | |
parent | 6ff7619159dad5aa2bf914520ca2ca494ecb0819 (diff) | |
download | simplepkg-830071d7a3783f89adb1fa450fbbc83de54897e9.tar.gz simplepkg-830071d7a3783f89adb1fa450fbbc83de54897e9.tar.bz2 |
mkbuild: 0.9.17-2
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@330 04377dda-e619-0410-9926-eae83683ac58
Diffstat (limited to 'trunk/utils/exec-slackbuild')
-rwxr-xr-x | trunk/utils/exec-slackbuild | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/trunk/utils/exec-slackbuild b/trunk/utils/exec-slackbuild new file mode 100755 index 0000000..0d92f28 --- /dev/null +++ b/trunk/utils/exec-slackbuild @@ -0,0 +1,88 @@ +#!/bin/bash -x +# +# Script to execute SlackBuild and pass parameters +# +# by Rudson R. Alves +# +# Version 0.0.1 +PROG_VERSION=0.0.1 +LANG=en_US +BACK_TITLE="Exec SlackBuild $PROG_VERSION [$1]" + +if [ $# -ne 2 ]; then + echo "Use: exec-slackbuild <SlackBuild_script> <output_file>" + exit 0 +fi + +SLACKBUILD=$1 +AUX_TMP=$2 + +# Load slackbuildrc +if [ -f ~/.slackbuildrc ]; then + source ~/.slackbuildrc +elif [ -f /etc/slackbuildrc ]; then + source /etc/slackbuildrc +fi + +# set do default null variables +[ -z $SRC_DIR ] && SRC_DIR="default" +[ -z $REPOS ] && REPOS="default" +[ -z $TMP ] && TMP="default" +[ -z $ARCH ] && ARCH="default" +[ -z $CLEANUP ] && CLEANUP="default" +[ -z $NUMJOBS ] && NUMJOBS="default" +[ -z $BUILD ] && BUILD="default" +[ -z $CONF_OPTIONS ] && CONF_OPTIONS="default" + +# Edit variables +ANS=`dialog --separate-widget "rudson" --stdout --backtitle "$BACK_TITLE" \ + --title "Set variables" --form "Use down key to more variables; default = null argument; use \" to set several arguments." \ + 19 52 11 \ + "SRC_DIR:" 1 1 "$SRC_DIR" 1 15 30 60 \ + "REPOS:" 3 1 "$REPOS" 3 15 30 60 \ + "TMP:" 5 1 "$TMP" 5 15 30 60 \ + "ARCH:" 7 1 "$ARCH" 7 15 30 60 \ + "CLEANUP:" 9 1 "$CLEANUP" 9 15 30 60 \ + "NUMJOBS:" 11 1 "$NUMJOBS" 11 15 30 60 \ + "BUILD:" 13 1 "$BUILD" 13 15 30 60 \ + "CONF_OPTIONS:" 15 1 "$CONF_OPTIONS" 15 15 30 60` +[ $? -ne 0 ] && exit 11 + +# Remove "s + SRC_DIR=`echo $ANS | awk '{print $1}' | tr -d \"` + REPOS=`echo $ANS | awk '{print $2}' | tr -d \"` + TMP=`echo $ANS | awk '{print $3}' | tr -d \"` + ARCH=`echo $ANS | awk '{print $4}' | tr -d \"` + CLEANUP=`echo $ANS | awk '{print $5}' | tr -d \"` + NUMJOBS=`echo $ANS | awk '{print $6}' | tr -d \"` + BUILD=`echo $ANS | awk '{print $7}' | tr -d \"` +CONF_OPTIONS=`echo $ANS | awk '{print $8}' | tr -d \"` + +# Set to null ("") variables with default value + [ "$SRC_DIR" = "default" ] && SRC_DIR="" + [ "$REPOS" = "default" ] && REPOS="" + [ "$TMP" = "default" ] && TMP="" + [ "$ARCH" = "default" ] && ARCH="" + [ "$CLEANUP" = "default" ] && CLEANUP="" + [ "$NUMJOBS" = "default" ] && NUMJOBS="" + [ "$BUILD" = "default" ] && BUILD="" +[ "$CONF_OPTIONS" = "default" ] && CONF_OPTIONS="" + +# Select debug level +DEBUG=`dialog --stdout --backtitle "$BACK_TITLE" \ + --cancel-label "no debug" --title "$MK_TITLE" \ + --menu "Select debug level" 10 35 3 \ + "-x" "Simple debug" \ + "-xv" "More information" \ + "none" "No debug"` + +[ $? -ne 0 -o "$DEBUG" = "none" ] && DEBUG="" + +# Check sintax from SlackBuild +sh -n $SLACKBUILD || exit 11 + +# Execute SlackBuild in background +SRC_DIR="$SRC_DIR" REPOS="$REPOS" TMP="$TMP" ARCH="$ARCH" CLEANUP="$CLEANUP" NUMJOBS="$NUMJOBS" BUILD="$BUILD" CONF_OPTIONS="$CONF_OPTIONS" sh $DEBUG $SLACKBUILD > $AUX_TMP 2>&1 & PID=$! + +# Return pid from process +echo $PID |