diff options
author | rudson <rudson@04377dda-e619-0410-9926-eae83683ac58> | 2007-02-21 18:15:53 +0000 |
---|---|---|
committer | rudson <rudson@04377dda-e619-0410-9926-eae83683ac58> | 2007-02-21 18:15:53 +0000 |
commit | 5766b720266124946b21a70958ffa2391d9999e4 (patch) | |
tree | 6fcfee80c0022696194a1ee1ef8961414c25cebe | |
parent | efefb222154d68efebd881e3e35cd18cfe77a59f (diff) | |
download | simplepkg-5766b720266124946b21a70958ffa2391d9999e4.tar.gz simplepkg-5766b720266124946b21a70958ffa2391d9999e4.tar.bz2 |
mkslackbuild-0.9.5: melhorado o tratamento de erro e escapes
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@192 04377dda-e619-0410-9926-eae83683ac58
-rwxr-xr-x | trunk/utils/mkslackbuild | 81 |
1 files changed, 50 insertions, 31 deletions
diff --git a/trunk/utils/mkslackbuild b/trunk/utils/mkslackbuild index 2a7c0c2..e23bdba 100755 --- a/trunk/utils/mkslackbuild +++ b/trunk/utils/mkslackbuild @@ -9,7 +9,7 @@ # Slackbuilds são scripts utilizados no Slackware para gerar # pacotes tgz. # -# Version 0.9.3 +# Version 0.9.5 # #-------------------------------------------------------------------- # Functions @@ -127,8 +127,8 @@ function unpkg_source() # FIXME: if MK_DECOMPRESSOR -ne bunzip2 or gunzip... if [ $MK_DECOMPRESSOR = "bunzip2" -o $MK_DECOMPRESSOR = "gunzip" ]; then dialog --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" \ - --infobox "Uncompress source in /tmp/$MK_PKGNAME. Wait" 3 45 - [ $? -ne 0 ] && mk_exit 0 + --cancel-label "Main Menu" --infobox "Uncompress source in /tmp/$MK_PKGNAME. Wait" 3 45 + [ $? -ne 0 ] && return 100 mkdir /tmp/$MK_PKGNAME/ 2>/dev/null tar xvf $MK_SOURCE -C /tmp/$MK_PKGNAME/ 1>/dev/null [ $? -ne 0 ] && mk_exit 1 @@ -160,8 +160,8 @@ function select_source() MK_SOURCE=$BASEDIR while [ ! -f $MK_SOURCE ]; do MK_SOURCE=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" \ - --title " Select source file name (use spaces to select): " --fselect "$MK_SOURCE" 10 70` - [ $? -ne 0 ] && mk_exit + --cancel-label "Main Menu" --title " Select source file name (use spaces to select): " --fselect "$MK_SOURCE" 10 70` + [ $? -ne 0 ] && return 100 if [ ! -f $MK_SOURCE ]; then MK_SOURCE="$MK_SOURCE/" fi @@ -189,8 +189,8 @@ function edit_author() # Edit source URL function edit_url() { - MK_URL=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" --inputbox "Enter with complite URL from source:" 8 60 "$MK_URL"` - [ $? -ne 0 ] && mk_exit 0 + MK_URL=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" --cancel-label "Main Menu" --inputbox "Enter with complite URL from source:" 8 60 "$MK_URL"` + [ $? -ne 0 ] && return 100 } # Edit source name @@ -198,29 +198,32 @@ function edit_source_name() { # Carrega nome do arquivo MK_SRCNAME=`basename $MK_URL` - MK_SRCNAME=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" --inputbox "Enter with source file name:" 8 60 "$MK_SRCNAME"` - [ $? -ne 0 ] && mk_exit 0 + MK_SRCNAME=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" --cancel-label "Main Menu" --inputbox "Enter with complite source file name:" 8 60 "$MK_SRCNAME"` + [ $? -ne 0 ] && return 100 } # Edit MK_PKGNAME, MK_VERSION and MK_EXTENSION function edit_pkgname() { # Remove nome, versão e extensão do nome da fonte - MK_PKGNAME=`echo $MK_SRCNAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\1/' | tr [A-Z] [a-z]` + MK_SRC_NAME=`echo $MK_SRCNAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\1/'` + MK_PKGNAME=`echo $MK_SRC_NAME | tr [A-Z] [a-z]` MK_VERSION=`echo $MK_SRCNAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\2/'` MK_EXTENSION=`echo $MK_SRCNAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\3/'` # Configura nome, versão e extensão do pacote ANS=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" \ - --form "Check information below:" 12 70 5 \ - "Package name:" 1 1 "$MK_PKGNAME" 1 15 30 60 \ - "Version:" 3 1 "$MK_VERSION" 3 15 30 100 \ - "Extension:" 5 1 "$MK_EXTENSION" 5 15 30 8` - [ $? -ne 0 ] && mk_exit 0 + --cancel-label "Main Menu" --form "Check information below:" 14 52 7 \ + "Source name:" 1 1 "$MK_SRC_NAME" 1 15 30 60 \ + "Package name:" 3 1 "$MK_PKGNAME" 3 15 30 60 \ + "Version:" 5 1 "$MK_VERSION" 5 15 30 60 \ + "Extension:" 7 1 "$MK_EXTENSION" 7 15 30 60` + [ $? -ne 0 ] && return 100 - MK_PKGNAME=`echo $ANS | awk '{print $1}'` - MK_VERSION=`echo $ANS | awk '{print $2}'` - MK_EXTENSION=`echo $ANS | awk '{print $3}'` + MK_SRC_NAME=`echo $ANS | awk '{print $1}'` + MK_PKGNAME=`echo $ANS | awk '{print $2}'` + MK_VERSION=`echo $ANS | awk '{print $3}'` + MK_EXTENSION=`echo $ANS | awk '{print $4}'` } # Edit MK_DECOMPRESSOR and MK_DECOMPRESSOR_TEST_FLAG @@ -232,10 +235,10 @@ function edit_decompress_arg() # Configura nome, versão e extensão do pacote ANS3=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" \ - --form "Check information below:" 10 55 3 \ + --cancel-label "Main Menu" --form "Check information below:" 10 55 3 \ "Uncompress program:" 1 1 "$MK_DECOMPRESSOR" 1 23 25 60 \ "Uncompress test flag:" 3 1 "$MK_DECOMPRESSOR_TEST_FLAG" 3 23 25 100` - [ $? -ne 0 ] && mk_exit 0 + [ $? -ne 0 ] && return 100 MK_DECOMPRESSOR=`echo $ANS3 | awk '{print $1}'` MK_DECOMPRESSOR_TEST_FLAG=`echo $ANS3 | awk '{print $2}'` @@ -256,13 +259,12 @@ function edit_configure() local ANS1="7" while [ $ANS1 -ne 0 ]; do ANS1=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" \ - --menu "Select one option" 0 0 0 \ + --cancel-label "Continue" --menu "Select one option" 0 0 0 \ 1 "View ./configure help" \ 2 "View documentations" \ 3 "PREFIX=$MK_PREFIX" \ 4 "OPTIONS=$MK_OPTIONS" \ 0 "Continue"` - [ $? -ne 0 ] && mk_exit case $ANS1 in '1') @@ -334,7 +336,7 @@ function edit_docfiles() DOCMENU="$DOCMENU $i \"\" off" fi done - SELECTDOCS=`eval "dialog --stdout --separate-output --backtitle \"mkSlackBuild $PROG_VERSION [$MK_PKGNAME]\" --title \" Documentations files \" --checklist \"Select documentation files below:\" 20 45 13 $DOCMENU"` + SELECTDOCS=`eval "dialog --stdout --separate-output --backtitle \"mkSlackBuild $PROG_VERSION [$MK_PKGNAME]\" --title \" Documentations files \" --cancel-label \"Continue\" --checklist \"Select documentation files below:\" 20 45 13 $DOCMENU"` fi MK_DOCFILES="`echo $SELECTDOCS | sed ':i; N; s/\n/ /; bi'`" @@ -343,7 +345,8 @@ function edit_docfiles() # Edit compiler architecture function edit_arch() { - MK_ARCH=`dialog --stdout --backtitle "mkSlackBuild documentation files below:" --inputbox "Set an architecture to compiler:" 8 45 $MK_ARCH` + MK_ARCH=`dialog --stdout --backtitle "mkSlackBuild documentation files below:" --cancel-label "Main Menu" --inputbox "Set an architecture to compiler:" 8 45 $MK_ARCH` + [ $? -ne 0 ] && return 100 } #-------------------------------------------------------------------- @@ -364,7 +367,7 @@ function start_build() { change_strings "SLACKBUILD AUTHOR" "$MK_AUTHOR" change_strings "SLACKBUILD AUTHOR INITIALS" $MK_AUTHOR_INITIALS - change_strings "SOURCE NAME" "$MK_PKGNAME" + change_strings "SOURCE NAME" "$MK_SRC_NAME" change_strings "PROGRAM NAME" "$MK_PKGNAME" change_strings "PACKAGE NAME" "$MK_PKGNAME" change_strings "DECOMPRESSOR" "$MK_DECOMPRESSOR" @@ -454,6 +457,7 @@ function get_source_dialog() download_url else select_source + [ $? -eq 100 ] && return 100 fi fi } @@ -472,6 +476,7 @@ function test_source() if [ $? -eq 0 ]; then rm $MK_SOURCE get_source_dialog + [ $? -eq 100 ] return 100 else TEST=0 fi @@ -490,6 +495,7 @@ function set_source_test() MK_DECOMPRESSOR_TEST_FLAG="-t" else edit_decompress_arg + [ $? -eq 100 ] && return 100 fi } @@ -501,27 +507,35 @@ function create_slackbuild() { # Config package URL edit_url + [ $? -eq 100 ] && return 100 # Source Name edit_source_name + [ $? -eq 100 ] && return 100 # Package name, version and extension edit_pkgname + [ $? -eq 100 ] && return 100 # Compile arch edit_arch + [ $? -eq 100 ] && return 100 # Set source test vadiables set_source_test + [ $? -eq 100 ] && return 100 # Get source file get_source_dialog + [ $? -eq 100 ] && return 100 # Test source test_source + [ $? -eq 100 ] && return 100 # Uncompress source unpkg_source + [ $? -eq 100 ] && return 100 # Configure compiler options if exist .configure if [ -e $MK_TMPSRC/configure ]; then @@ -556,7 +570,7 @@ function open_mkslackbuild() MKSLACKBUILD=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" \ --title " Select source file name (use spaces to select): " \ --fselect "$BASEDIR/" 10 70` - [ $? -ne 0 ] && mk_exit 1 + [ $? -ne 0 ] && return 100 if [ -f $MKSLACKBUILD ]; then # Start defaults variables @@ -578,9 +592,11 @@ function open_mkslackbuild() # CHECK: # Set source test vadiables set_source_test + [ $? -eq 100 ] && return 100 # Get source file get_source_dialog + [ $? -eq 100 ] && return 100 # Test source test_source @@ -597,6 +613,7 @@ function save_mkslackbuild() rm $MKSLACKBUILD 2>/dev/null echo '#!/bin/bash' > $MKSLACKBUILD echo -e "# mkSlackBuild version $MK_VERSION\n" >> $MKSLACKBUILD + echo "MK_SRC_NAME=\"$MK_SRC_NAME\"" >> $MKSLACKBUILD echo "MK_SRCNAME=\"$MK_SRCNAME\"" >> $MKSLACKBUILD echo "MK_PKGNAME=\"$MK_PKGNAME\"" >> $MKSLACKBUILD echo "MK_URL=\"$MK_URL\"" >> $MKSLACKBUILD @@ -633,7 +650,7 @@ function edit_menu() EDITMENU="$EDITMENU ${SECTION_NAME[i]} ${SECTION_FLAG[i]}" done - SELECT=`eval "dialog --stdout --backtitle \"mkSlackBuild $PROG_VERSION [$MK_PKGNAME]\" --menu \"Select one section to edit\" 20 40 13 $EDITMENU"` + SELECT=`eval "dialog --stdout --backtitle \"mkSlackBuild $PROG_VERSION [$MK_PKGNAME]\" --cancel-label \"Main Menu\" --menu \"Select one section to edit\" 20 40 13 $EDITMENU"` ANSE=$? if [ $ANSE -ne 1 ]; then STATUS=`mk_status $SELECT` @@ -710,7 +727,7 @@ function exec_script() # turn off debug set +x # Start variables -PROG_VERSION=0.9.3 +PROG_VERSION=0.9.5 LANG=us BASEDIR=`pwd` AUX_TMP=`mktemp -p /tmp/ aux_tmp.XXXXXX` @@ -738,7 +755,7 @@ if [ ! -e ~/.mkslackbuild ]; then MK_AUTHOR="[[AUTHOR NAME]]" MK_AUTHOR_INITIALS="[[AUTHOR INITIALS]]" MK_EDITOR=[[EDITOR]] -MK_LIMITRATE="100k" +MK_LIMITRATE="120k" MK_SOURCEDIR=\`pwd\` MK_ARCH="i468" #MK_URL="ftp://localhost" @@ -758,14 +775,14 @@ ANS0=11 while [ $ANS0 -ne 0 ]; do if [ -z $MK_PKGNAME ]; then ANS0=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" \ - --menu "Main Menu:" 0 0 0 \ + --cancel-label "Exit" --menu "Main Menu:" 0 0 0 \ "1" "Create New SlackBuild" \ "2" "Open edited SlackBuild" \ "0" "Exit"` EXIT_STATUS=$? else ANS0=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" \ - --menu "Main Menu:" 0 0 0 \ + --cancel-label "Exit" --menu "Main Menu:" 0 0 0 \ "1" "Create New SlackBuild" \ "2" "Open MkSlackBuild" \ "3" "Save MkSlackBuild" \ @@ -785,9 +802,11 @@ while [ $ANS0 -ne 0 ]; do case $ANS0 in 1) create_slackbuild + [ $? -eq 100 ] && MK_PKGNAME="" ;; 2) open_mkslackbuild + [ $? -eq 100 ] && MK_PKGNAME="" ;; 3) save_mkslackbuild |