diff options
Diffstat (limited to 'branches/0.6/src/mkbuild')
-rwxr-xr-x | branches/0.6/src/mkbuild | 444 |
1 files changed, 245 insertions, 199 deletions
diff --git a/branches/0.6/src/mkbuild b/branches/0.6/src/mkbuild index cae7224..bc0786d 100755 --- a/branches/0.6/src/mkbuild +++ b/branches/0.6/src/mkbuild @@ -12,38 +12,37 @@ # Turn off debug set +x # -# Version 0.9.18 -PROG_VERSION=0.9.18 +# Version 0.9.19 +PROG_VERSION=0.9.19 #-------------------------------------------------------------------- # 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 file + # INPUT: $1 string textbox + # $2 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 { + # Exit function 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 @@ -57,23 +56,23 @@ function clean_all() fi } -# Print from file $2, the lines betwen <$1> and </$1> lines -function print_lines() -{ +function print_lines { + + # Print from file $2, the lines betwen <$1> and </$1> lines [ $# -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 file $2, the lines betwen <$1> and $2 lines [ $# -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" @@ -89,18 +88,18 @@ function mk_slackdesc() print_lines "slackdesc" $SB_MODEL | sed '1,/\]\]/ d' } -# Get label status from SlackBuild model -function get_status() -{ +function get_status { + + # Get label status from SlackBuild model [ $# -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: $1 -> section name + # output: section status and section number for i in `seq 0 $MAXSECTION`;do if [ "${SECTION_NAME[i]}" = "$1" ]; then echo "${SECTION_FLAG[i]} $i" @@ -110,9 +109,9 @@ function mk_status() return 1 } -# Edit file $3, by change string [[$1]] to $2 -function edit_file() -{ +function edit_file { + + # Edit file $3, by change string [[$1]] to $2 local STR_OLD local STR_NEW @@ -123,9 +122,9 @@ function edit_file() 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]" \ @@ -143,22 +142,22 @@ function unpkg_source() 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/ + mkdir -p $MK_SOURCE_DIR/$MK_PKGNAME 2>/dev/null + wget --continue --limit-rate=$MK_LIMITRATE $MK_URL -P $MK_SOURCE_DIR/$MK_PKGNAME/ if [ $? -ne 0 ]; then echo "URL error" return 0 fi - MK_SOURCE=$MK_SOURCEDIR/$MK_PKGNAME/$MK_SRCNAME + MK_SOURCE=$MK_SOURCE_DIR/$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]" \ @@ -170,27 +169,28 @@ function select_source() done MK_SRCNAME=`basename $MK_SOURCE` - MK_SOURCEDIR=`dirname $MK_SOURCE` + MK_SOURCE_DIR=`dirname $MK_SOURCE` } #-------------------------------------------------------------------- # Edit functions #-------------------------------------------------------------------- -# Edit authot, Initials and editor -function edit_author() -{ - 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 + +function edit_author { + + # Edit authot, Initials and editor + MK_AUTHOR=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter with author name:" 8 60 "$MK_AUTHOR"` + edit_file "AUTHOR NAME" "$MK_AUTHOR" $MK_SLACKBUILD_RC MK_AUTHOR_INITIALS=`echo $MK_AUTHOR | sed 's/ /\n/g' | sed 's/^\([A-Z]\).*/\1/' | sed ':i; $!N; s/\n//; ti' | tr [A-Z] [a-z]` MK_AUTHOR_INITIALS=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter with author assignature:" 8 60 "$MK_AUTHOR_INITIALS"` - edit_file "AUTHOR INITIALS" "$MK_AUTHOR_INITIALS" ~/.mkslackbuild + edit_file "AUTHOR INITIALS" "$MK_AUTHOR_INITIALS" $MK_SLACKBUILD_RC MK_EDITOR=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter with editor command:" 8 60 "pico"` - edit_file "EDITOR" "$MK_EDITOR" ~/.mkslackbuild + edit_file "EDITOR" "$MK_EDITOR" $MK_SLACKBUILD_RC - MK_SOURCEDIR=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter with sources directory:" 8 60 "\`pwd\`"` - edit_file "SOURCE DIR" "$MK_SOURCEDIR" ~/.mkslackbuild + MK_SOURCE_DIR=`dialog --stdout --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --title "$MK_TITLE" --inputbox "Enter with sources directory:" 8 60 "\`pwd\`"` + edit_file "SOURCE DIR" "$MK_SOURCE_DIR" $MK_SLACKBUILD_RC if [ "$USER" != "root" ]; then SLACKBUILDRC=`[ -e ~/.slackbuildrc ] && echo ~/.slackbuildrc || echo /etc/slackbuildrc` @@ -201,38 +201,35 @@ function edit_author() fi 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 + edit_file "REPOS DIR" "$MK_REPOS" $MK_SLACKBUILD_RC 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 + edit_file "DEFAULT ARCH" "$MK_ARCH" $MK_SLACKBUILD_RC 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_file "LIMIT RATE" "$MK_LIMITRATE" $MK_SLACKBUILD_RC } -# 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() -{ +function edit_source_name { + + # Edit source name # Carrega nome do arquivo 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() -{ +function edit_pkgname { + + # Edit MK_PKGNAME, MK_VERSION and MK_EXTENSION # Remove nome, versão e extensão do nome da fonte MK_SRC_NAME=`echo $MK_SRCNAME | sed -r 's/(.*)-(.*)\.(.*\..*)$/\1/'` MK_PKGNAME=`echo $MK_SRC_NAME | tr [A-Z_] [a-z\-]` @@ -255,9 +252,9 @@ function edit_pkgname() MK_EXTENSION=`echo $ANS | awk '{print $4}'` } -# Edit MK_DECOMPRESSOR and MK_DECOMPRESSOR_TEST_FLAG -function edit_decompress_arg() -{ +function edit_decompress_arg { + + # Edit MK_DECOMPRESSOR and MK_DECOMPRESSOR_TEST_FLAG # Remove nome, versão e extensão do nome da fonte MK_DECOMPRESSOR="" MK_DECOMPRESSOR_TEST_FLAG="" @@ -274,9 +271,9 @@ function edit_decompress_arg() MK_DECOMPRESSOR_TEST_FLAG=`echo $ANS3 | awk '{print $2}'` } -# Edit configure options -function edit_configure() -{ +function edit_configure { + + # Edit configure options CONFIG_HELP=`mktemp -p /tmp/ config_$MK_PKGNAME.XXXXXX` $MK_TMPSRC/configure --help > $CONFIG_HELP @@ -335,9 +332,9 @@ function edit_configure() done } -# Show Documentations files -function view_docs() -{ +function view_docs { + + # Show Documentations files local MENU="" local SELECT="" local ANS2=0 @@ -353,9 +350,9 @@ function view_docs() done } -# Edit documentations files -function edit_docfiles() -{ +function edit_docfiles { + + # Edit documentations files [ -z $MK_TMPSRC ] && return 0 if [ -e $MK_TMPSRC ]; then @@ -374,9 +371,9 @@ function edit_docfiles() 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 } @@ -384,9 +381,10 @@ function edit_arch() #-------------------------------------------------------------------- # Mount files #-------------------------------------------------------------------- -# Change string $1 to $2 in all files in the current directory -function change_strings() -{ + +function change_strings { + + # Change string $1 to $2 in all files in the current directory [ $# -ne 2 ] && mk_exit 1 #[ -z "$2" ] && return 0 eval "grep -l \"\[\[$1\]\]\" *" | while read FILE; do @@ -394,9 +392,9 @@ function change_strings() done } -# Build initial sections -function start_build() -{ +function start_build { + + # Build initial sections change_strings "SLACKBUILD AUTHOR" "$MK_AUTHOR" change_strings "SLACKBUILD AUTHOR INITIALS" $MK_AUTHOR_INITIALS change_strings "SOURCE NAME" "$MK_SRC_NAME" @@ -418,13 +416,13 @@ function start_build() change_strings "PREFIX" "$MK_PREFIX" } -# Mount final SlackBuild -function mount_slackbuild() -{ +function mount_slackbuild { + + # Mount final 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 @@ -434,9 +432,9 @@ function mount_slackbuild() chmod +x $SLACKBUILD } -# Mount SlackBuild to section $1 -function mount_slackbuild_to() -{ +function mount_slackbuild_to { + + # Mount SlackBuild to section $1 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 @@ -454,9 +452,9 @@ function mount_slackbuild_to() fi } -# Make files section -function make_file_sections() -{ +function make_file_sections { + + # Make files section THIS_MODEL=$1 # Create SlackBuilds-sections files @@ -485,8 +483,9 @@ function make_file_sections() md5sum *.mkbuild > md5sum } -function get_source_dialog() -{ +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 @@ -500,8 +499,9 @@ function get_source_dialog() } -function test_source() -{ +function test_source { + + # local TEST=1 local ANS=0 @@ -522,10 +522,10 @@ function test_source() done } -# Configure test source variables -function set_source_test() -{ - MK_SOURCE=$MK_SOURCEDIR/$MK_PKGNAME/$MK_SRCNAME +function set_source_test { + + # Configure test source variables + MK_SOURCE=$MK_SOURCE_DIR/$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" @@ -538,9 +538,9 @@ function set_source_test() fi } -# Enable MD5 or GPG signature check -function edit_signature() -{ +function edit_signature { + + # Enable MD5 or GPG signature check # GPG and MD5 test local ANS=0 @@ -560,26 +560,27 @@ function edit_signature() esac } -# Enable GPG signature check -function edit_gpg() -{ +function edit_gpg { + + # Enable GPG signature check 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() -{ +function edit_md5sum { + + # Enable MD5SUM signature check echo "none" } #-------------------------------------------------------------------- # Main functions #-------------------------------------------------------------------- -# Create new SlackBuild -function create_slackbuild() -{ + +function create_slackbuild { + + # Create new SlackBuild # Config package URL edit_url [ $? -eq 100 ] && return 100 @@ -601,7 +602,7 @@ function create_slackbuild() [ $? -eq 100 ] && return 100 # Get source file - MK_SOURCE=$MK_SOURCEDIR/$MK_PKGNAME/$MK_SRCNAME + MK_SOURCE=$MK_SOURCE_DIR/$MK_PKGNAME/$MK_SRCNAME get_source_dialog [ $? -eq 100 ] && return 100 @@ -643,9 +644,9 @@ function create_slackbuild() 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` @@ -655,9 +656,9 @@ function open_mkslackbuild_dialog() [ $? -eq 100 ] || return 100 } -# Open mkslackbuild -function open_mkslackbuild() -{ +function open_mkslackbuild { + + # Open mkslackbuild if [ -f $MKSLACKBUILD ]; then # Start defaults variables source $MKSLACKBUILD @@ -692,9 +693,9 @@ function open_mkslackbuild() 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 @@ -726,9 +727,9 @@ function save_mkslackbuild() [ -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 @@ -770,9 +771,9 @@ function edit_menu() done } -# Edit md5sum -function md5sum_edit() -{ +function md5sum_edit { + + # Edit md5sum local SELECT=0 local FILE=$1 @@ -804,9 +805,9 @@ function md5sum_edit() $MK_EDITOR $FILE } -# Test Menu -function test_menu() -{ +function test_menu { + + # Test Menu local ANST=0 local SECTION=0 local EDITMENU="" @@ -865,9 +866,9 @@ function test_menu() 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]" \ @@ -888,9 +889,9 @@ function menu_dependency() 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 @@ -898,9 +899,9 @@ function edit_dependency() $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 @@ -924,30 +925,31 @@ function test_dependency() fi } -# Add/commit one SlackBuild -function commit_SlackBuild() -{ +function commit_SlackBuild { + + # Add/commit one SlackBuild # Mount SlackBuild mount_slackbuild MK_TITLE="Commit SlackBuild" # Find SlackBuild - SB_PATH=`find $MK_SLACKBUILD_DIR -iname $MK_PKGNAME` + SB_PATH=`find $SLACKBUILD_DIR -iname $MK_PKGNAME` # Change to SlackBuild directory - cd $MK_SLACKBUILD_DIR + cd $SLACKBUILD_DIR - # Check for new SlackBuild + # Check for dirbase to 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 + dialog --backtitle "Make SlackBuild $PROG_VERSION [$MK_PKGNAME]" --infobox "lynx search for $MK_PKGNAME path. 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 + # Default directory 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 @@ -955,6 +957,7 @@ function commit_SlackBuild() 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/ @@ -964,7 +967,7 @@ function commit_SlackBuild() svn add $SB_PATH/slack-required fi else - echo "cp $BASEDIR/$MK_PKGNAME.SlackBuild $SB_PATH/" + cp $BASEDIR/$MK_PKGNAME.SlackBuild $SB_PATH/ if [ -e $BASEDIR/slack-required ]; then cp $BASEDIR/slack-required $SB_PATH/ fi @@ -980,9 +983,9 @@ function commit_SlackBuild() read ANS1 } -# Compile SlackBuild and install -function compile_install() -{ +function compile_install { + + # Compile SlackBuild and install local ANS="" # Mount SlackBuild mount_slackbuild @@ -1030,6 +1033,48 @@ function compile_install() read ANS } +function create_slackbuildrc { + + # Create basic slackbuildrc + cat << EOF > $MK_SLACKBUILD_RC +#!/bin/bash +# mkslackbuild definitions +# +MK_AUTHOR="[[AUTHOR NAME]]" +MK_AUTHOR_INITIALS="[[AUTHOR INITIALS]]" +MK_EDITOR=[[EDITOR]] +MK_REPOS=[[REPOS DIR]] +MK_LIMITRATE=[[LIMIT RATE]] +MK_SOURCE_DIR=[[SOURCE DIR]] +MK_ARCH=[[DEFAULT ARCH]] +#SB_MODEL="my_model" +EOF + +} + +function mkslackbuild_config_start { + + # Check mkslackbuild.conf and start hi + # Create mkslackbuild.conf config script if need + if [ ! -e $MK_SLACKBUILD_RC ]; then + mkdir -p `dirname $MK_SLACKBUILD_RC` 2>/dev/null + create_slackbuildrc + fi + + # Start mkslackbuild.conf variables + source $MK_SLACKBUILD_RC + MK_SOURCE_DIR=${MK_SOURCE_DIR:=$BASEDIR} + MK_ARCH=${MK_ARCH:="i486"} + + # Configure mkslackbuild.conf variables + if [ "$MK_AUTHOR" = "[[AUTHOR NAME]]" ]; then + MK_TITLE=" Personal Config " + edit_author + MK_TITLE="" + fi + +} + # #-------------------------------------------------------------------- # Start Program @@ -1037,55 +1082,56 @@ function compile_install() # # Start variables LANG=en_US +SLACKDESC_LEN=77 BASEDIR=`pwd` + +# Start Files ------------------------------------------------------ AUX_TMP=`mktemp -p /tmp/ aux_tmp.XXXXXX` SLACKDESC_TMP=`mktemp -p /tmp/ slackdesc_tmp.XXXXXX` -SLACKDESC_LEN=77 DEPENDENCY_LIST=`mktemp -p /tmp/ slack-required.XXXXXX` +LOCAL_CONF_DIR=~/.local/etc/simplepkg +MK_SLACKBUILD_RC="$LOCAL_CONF_DIR/mkslackbuild.conf" +MK_MODEL_DIR="defaults/mkbuild" + +# Start common.sh functions ---------------------------------------- +COMMON="/usr/libexec/simplepkg/common.sh" +BASENAME="`basename $0`" + +if [ -f "$COMMON" ]; then + source $COMMON +else + echo "error: file $COMMON found, check your $BASENAME installation" + mk_exit 0 +fi + +# Load simplepkg.conf variables +eval_config $BASENAME + +# Enable debug mode ----------------------------------------------- +set -x + +# If model isn't defined, get default model. if [ -z $SB_MODEL ]; then - if [ -e ~/.generic.mkSlackBuild ]; then - SB_MODEL=~/.generic.mkSlackBuild - elif [ -e /etc/simplepkg/generic.mkSlackBuild ]; then - SB_MODEL=/etc/simplepkg/generic.mkSlackBuild + if [ -e $LOCAL_CONF_DIR/$MK_MODEL_DIR/generic.mkSlackBuild ]; then + SB_MODEL=$LOCAL_CONF_DIR/$MK_MODEL_DIR/generic.mkSlackBuild + elif [ -e $BASE_CONF/$MK_MODEL_DIR/generic.mkSlackBuild ]; then + SB_MODEL=$BASE_CONF/$MK_MODEL_DIR/generic.mkSlackBuild else echo "SlackBuild model (generic.mkSlackBuild) not found" mk_exit 0 fi fi + +# Get mkSlackBuild input [ $# -ne 0 ] && MKSLACKBUILD=${1//.*}.mkslackbuild # Clear dialog dialog --clear -# Load/create personal definitions -if [ ! -e ~/.mkslackbuild ]; then - ( cat << EOF > ~/.mkslackbuild -#!/bin/bash -# mkslackbuild definitions -# -MK_AUTHOR="[[AUTHOR NAME]]" -MK_AUTHOR_INITIALS="[[AUTHOR INITIALS]]" -MK_EDITOR=[[EDITOR]] -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 -) -fi -source ~/.mkslackbuild -MK_SOURCEDIR=${MK_SOURCEDIR:=$BASEDIR} -MK_ARCH=${MK_ARCH:="i486"} - -# Config Author -if [ "$MK_AUTHOR" = "[[AUTHOR NAME]]" ]; then - MK_TITLE=" Personal Config " - edit_author - MK_TITLE="" -fi +# Check mkslackbuild.conf and start hi +mkslackbuild_config_start +# Check file.mkslackbuild file to open if [ ! -z $MKSLACKBUILD ]; then MK_TITLE=" Open mkSlackBuild " open_mkslackbuild @@ -1133,7 +1179,7 @@ while [ $ANS0 -ne 0 ]; do "5" "Save SlackBuild and mkslackbuild" \ "6" "Compile/install package" \ "7" "Remove package" \ - "8" "Commit SlackBuild to Sarava"` + "8" "Commit SlackBuild to Sarava tree"` if [ $? -ne 0 ]; then ANS0=0 @@ -1193,4 +1239,4 @@ if [ ! -z $MK_PKGNAME ]; then fi mk_exit 0 -# _________________________________END_______________________________ + |