From 8507fbb23b3d473214633a95570aa3fa5f0ade52 Mon Sep 17 00:00:00 2001 From: rudson Date: Sat, 14 Apr 2007 17:38:25 +0000 Subject: mkbuild-0.9.16: baixando a versão MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@342 04377dda-e619-0410-9926-eae83683ac58 --- trunk/src/mkbuild | 669 +++++++++++++++++++++++++----------------------------- 1 file changed, 304 insertions(+), 365 deletions(-) (limited to 'trunk/src/mkbuild') diff --git a/trunk/src/mkbuild b/trunk/src/mkbuild index cae7224..b6c718d 100755 --- a/trunk/src/mkbuild +++ b/trunk/src/mkbuild @@ -12,38 +12,46 @@ # Turn off debug set +x # -# Version 0.9.18 -PROG_VERSION=0.9.18 +# Version 0.9.16 +PROG_VERSION=0.9.16 #-------------------------------------------------------------------- # Functions #-------------------------------------------------------------------- -# Show ./configure --help -function config_help() -{ + +function config_help { + + # Show ./configure --help + view_file "Check ./configure --help" $CONFIG_HELP + } -# Show file -# INPUT: $1 string textbox -# $2 file -function view_file() -{ + +function view_file { + + # Show in dialog textbox + # use: view_file + [ $# -ne 2 ] && return 1 dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title " $1 " --textbox $2 20 75 + } -# Exit function -function mk_exit() -{ +function mk_exit { + + # Close all temporary files and exit + clean_all clear exit $1 + } -# Clear all temp files -function clean_all() -{ +function clean_all { + + # Clear all temp files + [ -s $DEPENDENCY_LIST ] && cp $DEPENDENCY_LIST $BASEDIR/slack-required rm $AUX_TMP 2>/dev/null @@ -55,25 +63,34 @@ function clean_all() rm -rf /tmp/$MK_PKGNAME 2>/dev/null rm $CONFIG_HELP 2>/dev/null fi + rm md5sum 2>/dev/null + } -# Print from file $2, the lines betwen <$1> and lines -function print_lines() -{ +function print_lines { + + # Print from , the lines betwen and lines + # use: print_lines_to + [ $# -ne 2 ] && mk_exit 1 eval "sed -n '/<$1>/,/<\/$1>/ { /<$1>/ b; /<\/$1>/ b; p; }' $2" + } -# Print from file $2, the lines betwen <$1> and $2 lines -function print_lines_to() -{ +function print_lines_to { + + # Print from , the lines betwen and string_2 lines + # use: print_lines_to + [ $# -ne 3 ] && mk_exit 1 eval "sed -n '/<$1>/,/$2/ { /<$1>/ b; /$2/ b; p; }' $3" + } -# Make slack-desc file -function mk_slackdesc() -{ +function mk_slackdesc { + + # Make slack-desc file + print_lines_to "slackdesc" "|-----" $SB_MODEL echo -n $MK_PKGNAME | tr [a-z+\-] " " echo -n "|-----handy-ruler" @@ -87,20 +104,26 @@ function mk_slackdesc() echo -en "$MK_PKGNAME: \n" done print_lines "slackdesc" $SB_MODEL | sed '1,/\]\]/ d' + } -# Get label status from SlackBuild model -function get_status() -{ +function get_status { + + # Get label status from section in the SlackBuild model + # use: get_status + [ $# -ne 2 ] && mk_exit 1 eval "sed -n '/<$1>/ p' $2 | sed 's/.*> \([a-z]\+\)/\1/'" + } -# Get status from edited SlackBuild -# input: $1 -> section name -# output: section status and section number -function mk_status() -{ +function mk_status { + + # Get status from edited SlackBuild + # input: + # output: section status and section number + # use: mk_status + for i in `seq 0 $MAXSECTION`;do if [ "${SECTION_NAME[i]}" = "$1" ]; then echo "${SECTION_FLAG[i]} $i" @@ -108,11 +131,14 @@ function mk_status() fi done return 1 + } -# Edit file $3, by change string [[$1]] to $2 -function edit_file() -{ +function edit_file { + + # Edit , by change string [[]] to + # use: edit_file + local STR_OLD local STR_NEW @@ -121,12 +147,14 @@ function edit_file() STR_NEW=$( echo $2 | sed 's/\//\\\//g' ) eval "sed 's/\[\[$STR_OLD\]\]/$STR_NEW/' $3 > $AUX_TMP" mv $AUX_TMP $3 + } -# Unpackage source -function unpkg_source() -{ +function unpkg_source { + + # Unpackage source # FIXME: if MK_DECOMPRESSOR -ne bunzip2 or gunzip... + if [ $MK_DECOMPRESSOR = "bunzip2" -o $MK_DECOMPRESSOR = "gunzip" ]; then dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ --cancel-label "Main Menu" --title "$MK_TITLE" --infobox "Uncompress source in /tmp/$MK_PKGNAME. Wait" 3 45 @@ -141,11 +169,13 @@ function unpkg_source() dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ --title "$MK_TITLE" --msgbox "$MK_DECOMPRESSOR not configurated..." 5 45 fi + } -# Download source -function download_url() -{ +function download_url { + + # Download source + clear mkdir -p $MK_SOURCEDIR/$MK_PKGNAME 2>/dev/null wget --continue --limit-rate=$MK_LIMITRATE $MK_URL -P $MK_SOURCEDIR/$MK_PKGNAME/ @@ -154,11 +184,13 @@ function download_url() return 0 fi MK_SOURCE=$MK_SOURCEDIR/$MK_PKGNAME/$MK_SRCNAME + } -# Select source file -function select_source() -{ +function select_source { + + # Select source file + MK_SOURCE=$BASEDIR while [ ! -f $MK_SOURCE ]; do MK_SOURCE=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ @@ -171,14 +203,103 @@ function select_source() MK_SRCNAME=`basename $MK_SOURCE` MK_SOURCEDIR=`dirname $MK_SOURCE` + +} + +function change_strings { + + # Change string string_1 to string_2 in all files in the current directory + # use: change_strings + + [ $# -ne 2 ] && mk_exit 1 + #[ -z "$2" ] && return 0 + eval "grep -l \"\[\[$1\]\]\" *" | while read FILE; do + edit_file "$1" "$2" $FILE + done + +} + +function get_source_dialog { + + # Dialog to download source + + if [ ! -e $MK_SOURCE ]; then + dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ + --title "$MK_TITLE" --yesno " Download $MK_SRCNAME? " 5 50 + if [ $? -eq 0 ]; then + download_url + else + select_source + [ $? -eq 100 ] && return 100 + fi + fi + +} + +function test_source { + + # Test source by $MK_DECOMPRESSOR $MK_DECOMPRESSOR_TEST_FLAG + + local TEST=1 + local ANS=0 + + while [ $TEST -ne 0 ]; do + dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --infobox "Test source with $MK_DECOMPRESSOR $MK_DECOMPRESSOR_TEST_FLAG $MK_SOURCE" 5 50 + $MK_DECOMPRESSOR $MK_DECOMPRESSOR_TEST_FLAG $MK_SOURCE + TEST=$? + if [ $TEST -ne 0 ]; then + dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --yesno "Source uncompress error. Download source again?" 6 50 + if [ $? -eq 0 ]; then + rm $MK_SOURCE + get_source_dialog + [ $? -eq 100 ] return 100 + else + TEST=0 + fi + fi + done + +} + +function set_source_test { + + # Configure test source variables + + MK_SOURCE=$MK_SOURCEDIR/$MK_PKGNAME/$MK_SRCNAME + if [ "$MK_EXTENSION" = "tar.gz" -o "$MK_EXTENSION" = "gz" -o "$MK_EXTENSION" = "tgz" ]; then + MK_DECOMPRESSOR=gunzip + MK_DECOMPRESSOR_TEST_FLAG="-t" + elif [ "$MK_EXTENSION" = "tar.bz2" -o "$MK_EXTENSION" = "bz2" ]; then + MK_DECOMPRESSOR=bunzip2 + MK_DECOMPRESSOR_TEST_FLAG="-t" + else + edit_decompress_arg + [ $? -eq 100 ] && return 100 + fi + +} + +function desable_configure { + + # Desable configure section + + local i=0 + while [ "${SECTION_NAME[i]}" != "configure" -a $i -le $MAXSECTION ]; do + let i++ + done + + [ $i -ne $MAXSECTION ] && SECTION_FLAG[i]="off" + } #-------------------------------------------------------------------- # Edit functions #-------------------------------------------------------------------- -# Edit authot, Initials and editor -function edit_author() -{ + +function edit_author { + + # Edit .mkslackbuild variables + MK_AUTHOR=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter with author complite name:" 8 60 "$MK_AUTHOR"` edit_file "AUTHOR NAME" "$MK_AUTHOR" ~/.mkslackbuild @@ -203,43 +324,46 @@ function edit_author() MK_REPOS=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter with binary repository directory:" 8 60 "$MK_REPOS"` edit_file "REPOS DIR" "$MK_REPOS" ~/.mkslackbuild - MK_SLACKBUILD_DIR=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter with binary repository directory:" 8 60 "$MK_SLACKBUILD_DIR"` - edit_file "SLACKBUILD DIR" "$MK_SLACKBUILD_DIR" ~/.mkslackbuild - MK_ARCH=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter default architecture to SlackBuild:" 8 60 "i468"` edit_file "DEFAULT ARCH" "$MK_ARCH" ~/.mkslackbuild MK_LIMITRATE=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter wget limit rate:" 8 60 "120k"` edit_file "LIMIT RATE" "$MK_LIMITRATE" ~/.mkslackbuild + } -# Edit source URL -function edit_url() -{ + +function edit_url { + + # Edit source URL + MK_URL=${MK_URL:="http://downloads.sourceforge.net/"} MK_URL=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --cancel-label "Main Menu" --title "$MK_TITLE" --inputbox "Enter with complite URL from source:" 8 60 "$MK_URL"` [ $? -ne 0 ] && return 100 + } -# Edit source name -function edit_source_name() -{ - # Carrega nome do arquivo +function edit_source_name { + + # Edit source name + MK_SRCNAME=`basename $MK_URL` MK_SRCNAME=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --cancel-label "Main Menu" --title "$MK_TITLE" --inputbox "Enter with 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 +function edit_pkgname { + + # Edit MK_PKGNAME, MK_VERSION and MK_EXTENSION + + # Remove variables values from $MK_SRCNAME 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 + # Check variables values ANS=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ --cancel-label "Main Menu" --title "$MK_TITLE" \ --form "Check information below:" 14 52 7 \ @@ -253,16 +377,16 @@ function edit_pkgname() 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 -function edit_decompress_arg() -{ - # Remove nome, versão e extensão do nome da fonte +function edit_decompress_arg { + + # Edit MK_DECOMPRESSOR and MK_DECOMPRESSOR_TEST_FLAG + MK_DECOMPRESSOR="" MK_DECOMPRESSOR_TEST_FLAG="" - # Configura nome, versão e extensão do pacote ANS3=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ --cancel-label "Main Menu" --title "$MK_TITLE" \ --form "Check information below:" 10 55 3 \ @@ -272,19 +396,23 @@ function edit_decompress_arg() MK_DECOMPRESSOR=`echo $ANS3 | awk '{print $1}'` MK_DECOMPRESSOR_TEST_FLAG=`echo $ANS3 | awk '{print $2}'` + } -# Edit configure options -function edit_configure() -{ +function edit_configure { + + # Edit configure options + + local ANS0=1 + CONFIG_HELP=`mktemp -p /tmp/ config_$MK_PKGNAME.XXXXXX` $MK_TMPSRC/configure --help > $CONFIG_HELP - config_help - #[ "$( cat $CONFIG_HELP | egrep '/usr/local')" != "" ] && MK_PREFIX=/usr || MK_PREFIX=/opt/kde +# config_help + + # Default PREFIX for Slackware 11+ MK_PREFIX="/usr" MK_OPTIONS="" - local ANS0=1 while [ $ANS0 -eq 1 ]; do local ANS1="7" @@ -333,11 +461,13 @@ function edit_configure() ANS0=$? done + } -# Show Documentations files -function view_docs() -{ +function view_docs { + + # Show Documentations files + local MENU="" local SELECT="" local ANS2=0 @@ -351,52 +481,49 @@ function view_docs() ANS2=$? [ $ANS2 -eq 0 ] && view_file "File: $SELECT" $MK_TMPSRC/$SELECT done + } -# Edit documentations files -function edit_docfiles() -{ +function edit_docfiles { + + # Edit documentations files + [ -z $MK_TMPSRC ] && return 0 - if [ -e $MK_TMPSRC ]; then - LIST=`( cd $MK_TMPSRC; find . -type f -maxdepth 1 | cut -c3- )` - DOCMENU="" - for i in $LIST; do - if [ "`echo NEWS TODO README AUTHORS INSTALL ChangeLog MAINTAINERS COPYING | grep $i`" != "" ]; then - DOCMENU="$DOCMENU $i \"\" on" - else - DOCMENU="$DOCMENU $i \"\" off" - fi - done - SELECTDOCS=`eval "dialog --stdout --separate-output --backtitle \"Make SlackBuild $PROG_VERSION [$MK_PKGNAME]\" --title \"$MK_TITLE\" --cancel-label \"Continue\" --checklist \"Select documentation files below:\" 20 45 13 $DOCMENU"` - fi +# if [ -e $MK_TMPSRC ]; then + LIST=`( cd $MK_TMPSRC; find . -type f -maxdepth 1 | cut -c3- )` + DOCMENU="" + for i in $LIST; do + if [ "`echo NEWS TODO README AUTHORS INSTALL ChangeLog MAINTAINERS COPYING | grep $i`" != "" ]; then + DOCMENU="$DOCMENU $i \"\" on" + else + DOCMENU="$DOCMENU $i \"\" off" + fi + done + SELECTDOCS=`eval "dialog --stdout --separate-output --backtitle \"Make SlackBuild $PROG_VERSION [$MK_PKGNAME]\" --title \"$MK_TITLE\" --cancel-label \"Continue\" --checklist \"Select documentation files below:\" 20 45 13 $DOCMENU"` +# fi MK_DOCFILES="`echo $SELECTDOCS | sed ':i; N; s/\n/ /; bi'`" + } -# Edit compiler architecture -function edit_arch() -{ +function edit_arch { + + # Edit compiler architecture + MK_ARCH=`dialog --stdout --backtitle "Make SlackBuild documentation files below:" --cancel-label "Main Menu" --title "$MK_TITLE" --inputbox "Set an architecture to compiler:" 8 45 $MK_ARCH` [ $? -ne 0 ] && return 100 + } #-------------------------------------------------------------------- # Mount files #-------------------------------------------------------------------- -# Change string $1 to $2 in all files in the current directory -function change_strings() -{ - [ $# -ne 2 ] && mk_exit 1 - #[ -z "$2" ] && return 0 - eval "grep -l \"\[\[$1\]\]\" *" | while read FILE; do - edit_file "$1" "$2" $FILE - done -} -# Build initial sections -function start_build() -{ +function start_build { + + # Start build sections + change_strings "SLACKBUILD AUTHOR" "$MK_AUTHOR" change_strings "SLACKBUILD AUTHOR INITIALS" $MK_AUTHOR_INITIALS change_strings "SOURCE NAME" "$MK_SRC_NAME" @@ -416,15 +543,17 @@ function start_build() fi change_strings "DOCUMENTATION FILES" "$MK_DOCFILES" change_strings "PREFIX" "$MK_PREFIX" + } -# Mount final SlackBuild -function mount_slackbuild() -{ +function mount_slackbuild { + + # Mount SlackBuild + dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --infobox "SlackBuild save in $SLACKBUILD" 5 45 rm $SLACKBUILD 2>/dev/null -# [ ! -e `dirname $SLACKBUILD` ] && mkdir `dirname $SLACKBUILD` + for i in `seq 0 $MAXSECTION`; do if [ "${SECTION_FLAG[i]}" = "all" -o "${SECTION_FLAG[i]}" = "on" ]; then cat ${SECTION_NAME[i]}_$MK_PKGNAME.mkbuild >> $SLACKBUILD @@ -432,11 +561,14 @@ function mount_slackbuild() fi done chmod +x $SLACKBUILD + } -# Mount SlackBuild to section $1 -function mount_slackbuild_to() -{ +function mount_slackbuild_to { + + # Mount SlackBuild to section section_name + # use: mount_slackbuild_to + if [ $# -eq 1 ]; then END_SECTION=$1 dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --infobox "SlackBuild save in $SLACKBUILD.test" 5 45 @@ -452,17 +584,19 @@ function mount_slackbuild_to() done echo "" >> $SLACKBUILD fi + } -# Make files section -function make_file_sections() -{ +function make_file_sections { + + # Make files section + THIS_MODEL=$1 # Create SlackBuilds-sections files rm *_$MK_PKGNAME.mkbuild 2>/dev/null - # Make files section + # create file section INDEX=0 while read ITEM; do SECTION_NAME[INDEX]="$ITEM" @@ -483,103 +617,16 @@ function make_file_sections() let INDEX-- MAXSECTION=$INDEX md5sum *.mkbuild > md5sum -} -function get_source_dialog() -{ - if [ ! -e $MK_SOURCE ]; then - dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ - --title "$MK_TITLE" --yesno " Download $MK_SRCNAME? " 5 50 - if [ $? -eq 0 ]; then - download_url - else - select_source - [ $? -eq 100 ] && return 100 - fi - fi -} - - -function test_source() -{ - local TEST=1 - local ANS=0 - - while [ $TEST -ne 0 ]; do - dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --infobox "Test source with $MK_DECOMPRESSOR $MK_DECOMPRESSOR_TEST_FLAG $MK_SOURCE" 5 50 - $MK_DECOMPRESSOR $MK_DECOMPRESSOR_TEST_FLAG $MK_SOURCE - TEST=$? - if [ $TEST -ne 0 ]; then - dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --yesno "Source uncompress error. Download source again?" 6 50 - if [ $? -eq 0 ]; then - rm $MK_SOURCE - get_source_dialog - [ $? -eq 100 ] return 100 - else - TEST=0 - fi - fi - done -} - -# Configure test source variables -function set_source_test() -{ - MK_SOURCE=$MK_SOURCEDIR/$MK_PKGNAME/$MK_SRCNAME - if [ "$MK_EXTENSION" = "tar.gz" -o "$MK_EXTENSION" = "gz" -o "$MK_EXTENSION" = "tgz" ]; then - MK_DECOMPRESSOR=gunzip - MK_DECOMPRESSOR_TEST_FLAG="-t" - elif [ "$MK_EXTENSION" = "tar.bz2" -o "$MK_EXTENSION" = "bz2" ]; then - MK_DECOMPRESSOR=bunzip2 - MK_DECOMPRESSOR_TEST_FLAG="-t" - else - edit_decompress_arg - [ $? -eq 100 ] && return 100 - fi -} - -# Enable MD5 or GPG signature check -function edit_signature() -{ - # GPG and MD5 test - local ANS=0 - - ANS=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ - --title "$MK_TITLE" --menu "Select code validate type:" 0 0 0 \ - "1" "gpg signature" \ - "2" "md5sum" \ - "0" "none"` - - case $ANS in - 1) - edit_gpg - ;; - 2) - edit_md5sum - ;; - esac -} - -# Enable GPG signature check -function edit_gpg() -{ - dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ - --title "$MK_TITLE" --msgbox "Enter with gpg minimized signing key." 5 50 - $EDITOR $MK_GPGFILEKEY -} - -# Enable MD5SUM signature check -function edit_md5sum() -{ - echo "none" } #-------------------------------------------------------------------- -# Main functions +# Main Menu functions #-------------------------------------------------------------------- -# Create new SlackBuild -function create_slackbuild() -{ + +function create_slackbuild { + + # Create new SlackBuild # Config package URL edit_url [ $? -eq 100 ] && return 100 @@ -614,11 +661,13 @@ function create_slackbuild() [ $? -eq 100 ] && return 100 # GPG and MD5 test -# edit_signature + # ADD: edit_signature # Configure compiler options if exist if [ -e $MK_TMPSRC/configure ]; then edit_configure + else + desable_configure fi # Edit documentation list @@ -641,11 +690,12 @@ function create_slackbuild() # Main-Menu edit_menu + } -# Open mkslackbuild dialog input -function open_mkslackbuild_dialog() -{ +function open_mkslackbuild_dialog { + + # Open mkslackbuild dialog input MKSLACKBUILD=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ --title " Select source file name: " \ --fselect "$BASEDIR/" 10 70` @@ -653,11 +703,12 @@ function open_mkslackbuild_dialog() open_mkslackbuild [ $? -eq 100 ] || return 100 + } -# Open mkslackbuild -function open_mkslackbuild() -{ +function open_mkslackbuild { + + # Open mkslackbuild if [ -f $MKSLACKBUILD ]; then # Start defaults variables source $MKSLACKBUILD @@ -690,11 +741,12 @@ function open_mkslackbuild() # Uncompress source unpkg_source + } -# Save mkSlackBuild -function save_mkslackbuild() -{ +function save_mkslackbuild { + + # Save mkSlackBuild dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --infobox "mkSlackBuild save in $MKSLACKBUILD" 5 30 rm $MKSLACKBUILD 2>/dev/null @@ -724,20 +776,23 @@ function save_mkslackbuild() done [ -s $DEPENDENCY_LIST ] && cp $DEPENDENCY_LIST $BASEDIR/slack-required + } -# Edit Menu -function edit_menu() -{ +function edit_menu { + + # Edit Menu + ANSE=0 while [ $ANSE -ne 1 ]; do + # Create main-menu string EDITMENU="" for i in `seq 0 $MAXSECTION`; do - #echo "${SECTION_NAME[i]} ${SECTION_FLAG[i]} ${SECTION_FILE[i]}" EDITMENU="$EDITMENU ${SECTION_NAME[i]} ${SECTION_FLAG[i]}" done + # Show edit menu SELECT=`eval "dialog --stdout --backtitle \"Make SlackBuild $PROG_VERSION [$MK_PKGNAME]\" --ok-label \"Edit\" --cancel-label \"Main Menu\" --title \"$MK_TITLE\" --menu \"Select one section to edit\" 20 40 13 $EDITMENU"` ANSE=$? if [ $ANSE -ne 1 ]; then @@ -746,13 +801,16 @@ function edit_menu() echo "Section name error..." mk_exit 1 fi + FLAG=`echo $STATUS | awk '{print $1}'` INDEX=`echo $STATUS | awk '{print $2}'` + if [ "$FLAG" = "on" ]; then SECTION_FLAG[$INDEX]=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --radiolist "Change $SELECT status?" 0 0 0 "on" "enable section" "on" "off" "desable section" "off"` elif [ "$FLAG" = "off" ]; then SECTION_FLAG[$INDEX]=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --radiolist "Change $SELECT status?" 0 0 0 "on" "enable section" "off" "off" "desable section" "on"` fi + if [ $? -eq 0 ]; then if [ "${SECTION_FLAG[$INDEX]}" = "on" -o "${SECTION_FLAG[$INDEX]}" = "all" ]; then if [ "$SELECT" = "md5sum_download_and_check" ]; then @@ -768,11 +826,12 @@ function edit_menu() fi fi done + } -# Edit md5sum -function md5sum_edit() -{ +function md5sum_edit { + + # Edit md5sum local SELECT=0 local FILE=$1 @@ -802,11 +861,12 @@ function md5sum_edit() fi $MK_EDITOR $FILE + } -# Test Menu -function test_menu() -{ +function test_menu { + + # Test Menu local ANST=0 local SECTION=0 local EDITMENU="" @@ -863,11 +923,12 @@ function test_menu() fi fi done + } -# Dependency Menu -function menu_dependency() -{ +function menu_dependency { + + # Dependency Menu local ANSD=11 while [ $ANSD -ne 0 ]; do ANSD=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" \ @@ -886,21 +947,23 @@ function menu_dependency() ;; esac done + } -# Dependency list edit -function edit_dependency() -{ +function edit_dependency { + + # Dependency list edit if [ ! -s $DEPENDENCY_LIST ]; then echo -e "# Dependency list to $MK_PKGNAME\n# \n# dependency [condition] [version]]\n" > $DEPENDENCY_LIST fi $MK_EDITOR $DEPENDENCY_LIST + } -# Check dependency and comment not found dependencies -function test_dependency() -{ +function test_dependency { + + # Check dependency and comment not found dependencies local DEP_LIST="" if [ -s $DEPENDENCY_LIST ]; then @@ -922,112 +985,7 @@ function test_dependency() cp $AUX_TMP $DEPENDENCY_LIST done fi -} - -# Add/commit one SlackBuild -function commit_SlackBuild() -{ - # Mount SlackBuild - mount_slackbuild - MK_TITLE="Commit SlackBuild" - - # Find SlackBuild - SB_PATH=`find $MK_SLACKBUILD_DIR -iname $MK_PKGNAME` - - # Change to SlackBuild directory - cd $MK_SLACKBUILD_DIR - - # Check for new SlackBuild - if [ -z $SB_PATH ]; then - # New SlackBuild - AUX="" - while [ -z $AUX ]; do - dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --infobox "lynx -dump http://gentoo-portage.com/Search?search=$MK_PKGNAME. Wait..." 0 0 - AUX=`lynx -dump http://gentoo-portage.com/Search?search=$MK_PKGNAME | sed -n '/Results:/,+1 { /Results:/ b ; p }' | head --lines=1 | tr -d " "` - # Default directory - if [ -z $AUX ]; then - dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --yesno "Net search error. Try again?" 0 0 - if [ $? -ne 0 ]; then - AUX="/others/unclass" - SB_PATH=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter dir-name to SlackBuild from $MK_PKGNAME:" 8 60 "$AUX"` - fi - else - SB_PATH="`dirname $AUX | tr - /`/`basename $AUX`" - fi - done - # Make directory and add SlackBuild to svn - svn mkdir $SB_PATH - cp $BASEDIR/$MK_PKGNAME.SlackBuild $SB_PATH/ - svn add $SB_PATH/$MK_PKGNAME.SlackBuild - if [ -e $BASEDIR/slack-required ]; then - cp $BASEDIR/slack-required $SB_PATH/ - svn add $SB_PATH/slack-required - fi - else - echo "cp $BASEDIR/$MK_PKGNAME.SlackBuild $SB_PATH/" - if [ -e $BASEDIR/slack-required ]; then - cp $BASEDIR/slack-required $SB_PATH/ - fi - fi - - # Commit SlackBuild - MK_MSG=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter message do commit command:" 8 60` - svn commit -m "$MK_PKGNAME: $MK_MSG" - - cd $BASEDIR - - echo -e "\nPress ENTER to continue." - read ANS1 -} - -# Compile SlackBuild and install -function compile_install() -{ - local ANS="" - # Mount SlackBuild - mount_slackbuild - - # Clean temporary file - echo " " > $AUX_TMP - if [ "$USER" = "root" ]; then - # Root user - # Compile pid - PID=`exec-slackbuild $SLACKBUILD $AUX_TMP` - - # Tail messages - tail -s .1 --pid=$PID -f $AUX_TMP - - # Package name - PACKAGE=`tail -10 $AUX_TMP | grep "^Moving $MK_PKGNAME-[0-9].*\.\.\.$" | awk '{ print $2 }' | grep "$MK_PKGNAME-.*\.tgz$"` - - # Install package - if [ ! -z $PACKAGE ]; then - installpkg $MK_REPOS/$PACKAGE - else - echo -e "\nBuild error!" - fi - else - # Commum users - # Compile pid - PID=`su -c "exec-slackbuild $SLACKBUILD $AUX_TMP"` - - # Tail messages - tail -s .1 --pid=$PID -f $AUX_TMP - - # Package name - PACKAGE=`tail -10 $AUX_TMP | grep "^Moving $MK_PKGNAME-[0-9].*\.\.\.$" | awk '{ print $2 }' | grep "$MK_PKGNAME-.*\.tgz$"` - - # Install package - if [ ! -z $PACKAGE ]; then - su -c "installpkg $MK_REPOS/$PACKAGE" - else - echo -e "\nBuild error!" - fi - fi - - echo -e "\nPress ENTER to continue." - read ANS } # @@ -1070,7 +1028,6 @@ MK_REPOS=[[REPOS DIR]] MK_LIMITRATE=[[LIMIT RATE]] MK_SOURCEDIR=[[SOURCE DIR]] MK_ARCH=[[DEFAULT ARCH]] -MK_SLACKBUILD_DIR=[[SLACKBUILD DIR]] #SB_MODEL="my_model" EOF ) @@ -1130,10 +1087,7 @@ while [ $ANS0 -ne 0 ]; do "2" "Edit dependency list" \ "3" "Test SlackBuild script" \ "4" "View Doc-Files" \ - "5" "Save SlackBuild and mkslackbuild" \ - "6" "Compile/install package" \ - "7" "Remove package" \ - "8" "Commit SlackBuild to Sarava"` + "5" "Save SlackBuild and mkslackbuild"` if [ $? -ne 0 ]; then ANS0=0 @@ -1159,21 +1113,6 @@ while [ $ANS0 -ne 0 ]; do save_mkslackbuild mount_slackbuild ;; - 6) # Compile/install package - compile_install - ;; - 7) # Remove package - if [ "$USER" = "root" ]; then - removepkg $MK_PKGNAME - else - su -c "( removepkg $MK_PKGNAME )" - fi - echo -e "\nPress ENTER to continue." - read ANS1 - ;; - 8) # Commit SlackBuild to Sarava - commit_SlackBuild - ;; 0) # Exit ANS0=0 ;; @@ -1184,7 +1123,7 @@ done # Check changes if [ ! -z $MK_PKGNAME ]; then - md5sum -c md5sum + md5sum -c md5sum >/dev/null if [ $? -ne 0 ]; then MKSLACKBUILD=$BASEDIR/$MK_PKGNAME.mkslackbuild save_mkslackbuild -- cgit v1.2.3