diff options
-rw-r--r-- | src/createpkg | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/createpkg b/src/createpkg index 8118715..4280a7d 100644 --- a/src/createpkg +++ b/src/createpkg @@ -353,6 +353,25 @@ fi # Get SlackBuild script BUILD_SCRIPT="`find_script $PACKAGE`" +# Select one SlackBuild +if [ "`echo $BUILD_SCRIPT | wc -w`" -gt 1 ]; then + AUX="$PS3" + PS3="Choice: " + LIST=`echo $BUILD_SCRIPT | sed 's/ /\n/g' | sed -r 's/.*\/(.*)\.SlackBuild$/\1/'`" EXIT" + select PACKAGE in `echo $LIST`; do + break + done + if [ "$PACKAGE" = "EXIT" ]; then + echo -e "$CL_ERROR error: None package select $CL_OFF" + exit 1 + fi + # Select only one SlackBuild in BUILD_SCRIPT + BUILD_SCRIPT=`echo $BUILD_SCRIPT | sed 's/ /\n/g' | grep "/$PACKAGE.SlackBuild"` + PS3="$AUX" +else + PACKAGE=`echo $BUILD_SCRIPT | sed -r 's/.*\/(.*)\.SlackBuild$/\1/'` +fi + # Check SlackBuild script found if [ -z "$BUILD_SCRIPT" ]; then handle_error 5 $PACKAGE @@ -389,14 +408,18 @@ echo -e "$CL_MENSG $BASENAME: processing $SCRIPT_NAME $CL_OFF" # Built package cd $SCRIPT_BASE -INTERACT=no ./$SCRIPT_NAME +# Execute SlackBuild script with variables protection +( INTERACT=no ./$SCRIPT_NAME ) # Check if package was built handle_error $? $PACKAGE +PKG_TGZ="`ls -1 -c $REPOS/$PACKAGE-*-*-*tgz | head -n 1`" +mkdir -p $PKG_TGZ $REPOS/${SCRIPT_BASE/$BUILD_SCRIPT} + if [ "$INSTALL" == "1" ]; then # as we dont have the full package file name, we'll # use the newer file name that matches our wildcard: - PACKAGE="`ls -1 -c $REPOS/$PACKAGE-*-*-*tgz | head -n 1`" - upgradepkg --install-new $PACKAGE + + upgradepkg --install-new $PKG_TGZ fi |