diff options
Diffstat (limited to 'trunk')
-rw-r--r-- | trunk/src/createpkg | 47 |
1 files changed, 31 insertions, 16 deletions
diff --git a/trunk/src/createpkg b/trunk/src/createpkg index e87b37a..03612a9 100644 --- a/trunk/src/createpkg +++ b/trunk/src/createpkg @@ -17,7 +17,7 @@ # # /etc/simplepkg/slackbuildrc parameters: # -# SLACKBUILDS="/folder/to/place/slackbuilds", defaults to /var/slackbuilds +# SLACKBUILDS_DIR="/folder/to/place/slackbuilds", defaults to /var/slackbuilds # SVN="svn://repository", defaults do svn://slack.sarava.org/slackbuilds # SYNC="yes|no", whether to always update the repository # @@ -31,7 +31,7 @@ # Createpkg functions #--------------------------------------------------- -CREATEPKG_VERSION="1.0.4" +CREATEPKG_VERSION="1.0.5" function error_codes { @@ -130,11 +130,11 @@ function handle_error { function build_repo { # Checkout a new slackbuild working copy - BASEDIR="`dirname $SLACKBUILDS`" + BASEDIR="`dirname $SLACKBUILDS_DIR`" mkdir -p $BASEDIR || handle_error 4 $BASEDIR cd $BASEDIR svn checkout $SVN - cd $SLACKBUILDS + cd $SLACKBUILDS_DIR } @@ -160,14 +160,15 @@ function check_config { [ ! -e $TPM ] && mkdir $TMP [ ! -e $REPOS ] && mkdir $REPOS # - SLACKBUILDS=${SLACKBUILDS:=/var/slackbuilds} + SLACKBUILDS_DIR=${SLACKBUILDS_DIR:=/var/slackbuilds} SVN=${SVN:=svn://slack.sarava.org/slackbuilds} SYNC=${SYNC:=no} - BASEDIR="`dirname $SLACKBUILDS`" + BASEDIR="`dirname $SLACKBUILDS_DIR`" } function solve_dep { + # Solve dependency local PACK="$1" local COND="$2" @@ -211,14 +212,14 @@ function solve_dep { function check_repo { # Verify if repository exist - [ ! -d "$SLACKBUILDS" ] && build_repo + [ ! -d "$SLACKBUILDS_DIR" ] && build_repo } function sync_repo { # Synchronize repository - cd $SLACKBUILDS + cd $SLACKBUILDS_DIR svn update || build_repo #simplaret --update @@ -227,7 +228,7 @@ function sync_repo { function find_slackbuild { # Find SlackBuild script in the repository - find $SLACKBUILDS -iname $1.SlackBuild + find $SLACKBUILDS_DIR -iname $1.SlackBuild } @@ -261,7 +262,7 @@ function info_builds { function list_builds { # List all available SlackBuilds - cd $SLACKBUILDS + cd $SLACKBUILDS_DIR echo "Sarava SlackBuilds list" # level 1 for i in *; do @@ -295,9 +296,11 @@ function list_builds { ) fi done + } function color_select { + # Select color mode: gray, color or none (*) # commun - Communication # messag - Commum messages @@ -326,6 +329,7 @@ function color_select { normal="" ;; esac + } #--------------------------------------------------- @@ -426,13 +430,16 @@ 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 eecho $error "error: None package select" exit 1 fi + # Select only one SlackBuild in BUILD_SCRIPT BUILD_SCRIPT=`echo $BUILD_SCRIPT | sed 's/ /\n/g' | grep "/$PACKAGE.SlackBuild"` PS3="$AUX" @@ -475,18 +482,26 @@ fi eecho $messag "$BASENAME: processing $SCRIPT_NAME" -# Built package +# Change to script base directory cd $SCRIPT_BASE + +# Select repository directory +NEW_REPOS=$REPOS/$( echo ${SCRIPT_BASE#$SLACKBUILDS_DIR/} ) + +# Create repository directory +[ ! -e $NEW_REPOS ] && mkdir -p $NEW_REPOS 2>/dev/null + + +# Remove old-versions +rm $NEW_REPOS/$PACKAGE-*-*-*.tgz 2>/dev/null + # Execute SlackBuild script with variables protection -( INTERACT=no sh ./$SCRIPT_NAME ) +( INTERACT=no REPOS=$NEW_REPOS sh ./$SCRIPT_NAME ) # Check if package was built handle_error $? $PACKAGE -PKG_TGZ="`ls -1 -c $REPOS/$PACKAGE-*-*-*tgz | head -n 1`" - -#mkdir -p $REPOS${SCRIPT_BASE/$SLACKBUILDS} -#mv $PKG_TGZ $REPOS${SCRIPT_BASE/$SLACKBUILDS}/ +PKG_TGZ="`ls -1 -c $NEW_REPOS/$PACKAGE-*-*-*.tgz | head -n 1`" if [ "$INSTALL" == "1" ]; then # as we dont have the full package file name, we'll |