modify GPG checks by always checking and extracting tarball when entering the 'edit slackbuild/info menu'; also move gpg check and add extraction to the precheck before building

This commit is contained in:
chess.griffin 2009-06-04 03:46:23 +00:00
parent 437db211f1
commit 6c57ecf70b

View file

@ -990,7 +990,7 @@ info_item() {
local CURAPP OUTPUTFILES local CURAPP OUTPUTFILES
local DEFAULTITEM local DEFAULTITEM
local CURPACKAGE INSTALLEDPACKAGE MENUPACKAGE TITLEPACKAGE local CURPACKAGE INSTALLEDPACKAGE MENUPACKAGE TITLEPACKAGE
local CHOICE PARSED_SLACK_DESC local CHOICE PARSED_SLACK_DESC CHKRETVAL
local APP="$(< $SBOPKGTMP/sbopkg_item_selection)" local APP="$(< $SBOPKGTMP/sbopkg_item_selection)"
local RETVAL=0 local RETVAL=0
@ -1086,19 +1086,38 @@ info_item() {
view_app_file $SHORTPATH $APP.SlackBuild view_app_file $SHORTPATH $APP.SlackBuild
;; ;;
"More Files" ) app_files_chooser $SHORTPATH ;; "More Files" ) app_files_chooser $SHORTPATH ;;
Custom ) customize_item ;; Custom )
check_gpg $SHORTPATH
if [[ $? == 1 ]]; then
RETVAL=1
break
fi
extract_tarball $SHORTPATH $REPO_DIR/$CATEGORY
if [[ $? == 1 ]]; then
RETVAL=1
break
fi
customize_item
;;
Remove ) remove_sources_for_app $SHORTPATH/$APP.info ;; Remove ) remove_sources_for_app $SHORTPATH/$APP.info ;;
Options ) add_options $APP ;; Options ) add_options $APP ;;
"Check GPG" ) "Check GPG" )
check_gpg $SHORTPATH check_gpg $SHORTPATH
if [[ $? == 1 ]]; then CHKRETVAL=$?
if [[ $CHKRETVAL == 0 ]]; then
dialog --title "OK" --msgbox "GPG check passed." \
6 25
elif [[ $CHKRETVAL == 1 ]]; then
RETVAL=1 RETVAL=1
break break
fi fi
;; ;;
Extract ) Extract )
extract_tarball $SHORTPATH $REPO_DIR/$CATEGORY extract_tarball $SHORTPATH $REPO_DIR/$CATEGORY
if [[ $? == 1 ]]; then if [[ $? == 0 ]]; then
dialog --title "Done" --msgbox "$(crunch "The \
tarball has been extracted.")" 8 30
else
RETVAL=1 RETVAL=1
break break
fi fi
@ -1137,19 +1156,16 @@ extract_tarball() {
local DELNAME=$(basename $DELPKG) local DELNAME=$(basename $DELPKG)
if [[ ! -e $DELPKG.tar.gz ]]; then if [[ ! -e $DELPKG.tar.gz ]]; then
dialog --title "Error" --msgbox "$(crunch "No $REPO_NAME $DELNAME \ if [[ $DIAG ]]; then
tarball found.")" 8 40 dialog --title "Error" --msgbox "$(crunch "No $REPO_NAME \
return 0 $DELNAME tarball found.")" 8 40
fi else
dialog --title "Delete?" --yesno "$(crunch "Do you wish to re-extract \ crunch_fmt "ERROR: No $REPO_NAME $DELNAME tarball found."
the $DELNAME tarball on top of the local directory? Press <Yes> to \
extract or <No> to return.")" 0 0
if [[ $? == 0 ]]; then
tar -C $DESTINATION -zxvf $DELPKG.tar.gz
dialog --title "Done" --msgbox \
"The tarball has been extracted." 8 30
return 1
fi fi
return 1
fi
tar -C $DESTINATION -zxf $DELPKG.tar.gz
return 0
} }
check_gpg() { check_gpg() {
@ -1158,9 +1174,9 @@ check_gpg() {
local GPGNAME=$(basename $CHKPKG) local GPGNAME=$(basename $CHKPKG)
if [[ ! -e $CHKPKG.tar.gz ]]; then if [[ ! -e $CHKPKG.tar.gz ]]; then
dialog --title "Error" --msgbox "$(crunch "No $REPO_NAME $GPGNAME \ dialog --title "GPG check error" --msgbox "$(crunch "No $REPO_NAME \
tarball found.")" 8 40 $GPGNAME tarball found.")" 8 40
return 0 return 1
fi fi
if ! gpg --verify $CHKPKG.*.asc > /dev/null 2>&1; then if ! gpg --verify $CHKPKG.*.asc > /dev/null 2>&1; then
dialog --title "WARNING" --yesno "$(crunch "GPG CHECK FAILED!\n\n\ dialog --title "WARNING" --yesno "$(crunch "GPG CHECK FAILED!\n\n\
@ -1175,8 +1191,8 @@ check_gpg() {
"The directory and tarball have been deleted." 8 30 "The directory and tarball have been deleted." 8 30
return 1 return 1
fi fi
return 2
else else
dialog --title "OK" --msgbox "GPG check passed." 6 25
return 0 return 0
fi fi
} }
@ -2344,6 +2360,8 @@ check_source() {
# Check MD5 # Check MD5
echo "Checking MD5SUM for \"$SRCNAME\"..." echo "Checking MD5SUM for \"$SRCNAME\"..."
MD5CHK=$(md5sum "$SRCDIR/$SRCNAME" | cut -d' ' -f1) MD5CHK=$(md5sum "$SRCDIR/$SRCNAME" | cut -d' ' -f1)
echo | tee -a $TMPSUMMARYLOG
echo "$PKG:" | tee -a $TMPSUMMARYLOG
if [[ $MD5CHK == $MD5SUM ]]; then if [[ $MD5CHK == $MD5SUM ]]; then
echo "MD5SUM check passed." | tee -a $TMPSUMMARYLOG echo "MD5SUM check passed." | tee -a $TMPSUMMARYLOG
else else
@ -2728,14 +2746,6 @@ build_package() {
rm -rf $SB_OUTPUT rm -rf $SB_OUTPUT
mkdir -p $SB_OUTPUT mkdir -p $SB_OUTPUT
# Check the GPG signature of the tarball.
check_asc $PKGPATH
case $? in
0 ) ;;
1 ) return 0 ;;
* ) return 1 ;;
esac
# Fetch the source # Fetch the source
# Note that get_source() "knows" about the source cache, so this isn't # Note that get_source() "knows" about the source cache, so this isn't
# necessarily a download. # necessarily a download.
@ -3005,18 +3015,17 @@ check_asc() {
# Check the .asc signature of the tarball # Check the .asc signature of the tarball
local CHKPKG=$1 local CHKPKG=$1
local GPGNAME=$(basename $CHKPKG) local GPGNAME=$(basename $CHKPKG)
local CATEGORY=$(echo $CHKPKG | cut -d/ -f2)
echo
echo "Checking GPG for $GPGNAME..." echo "Checking GPG for $GPGNAME..."
echo >> $TMPSUMMARYLOG
if [[ ! -e $CHKPKG.tar.gz ]]; then if [[ ! -e $CHKPKG.tar.gz ]]; then
echo "$GPGNAME:" | tee -a $TMPSUMMARYLOG echo "GPG check skipped! No tarball found." | tee -a $TMPLOG
echo "GPG check skipped! No tarball found." | tee -a $TMPSUMMARYLOG
return 0 return 0
fi fi
echo echo
if ! gpg --verify $CHKPKG.*.asc > /dev/null 2>&1; then if ! gpg --verify $CHKPKG.*.asc > /dev/null 2>&1; then
echo "$GPGNAME:" | tee -a $TMPSUMMARYLOG echo "GPG check failed!" | tee -a $TMPLOG
echo "GPG check failed!" | tee -a $TMPSUMMARYLOG
while :; do while :; do
cat << EOF cat << EOF
@ -3034,22 +3043,19 @@ EOF
case $ANS in case $ANS in
y* | Y* ) y* | Y* )
echo "Keeping $GPGNAME directory and tarball." | echo "Keeping $GPGNAME directory and tarball." |
tee -a $TMPSUMMARYLOG tee -a $TMPLOG
return 0 return 0
;; ;;
n* | N* ) n* | N* )
echo "Deleting $GPGNAME directory and tarball." | echo "Deleting $GPGNAME directory and tarball." |
tee -a $TMPSUMMARYLOG tee -a $TMPLOG
rm -rf $PKGPATH; rm $PKGPATH.* rm -rf $PKGPATH; rm $PKGPATH.*
rm -f $BUILD_LOCK return 1
return 2
break
;; ;;
a* | A* ) a* | A* )
echo "Aborting the build process." | echo "Aborting the build process." |
tee -a $TMPSUMMARYLOG tee -a $TMPLOG
rm -f $BUILD_LOCK return 1
return 2
;; ;;
* ) * )
echo "Unknown response." echo "Unknown response."
@ -3057,9 +3063,9 @@ EOF
esac esac
done done
else else
echo "$GPGNAME:" >> $TMPSUMMARYLOG echo "GPG check passed." | tee -a $TMPLOG
echo "GPG check passed." | tee -a $TMPSUMMARYLOG
fi fi
tar -C ./$CATEGORY -zxf $CHKPKG.tar.gz
return 0 return 0
} }
@ -3100,6 +3106,10 @@ process_queue() {
else else
echo $CHKBUILD >> $FINALQUEUE echo $CHKBUILD >> $FINALQUEUE
fi fi
check_asc $PKGPATH
if [[ $? == 1 ]]; then
return 0
fi
if ! pick_file info $PKGPATH $CHKBUILD; then if ! pick_file info $PKGPATH $CHKBUILD; then
rm -f $PKGPATH/$CHKBUILD*.build rm -f $PKGPATH/$CHKBUILD*.build
return 0 return 0