mirror of
https://github.com/sbopkg/sbopkg
synced 2025-02-05 08:46:34 +01:00
add patch from Erik Hanson to clean up several of the yes/no dialogs; introduce new code and new -i switch to build and install packages from the command line; introduce a new summary file that will be used at the end of the cli building or installing process.
This commit is contained in:
parent
6d5af94df6
commit
b1052bb553
1 changed files with 55 additions and 24 deletions
|
@ -52,7 +52,7 @@ if [ ! -e $SBOPKG_CONF ]; then
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
. $SBOPKG_CONF
|
. $SBOPKG_CONF
|
||||||
for VAR in RSYNCMIRROR SLACKVER LOCALREPO SRCDIR TMP KEEPLOG TERMBUILD RSYNCFLAGS WGETFLAGS; do
|
for VAR in RSYNCMIRROR SLACKVER LOCALREPO SRCDIR TMP OUTPUT KEEPLOG TERMBUILD RSYNCFLAGS WGETFLAGS; do
|
||||||
if [ -z "${!VAR}" ]; then
|
if [ -z "${!VAR}" ]; then
|
||||||
MISSING+="$VAR "
|
MISSING+="$VAR "
|
||||||
fi
|
fi
|
||||||
|
@ -497,9 +497,8 @@ RVERSION=$(grep VERSION $LOCALREPO/$SLACKVER/$CATEGORY/$APP/$APP.info | cut -d=
|
||||||
RBUILD=$(egrep -m1 "^BUILD" $LOCALREPO/$SLACKVER/$CATEGORY/$APP/$APP.SlackBuild | sed -e 's/^.*[=-]//;s/\"//;s/[ #}\t].*$//g;s/\"//g')
|
RBUILD=$(egrep -m1 "^BUILD" $LOCALREPO/$SLACKVER/$CATEGORY/$APP/$APP.SlackBuild | sed -e 's/^.*[=-]//;s/\"//;s/[ #}\t].*$//g;s/\"//g')
|
||||||
U="README"
|
U="README"
|
||||||
while [ 0 ]; do
|
while [ 0 ]; do
|
||||||
PKGOUTPUT=${OUTPUT:-/tmp}
|
if $(echo $(ls -1 $OUTPUT) | grep -E -q "$APP.*$RVERSION"); then
|
||||||
if $(echo $(ls -1 $PKGOUTPUT) | grep -E -q "$APP.*$RVERSION"); then
|
IPACKAGE="$(basename $(ls -1 $OUTPUT/${APP}*${RVERSION}*tgz | head -n 1))"
|
||||||
IPACKAGE="$(basename $(ls -1 $PKGOUTPUT/${APP}*${RVERSION}*tgz | head -n 1))"
|
|
||||||
else
|
else
|
||||||
IPACKAGE=""
|
IPACKAGE=""
|
||||||
fi
|
fi
|
||||||
|
@ -614,11 +613,11 @@ as the root user in order to build packages." 8 30
|
||||||
rm -rf $TMP/sbopkg_install.lck
|
rm -rf $TMP/sbopkg_install.lck
|
||||||
touch $TMP/sbopkg_install.lck
|
touch $TMP/sbopkg_install.lck
|
||||||
if [ "$TERMBUILD" = "YES" ]; then
|
if [ "$TERMBUILD" = "YES" ]; then
|
||||||
install_package $PKGOUTPUT/$IPACKAGE | tee $SBOPKGINSTALLOUTPUT
|
install_package $IPACKAGE | tee $SBOPKGINSTALLOUTPUT
|
||||||
read -n 1 -p "Press any key to continue."
|
read -n 1 -p "Press any key to continue."
|
||||||
rm -rf $TMP/sbopkg_install.lck
|
rm -rf $TMP/sbopkg_install.lck
|
||||||
else
|
else
|
||||||
( install_package $PKGOUTPUT/$IPACKAGE >> $SBOPKGINSTALLOUTPUT & ) 2>>$SBOPKGINSTALLOUTPUT
|
( install_package $IPACKAGE >> $SBOPKGINSTALLOUTPUT & ) 2>>$SBOPKGINSTALLOUTPUT
|
||||||
while [ -f $TMP/sbopkg_install.lck ]; do
|
while [ -f $TMP/sbopkg_install.lck ]; do
|
||||||
dialog --backtitle "Installing the $APP package." \
|
dialog --backtitle "Installing the $APP package." \
|
||||||
--tailbox $SBOPKGINSTALLOUTPUT 18 70
|
--tailbox $SBOPKGINSTALLOUTPUT 18 70
|
||||||
|
@ -712,9 +711,8 @@ if [ "$(ls -A $SRCDIR)" ]; then
|
||||||
ls -la $SRCDIR > $TMP/sbopkg_cache_dir
|
ls -la $SRCDIR > $TMP/sbopkg_cache_dir
|
||||||
dialog --title "Displaying $SRCDIR" \
|
dialog --title "Displaying $SRCDIR" \
|
||||||
--textbox $TMP/sbopkg_cache_dir 0 0
|
--textbox $TMP/sbopkg_cache_dir 0 0
|
||||||
dialog --title "Keep Cache?" --yesno "Would you like to keep the \
|
dialog --title "Keep Cache?" --yes-label "Keep" --no-label "Delete" \
|
||||||
files in the cache directory? Select YES to keep or NO to \
|
--yesno "Would you like to keep the files in the cache directory?" 5 60
|
||||||
delete." 8 40
|
|
||||||
if [ $? = 1 ]; then
|
if [ $? = 1 ]; then
|
||||||
check_root
|
check_root
|
||||||
if [ $ROOT = "false" ]; then
|
if [ $ROOT = "false" ]; then
|
||||||
|
@ -747,9 +745,8 @@ in the configuration file." 10 30
|
||||||
else
|
else
|
||||||
dialog --title "Displaying $TMP/sbopkg-build-log" \
|
dialog --title "Displaying $TMP/sbopkg-build-log" \
|
||||||
--textbox $TMP/sbopkg-build-log 0 0
|
--textbox $TMP/sbopkg-build-log 0 0
|
||||||
dialog --title "Keep Log?" --yesno "Would you like to keep the \
|
dialog --title "Keep Log?" --yes-label "Keep" --no-label "Delete" \
|
||||||
permanent build log $TMP/sbopkg-build-log? Select YES to keep or NO \
|
--yesno "Would you like to keep the permanent build log $TMP/sbopkg-build-log?" 6 50
|
||||||
to delete." 8 40
|
|
||||||
if [ $? = 1 ]; then
|
if [ $? = 1 ]; then
|
||||||
check_root
|
check_root
|
||||||
if [ $ROOT = "false" ]; then
|
if [ $ROOT = "false" ]; then
|
||||||
|
@ -994,10 +991,12 @@ fi
|
||||||
|
|
||||||
install_package () {
|
install_package () {
|
||||||
# Install the package.
|
# Install the package.
|
||||||
INSTDIR=$1
|
INSTPKG=$1
|
||||||
INSTPKG=$2
|
if [ "$INSTALLPKGS" = "1" ]; then
|
||||||
upgradepkg --reinstall --install-new $INSTDIR/$INSTPKG
|
upgradepkg --reinstall --install-new $OUTPUT/*
|
||||||
echo "Done installing/upgrading package."
|
else
|
||||||
|
upgradepkg --reinstall --install-new $OUTPUT/$INSTPKG
|
||||||
|
fi
|
||||||
rm -rf $TMP/sbopkg_install.lck
|
rm -rf $TMP/sbopkg_install.lck
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1005,11 +1004,11 @@ checksum_fail () {
|
||||||
# Offer to remove source if MD5SUM check fails.
|
# Offer to remove source if MD5SUM check fails.
|
||||||
rm -rf $TMP/sbopkg_failcheck
|
rm -rf $TMP/sbopkg_failcheck
|
||||||
if [ "$DIAG" = 1 ]; then
|
if [ "$DIAG" = 1 ]; then
|
||||||
dialog --title "MD5SUM Failed" --yesno "It appears the \
|
dialog --title "MD5SUM Failed" --yes-label "Keep" --no-label "Delete" \
|
||||||
MD5SUM check failed for the downloaded source. The build process \
|
--yesno "It appears the MD5SUM check failed for the downloaded source. \
|
||||||
will not continue. Would you still like to keep the the downloaded \
|
The build process will not continue. Would you still like to keep the \
|
||||||
source for $PKG in $SRCDIR or would you like to delete the source \
|
the downloaded source for $PKG in $SRCDIR or would you like to delete \
|
||||||
and try again? Select YES to keep or NO to delete." 15 35
|
the source and try again?" 15 35
|
||||||
if [ $? = 1 ]; then
|
if [ $? = 1 ]; then
|
||||||
check_root
|
check_root
|
||||||
if [ $ROOT = "false" ]; then
|
if [ $ROOT = "false" ]; then
|
||||||
|
@ -1033,6 +1032,20 @@ fi
|
||||||
build_package () {
|
build_package () {
|
||||||
# Start fetching and building the package.
|
# Start fetching and building the package.
|
||||||
echo ; echo "Building $PKG"
|
echo ; echo "Building $PKG"
|
||||||
|
OLDOUTPUT=$OUTPUT
|
||||||
|
NEWOUTPUT=$TMP/sbooutput
|
||||||
|
if [ ! -d "$NEWOUTPUT" ]; then
|
||||||
|
mkdir $NEWOUTPUT
|
||||||
|
fi
|
||||||
|
SUMMARYLOG=$TMP/sbopkg_summary
|
||||||
|
if [ ! -e $SUMMARYLOG ]; then
|
||||||
|
touch $SUMMARYLOG
|
||||||
|
echo >> $SUMMARYLOG
|
||||||
|
echo "******************************************" >> $SUMMARYLOG
|
||||||
|
echo "PACKAGE BUILDING/INSTALLATION SUMMARY:" >> $SUMMARYLOG
|
||||||
|
echo >> $SUMMARYLOG
|
||||||
|
fi
|
||||||
|
OUTPUT=$NEWOUTPUT
|
||||||
cd $LOCALREPO/$SLACKVER/$PKGPATH
|
cd $LOCALREPO/$SLACKVER/$PKGPATH
|
||||||
get_source $PKG
|
get_source $PKG
|
||||||
echo "Checking MD5SUM for "$SRCNAME"..."
|
echo "Checking MD5SUM for "$SRCNAME"..."
|
||||||
|
@ -1047,7 +1060,7 @@ else
|
||||||
cd $LOCALREPO/$SLACKVER
|
cd $LOCALREPO/$SLACKVER
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
echo "Building Slackware package for "$SRCNAME"..."
|
echo "Building Slackware package for $SRCNAME..."
|
||||||
if [ "$SLACKBUILD" = "original" ]; then
|
if [ "$SLACKBUILD" = "original" ]; then
|
||||||
sh $PKG.SlackBuild || rm -rf $TMP/sbopkg_build.lck
|
sh $PKG.SlackBuild || rm -rf $TMP/sbopkg_build.lck
|
||||||
# The following pid stuff isn't working right now. If a user
|
# The following pid stuff isn't working right now. If a user
|
||||||
|
@ -1062,9 +1075,18 @@ fi
|
||||||
if [ "$SLACKBUILD" = "local" ]; then
|
if [ "$SLACKBUILD" = "local" ]; then
|
||||||
sh $PKG.SlackBuild.sbopkg || rm -rf $TMP/sbopkg_build.lck
|
sh $PKG.SlackBuild.sbopkg || rm -rf $TMP/sbopkg_build.lck
|
||||||
fi
|
fi
|
||||||
echo "Done building package."
|
echo "Done building package for "$SRCNAME"."
|
||||||
|
echo "Built package for $SRCNAME" >> $SUMMARYLOG
|
||||||
|
if [ "$INSTALLPKGS" = "1" ]; then
|
||||||
|
install_package $SRCNAME
|
||||||
|
echo "Done installing/upgrading package for $SRCNAME."
|
||||||
|
echo "Installed package: $SRCNAME" >> $SUMMARYLOG
|
||||||
|
mv $OUTPUT/* $OLDOUTPUT/
|
||||||
|
fi
|
||||||
|
echo >> $SUMMARYLOG
|
||||||
rm -rf $TMP/sbopkg_build.lck
|
rm -rf $TMP/sbopkg_build.lck
|
||||||
rm $SRCNAME
|
rm $SRCNAME
|
||||||
|
OUTPUT=$OLDOUTPUT
|
||||||
cd $LOCALREPO/$SLACKVER
|
cd $LOCALREPO/$SLACKVER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1259,6 +1281,7 @@ if [ $WRITE = "false" ]; then
|
||||||
else
|
else
|
||||||
rm -rf $TMP/sbopkg_*
|
rm -rf $TMP/sbopkg_*
|
||||||
rm -rf $TMP/sbopkgpidlist
|
rm -rf $TMP/sbopkgpidlist
|
||||||
|
rm -rf $TMP/sbooutput
|
||||||
rm -f $PIDFILE
|
rm -f $PIDFILE
|
||||||
fi
|
fi
|
||||||
cd $CWD
|
cd $CWD
|
||||||
|
@ -1395,7 +1418,7 @@ if [ $# -eq 0 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# This is the command line options and help.
|
# This is the command line options and help.
|
||||||
while getopts ":b:cd:f:hlpq:rs:v:" OPT; do
|
while getopts ":b:cd:f:hi:lpq:rs:v:" OPT; do
|
||||||
case $OPT in
|
case $OPT in
|
||||||
b ) BUILD="$OPTARG"
|
b ) BUILD="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
@ -1405,6 +1428,9 @@ while getopts ":b:cd:f:hlpq:rs:v:" OPT; do
|
||||||
;;
|
;;
|
||||||
f ) SBOPKG_CONF="$OPTARG"
|
f ) SBOPKG_CONF="$OPTARG"
|
||||||
;;
|
;;
|
||||||
|
i ) INSTALLPKGS=1
|
||||||
|
BUILD="$OPTARG"
|
||||||
|
;;
|
||||||
l ) CHANGELOG=1
|
l ) CHANGELOG=1
|
||||||
;;
|
;;
|
||||||
p ) GETPKGS=1
|
p ) GETPKGS=1
|
||||||
|
@ -1431,6 +1457,7 @@ SlackBuilds.org repository"
|
||||||
echo " -f Override default configuration file"
|
echo " -f Override default configuration file"
|
||||||
echo " with specified file."
|
echo " with specified file."
|
||||||
echo " -h Display this help message."
|
echo " -h Display this help message."
|
||||||
|
echo " -i package Build and install a package."
|
||||||
echo " -l Display the SlackBuilds.org \
|
echo " -l Display the SlackBuilds.org \
|
||||||
ChangeLog.txt and then quit."
|
ChangeLog.txt and then quit."
|
||||||
echo " -p List installed SlackBuilds.org packages."
|
echo " -p List installed SlackBuilds.org packages."
|
||||||
|
@ -1494,7 +1521,11 @@ to build packages."
|
||||||
cat $SBOPKGOUTPUT >> $TMP/sbopkg-build-log
|
cat $SBOPKGOUTPUT >> $TMP/sbopkg-build-log
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
if [ "$INSTALLPKGS" = "1" ]; then
|
||||||
|
cat $TMP/sbopkg_summary
|
||||||
|
fi
|
||||||
rm -rf $SBOPKGOUTPUT
|
rm -rf $SBOPKGOUTPUT
|
||||||
|
rm -rf $TMP/sbopkg_summary
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$CHK_UPDATES" ]; then
|
if [ -n "$CHK_UPDATES" ]; then
|
||||||
|
|
Loading…
Add table
Reference in a new issue