mirror of
https://github.com/sbopkg/sbopkg
synced 2024-12-27 09:58:28 +01:00
major diff ahead: fix issue where no package was found when entering info item menu; remove symlink to source after each package build or fail rather than leave it lying around; add new 'remove_sources' function whereby user can remove all sources from ; add new 'checksum_fail' function which will offer to remove a source after a checksum has failed; when selecting 'view cache dir' from the main menu, first check to see if it's empty and exit gracefully if it is, rather than showing an empty directory
This commit is contained in:
parent
2740ab7f73
commit
73cb4929e8
1 changed files with 95 additions and 16 deletions
|
@ -449,7 +449,11 @@ APP="$(cat $TMP/sbopkg_item_selection)"
|
|||
U="README"
|
||||
while [ 0 ]; do
|
||||
PKGOUTPUT=${OUTPUT:-/tmp}
|
||||
if $(echo $(ls -lt $PKGOUTPUT) | grep -q "$APP"); then
|
||||
IPACKAGE="$(basename $(ls -1t $PKGOUTPUT/${APP}*tgz | head -n 1))"
|
||||
else
|
||||
IPACKAGE=""
|
||||
fi
|
||||
if [ "$IPACKAGE" = "" ]; then
|
||||
JPACKAGE=""
|
||||
else
|
||||
|
@ -459,13 +463,14 @@ dialog --default-item "$U" --title "$APP Information" \
|
|||
--extra-button --extra-label "Back" --cancel-label \
|
||||
"Main Menu" --menu \
|
||||
"Please choose an item or press <Back> to go back or press \
|
||||
<Main Menu> to return to the main menu.\n" 20 60 8 \
|
||||
<Main Menu> to return to the main menu.\n" 20 60 9 \
|
||||
"README" "View the README file" \
|
||||
"Info" "View the .info file" \
|
||||
"Slack-desc" "View the slack-desc file" \
|
||||
"SlackBuild" "View the SlackBuild file" \
|
||||
"Edit" "Create and edit a local SlackBuild" \
|
||||
"Delete" "Delete the local SlackBuild" \
|
||||
"Remove" "Remove $APP sources in cache" \
|
||||
"Build" "Build a package for $APP" \
|
||||
$JPACKAGE 2>$TMP/sbopkg_info_selection
|
||||
CHOICE=$?
|
||||
|
@ -500,6 +505,9 @@ elif [ $CHOICE = 0 ]; then
|
|||
if [ "$U" = "Delete" ]; then
|
||||
delete_local_slackbuild $APP
|
||||
fi
|
||||
if [ "$U" = "Remove" ]; then
|
||||
remove_sources $APP
|
||||
fi
|
||||
if [ "$U" = "Build" ]; then
|
||||
check_root
|
||||
if [ $ROOT = "false" ]; then
|
||||
|
@ -525,6 +533,9 @@ as the root user in order to build packages." 8 30
|
|||
--tailbox $SBOPKGOUTPUT 20 70
|
||||
done
|
||||
fi
|
||||
if [ -e $TMP/sbopkg_failcheck ]; then
|
||||
checksum_fail
|
||||
fi
|
||||
if [ "$KEEPLOG" = "YES" ]; then
|
||||
cat $SBOPKGOUTPUT >> $TMP/sbopkg-build-log
|
||||
fi
|
||||
|
@ -593,6 +604,7 @@ done
|
|||
|
||||
view_cache_dir () {
|
||||
# This function displays the contents of $SRCDIR.
|
||||
if [ "$(ls -A $SRCDIR)" ]; then
|
||||
ls -la $SRCDIR > $TMP/sbopkg_cache_dir
|
||||
dialog --title "Displaying $SRCDIR" \
|
||||
--textbox $TMP/sbopkg_cache_dir 0 0
|
||||
|
@ -614,6 +626,10 @@ cleared." 8 30
|
|||
else
|
||||
continue
|
||||
fi
|
||||
else
|
||||
dialog --title "ERROR" --msgbox "It appears the cache \
|
||||
directory is empty." 8 30
|
||||
fi
|
||||
}
|
||||
|
||||
view_perm_log () {
|
||||
|
@ -784,8 +800,38 @@ if [ ! -e $PKGPATH/$SRCNAME ]; then
|
|||
fi
|
||||
}
|
||||
|
||||
remove_sources () {
|
||||
# Remove sources from $SRCDIR for a particular $APP
|
||||
if $(echo $(ls -la $SRCDIR) | grep -q "$APP"); then
|
||||
ls -la $SRCDIR | grep $APP > $TMP/sbopkg_app_sources
|
||||
dialog --title "Displaying $APP sources" \
|
||||
--textbox $TMP/sbopkg_app_sources 0 0
|
||||
dialog --title "Keep $APP sources?" --yesno "Would you like to \
|
||||
keep the $APP sources in the cache directory $SRCDIR? Select YES \
|
||||
to keep or NO to delete." 10 30
|
||||
if [ $? = 1 ]; then
|
||||
check_root
|
||||
if [ $ROOT = "false" ]; then
|
||||
dialog --title "ERROR" --msgbox "Sorry, only the \
|
||||
root user can delete the sources in the cache directory." 8 30
|
||||
else
|
||||
for i in $(cat $TMP/sbopkg_app_sources); do
|
||||
rm -rf $SRCDIR/$i
|
||||
done
|
||||
dialog --title "Done" --msgbox "The $APP \
|
||||
sources have been cleared." 8 30
|
||||
fi
|
||||
else
|
||||
continue
|
||||
fi
|
||||
else
|
||||
dialog --title "ERROR" --msgbox "It appears there are no \
|
||||
$APP sources in the cache directory." 8 30
|
||||
fi
|
||||
}
|
||||
|
||||
install_package () {
|
||||
# Install the package
|
||||
# Install the package.
|
||||
INSTDIR=$1
|
||||
INSTPKG=$2
|
||||
upgradepkg --reinstall --install-new $INSTDIR/$INSTPKG
|
||||
|
@ -793,6 +839,34 @@ echo "Done installing/upgrading package."
|
|||
rm -rf $TMP/sbopkg_install.lck
|
||||
}
|
||||
|
||||
checksum_fail () {
|
||||
# Offer to remove source if MD5SUM check fails.
|
||||
if [ "$DIAG" = 1 ]; then
|
||||
dialog --title "MD5SUM Failed" --yesno "It appears the \
|
||||
MD5SUM check failed for the downloaded source. The build process \
|
||||
will not continue. Would you still like to keep the the downloaded \
|
||||
source for $PKG in $SRCDIR or would you like to delete the source \
|
||||
and try again? Select YES to keep or NO to delete." 15 35
|
||||
if [ $? = 1 ]; then
|
||||
check_root
|
||||
if [ $ROOT = "false" ]; then
|
||||
dialog --title "ERROR" --msgbox "Sorry, only the root \
|
||||
user can delete the source." 8 30
|
||||
else
|
||||
rm -rf $SRCDIR/$SRCNAME
|
||||
dialog --title "Done" --msgbox "The source has been \
|
||||
deleted." 8 30
|
||||
fi
|
||||
else
|
||||
dialog --title "Done" --msgbox "The source has been \
|
||||
saved." 8 30
|
||||
fi
|
||||
else
|
||||
echo "placeholder"
|
||||
break
|
||||
fi
|
||||
}
|
||||
|
||||
build_package () {
|
||||
# Start fetching and building the package.
|
||||
echo ; echo "Building $PKG"
|
||||
|
@ -804,8 +878,12 @@ if [ "$MD5CHK" == $MD5SUM ]; then
|
|||
echo "OK"
|
||||
else
|
||||
echo "MD5SUM check failed. Exiting."
|
||||
touch $TMP/sbopkg_failcheck
|
||||
rm -rf $TMP/sbopkg_build.lck
|
||||
break
|
||||
rm $SRCNAME
|
||||
cd $LOCALREPO/$SLACKVER
|
||||
#break
|
||||
continue
|
||||
fi
|
||||
echo "Building Slackware package for "$SRCNAME"..."
|
||||
if [ "$SLACKBUILD" = "original" ]; then
|
||||
|
@ -816,6 +894,7 @@ if [ "$SLACKBUILD" = "local" ]; then
|
|||
fi
|
||||
echo "Done building package."
|
||||
rm -rf $TMP/sbopkg_build.lck
|
||||
rm $SRCNAME
|
||||
cd $LOCALREPO/$SLACKVER
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue