diff options
author | rudson <rudson@04377dda-e619-0410-9926-eae83683ac58> | 2007-02-25 20:35:05 +0000 |
---|---|---|
committer | rudson <rudson@04377dda-e619-0410-9926-eae83683ac58> | 2007-02-25 20:35:05 +0000 |
commit | c60e7c45492609fe65dd77200cc2aeb67f4bb9f0 (patch) | |
tree | 0cb5043e5ec43c609d3d3fd64b49f635951c9e74 | |
parent | e6eff58eeb8226146f7cb48e86c7f46cf1f6d030 (diff) | |
download | simplepkg-c60e7c45492609fe65dd77200cc2aeb67f4bb9f0.tar.gz simplepkg-c60e7c45492609fe65dd77200cc2aeb67f4bb9f0.tar.bz2 |
mkslackbuild-0.9.9: Atualização do script e do modelo
git-svn-id: svn+slack://slack.fluxo.info/var/svn/simplepkg@195 04377dda-e619-0410-9926-eae83683ac58
-rw-r--r-- | trunk/conf/generic.mkSlackBuild.new | 32 | ||||
-rwxr-xr-x | trunk/utils/mkslackbuild | 125 |
2 files changed, 121 insertions, 36 deletions
diff --git a/trunk/conf/generic.mkSlackBuild.new b/trunk/conf/generic.mkSlackBuild.new index 7f83d0e..81b1fdf 100644 --- a/trunk/conf/generic.mkSlackBuild.new +++ b/trunk/conf/generic.mkSlackBuild.new @@ -77,14 +77,6 @@ mkdir -p "$PKG" || exit $ERROR_MKDIR mkdir -p "$REPOS" || exit $ERROR_MKDIR </start_structure> -<import_gpg_signing> off -# Import minimized signing key from -# [[SIGNING KEY URL]] -gpg --import << EOKEY || exit $ERROR_GPG -[[SIGNING KEY]] -EOKEY -</import_gpg_signing> - <download_source> on # Dowload source if necessary SRC="$SRC_NAME-$SRC_VERSION.tar.[[SOURCE EXTENSION]]" @@ -95,14 +87,34 @@ if [ ! -s "$SRC_DIR/$SRC" ] || ! [[DECOMPRESSOR]] [[DECOMPRESSOR TEST FLAG]] "$S fi </download_source> -<download_signature_and_check> off +<gpg_signature_check> off +# Import minimized signing key from +# [[SIGNING KEY URL]] +gpg --import << EOKEY || exit $ERROR_GPG +[[SIGNING KEY]] +EOKEY + # Dowload source's signature if necessary and check it if [ ! -s "$SRC_DIR/$SRC.sig" ]; then wget "$URL.sig" -O "$SRC_DIR/$SRC.sig" || exit $ERROR_WGET fi gpg --verify "$SRC_DIR/$SRC.sig" "$SRC_DIR/$SRC" || exit $ERROR_GPG -</download_signature_and_check> +</gpg_signature_check> + +<md5sum_download_and_check> off +# Md5sum check +MD5SUM_FILE=${SRC//.tar.[[SOURCE EXTENSION]]}.[[MD5SUM EXTENSION]] +#MD5SUM_FILE=$SRC.[[MD5SUM EXTENSION]] +if [ ! -s "$SRC_DIR/$MD5SUM_FILE" ]; then + wget [[DOWNLOAD FOLDER URL]]/$MD5SUM_FILE -O $SRC_DIR/$MD5SUM_FILE +fi + +MD5SUM_SRC=`md5sum $SRC_DIR/$SRC | awk '{print $1}'` +MD5SUM_EXT=`eval "grep '$SRC[ \t]*$' $SRC_DIR/$MD5SUM_FILE" | awk '{print $1}'` + +[ "$MD5SUM_SRC" != "$MD5SUM_EXT" ] && exit $ERROR_MD5 +</md5sum_download_and_check> <untar_source> all # Untar diff --git a/trunk/utils/mkslackbuild b/trunk/utils/mkslackbuild index 50867ad..8220305 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.7 +# Version 0.9.9 # #-------------------------------------------------------------------- # Functions @@ -442,7 +442,7 @@ function make_file_sections() # Create sections files print_lines "$STRING" $THIS_MODEL > $SECTION_FILE let INDEX++ - done < <( cat $THIS_MODEL | grep '^<[a-z_]\+>' | sed 's/<\(.*\)>.*$/\1/' ) + done < <( cat $THIS_MODEL | grep '^<[a-z_0-9]\+>' | sed 's/<\(.*\)>.*$/\1/' ) let INDEX-- MAXSECTION=$INDEX @@ -499,6 +499,42 @@ function set_source_test() fi } +# Enable MD5 or GPG signature check +function edit_signature() +{ + # GPG and MD5 test + local ANS=0 + + ANS=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" \ + --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 "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" \ + --msgbox "Enter with gpg minimized signing key." 5 50 + $EDITOR $MK_GPGFILEKEY +} + +# Enable MD5SUM signature check +function edit_md5sum() +{ + echo "none" +} + #-------------------------------------------------------------------- # Main functions #-------------------------------------------------------------------- @@ -537,7 +573,10 @@ function create_slackbuild() unpkg_source [ $? -eq 100 ] && return 100 - # Configure compiler options if exist .configure + # GPG and MD5 test +# edit_signature + + # Configure compiler options if exist if [ -e $MK_TMPSRC/configure ]; then edit_configure fi @@ -564,14 +603,21 @@ function create_slackbuild() edit_menu } -# Open mkslackbuild -function open_mkslackbuild() +# Open mkslackbuild dialog input +function open_mkslackbuild_dialog() { MKSLACKBUILD=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" \ --title " Select source file name (use spaces to select): " \ --fselect "$BASEDIR/" 10 70` [ $? -ne 0 ] && return 100 + open_mkslackbuild + [ $? -eq 100 ] || return 100 +} + +# Open mkslackbuild +function open_mkslackbuild() +{ if [ -f $MKSLACKBUILD ]; then # Start defaults variables source $MKSLACKBUILD @@ -586,7 +632,8 @@ function open_mkslackbuild() else dialog --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" \ - --msgbox "$MKSLACKBUILD most be a file" 0 0 + --msgbox "$MKSLACKBUILD most be a mkslackbuild file" 6 45 + return 100 fi # CHECK: @@ -626,6 +673,7 @@ function save_mkslackbuild() echo "MK_DOCFILES=\"$MK_DOCFILES\"" >> $MKSLACKBUILD echo "MK_OPTIONS=\"$MK_OPTIONS\"" >> $MKSLACKBUILD echo "MK_PREFIX=\"$MK_PREFIX\"" >> $MKSLACKBUILD + #echo "MK_MD5SUM_EXT=\"$MK_MD5SUM_EXT\"" >> $MKSLACKBUILD echo -e "return 0\n\n" >> $MKSLACKBUILD for i in `seq 0 $MAXSECTION`; do @@ -686,19 +734,48 @@ function test_menu() fi done + EDITMENU="all \"SlackBuild\" $EDITMENU" + while [ "$ANST" != "1" ]; do - SECTION=`eval "dialog --stdout --backtitle \"mkSlackBuild $PROG_VERSION [$MK_PKGNAME]\" --menu \"Select section to test end\" 20 40 13 $EDITMENU"` + SECTION=`eval "dialog --stdout --backtitle \"mkSlackBuild $PROG_VERSION [$MK_PKGNAME]\" --cancel-label \"Exit\" --menu \"Select section to test end\" 20 40 13 $EDITMENU"` ANST=$? + if [ $ANST -ne 1 ]; then + [ "$SECTION" = "all" ] && SECTION=$MAXSECTION mount_slackbuild_to $SECTION + + # FIXME: -> sintaxe check clear - if [ "$USER" != "root" ]; then - su -c "( sh -x $SLACKBUILD.test )" + echo "---------------------------------------------------------" + echo " --= SINTAX CHECK =--" + sh -n $SLACKBUILD.test + if [ $? -eq 0 ]; then + echo " --= 0K =--" + DEBUG=`dialog --stdout --backtitle "mkSlackBuild $PROG_VERSION [$MK_PKGNAME]" \ + --cancel-label "no debug" --menu "Select debug level" 10 35 3 \ + "-x" "Simple debug" \ + "-xv" "More information" \ + "none" "No debug"` + + [ $? -ne 0 -o "$DEBUG" = "none" ] && DEBUG="" + + clear + echo "---------------------------------------------------------" + echo " --= START BUILDING =--" + if [ "$USER" != "root" ]; then + su -c "( sh $DEBUG $SLACKBUILD.test )" + else + ( sh $DEBUG $SLACKBUILD.test ) + fi + echo "---------------------------------------------------------" + echo " --= END =--" + + echo -n "Enter 1 to end test: " + read ANST else - ( sh -x $SLACKBUILD.test ) + echo "Script error..." + read ANST fi - echo -n "Enter 1 to end test: " - read ANST fi done } @@ -724,10 +801,10 @@ function exec_script() # Start Program #-------------------------------------------------------------------- # -# turn off debug +# Turn off debug set +x # Start variables -PROG_VERSION=0.9.7 +PROG_VERSION=0.9.9 LANG=us BASEDIR=`pwd` AUX_TMP=`mktemp -p /tmp/ aux_tmp.XXXXXX` @@ -743,6 +820,8 @@ else mk_exit 0 fi +[ $# -ne 0 ] && MKSLACKBUILD=$1 + # Clear dialog dialog --clear @@ -765,12 +844,17 @@ fi source ~/.mkslackbuild MK_SOURCEDIR=${MK_SOURCEDIR:=$BASEDIR} MK_ARCH=${MK_ARCH:="i486"} +#MK_MD5SUM_EXT="md5sum" # Config Author if [ "$MK_AUTHOR" = "[[AUTHOR NAME]]" ]; then edit_author fi +if [ ! -z $MKSLACKBUILD ]; then + open_mkslackbuild +fi + ANS0=11 while [ $ANS0 -ne 0 ]; do if [ -z $MK_PKGNAME ]; then @@ -790,8 +874,6 @@ while [ $ANS0 -ne 0 ]; do "5" "Test SlackBuild Script" \ "6" "View Doc-Files" \ "0" "Exit and Save..."` -# "3" "Save MkSlackBuild" \ -# "4" "Make Slackbuild" \ EXIT_STATUS=$? fi @@ -805,15 +887,9 @@ while [ $ANS0 -ne 0 ]; do [ $? -eq 100 ] && MK_PKGNAME="" ;; 2) - open_mkslackbuild + open_mkslackbuild_dialog [ $? -eq 100 ] && MK_PKGNAME="" ;; -# 3) -# save_mkslackbuild -# ;; -# 4) -# mount_slackbuild -# ;; 3) edit_menu ;; @@ -836,9 +912,6 @@ if [ ! -z $MK_PKGNAME ]; then MKSLACKBUILD=$BASEDIR/$MK_PKGNAME.mkslackbuild save_mkslackbuild mount_slackbuild -# if [ ! -e $MKSLACKBUILD ]; then -# save_mkslackbuild -# fi fi mk_exit 0 |