]> gitweb.fluxo.info Git - simplepkg.git/commitdiff
mkbuild: 0.9.17-2
authorrudson <rudson@04377dda-e619-0410-9926-eae83683ac58>
Tue, 10 Apr 2007 03:09:32 +0000 (03:09 +0000)
committerrudson <rudson@04377dda-e619-0410-9926-eae83683ac58>
Tue, 10 Apr 2007 03:09:32 +0000 (03:09 +0000)
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@330 04377dda-e619-0410-9926-eae83683ac58

trunk/utils/exec-slackbuild [new file with mode: 0755]

diff --git a/trunk/utils/exec-slackbuild b/trunk/utils/exec-slackbuild
new file mode 100755 (executable)
index 0000000..0d92f28
--- /dev/null
@@ -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