initial code to install a package; thanks to Erik Hanson for the ideas and code suggestions; also add a TERMBUILD check in the sanity checks

This commit is contained in:
chess.griffin 2008-09-02 00:39:50 +00:00
parent d72f08a27f
commit 26c9b720cc

View file

@ -51,7 +51,7 @@ if [ ! -e $SBOPKG_CONF ]; then
exit 1
else
. $SBOPKG_CONF
for VAR in RSYNCMIRROR SLACKVER LOCALREPO SRCDIR TMP KEEPLOG; do
for VAR in RSYNCMIRROR SLACKVER LOCALREPO SRCDIR TMP KEEPLOG TERMBUILD; do
if [ -z "${!VAR}" ]; then
MISSING+="$VAR "
fi
@ -405,6 +405,13 @@ info_item () {
APP="$(cat $TMP/sbopkg_item_selection)"
U="README"
while [ 0 ]; do
PKGOUTPUT=${OUTPUT:-/tmp}
IPACKAGE="$(basename $(ls -1t $PKGOUTPUT/${APP}*tgz | head -n 1))"
if [ "$IPACKAGE" = "" ]; then
JPACKAGE=""
else
JPACKAGE="Install $IPACKAGE"
fi
dialog --default-item "$U" --title "$APP Information" \
--extra-button --extra-label "Back" --cancel-label \
"Main Menu" --menu \
@ -416,7 +423,8 @@ dialog --default-item "$U" --title "$APP Information" \
"SlackBuild" "View the SlackBuild file" \
"Edit" "Create and edit a local SlackBuild" \
"Delete" "Delete the local SlackBuild" \
"Build" "Build a package for $APP" 2>$TMP/sbopkg_info_selection
"Build" "Build a package for $APP" \
$JPACKAGE 2>$TMP/sbopkg_info_selection
CHOICE=$?
if [ $CHOICE = 3 ]; then
break
@ -479,6 +487,27 @@ as the root user in order to build packages." 8 30
fi
rm -rf $SBOPKGOUTPUT
fi
if [ "$U" = "Install" ]; then
SBOPKGINSTALLOUTPUT=$TMP/sbopkg_install_output
rm -rf $TMP/sbopkg_install.lck
touch $TMP/sbopkg_install.lck
if [ "$TERMBUILD" = "YES" ]; then
install_package $PKGOUTPUT/$IPACKAGE | tee $SBOPKGINSTALLOUTPUT
read -n 1 -p "Press any key to continue."
rm -rf $TMP/sbopkg_install.lck
else
( install_package $PKGOUTPUT/$IPACKAGE >> $SBOPKGINSTALLOUTPUT & ) 2>>$SBOPKGINSTALLOUTPUT
while [ -f $TMP/sbopkg_install.lck ]; do
dialog --backtitle "Installing the $APP package." \
--tailbox $SBOPKGINSTALLOUTPUT 20 70
rm -rf $TMP/sbopkg_install.lck
done
fi
if [ "$KEEPLOG" = "YES" ]; then
cat $SBOPKGINSTALLOUTPUT >> $TMP/sbopkg-build-log
fi
rm -rf $SBOPKGINSTALLOUTPUT
fi
fi
done
}
@ -712,6 +741,15 @@ if [ ! -e $PKGPATH/$SRCNAME ]; then
fi
}
install_package () {
# Install the package
DIR=$1
INSTPKG=$2
upgradepkg --reinstall --install-new $1/$2
echo "Done installing/upgrading package."
rm -rf $TMP/sbopkg_install.lck
}
build_package () {
# Start fetching and building the package.
echo ; echo "Building $PKG"
@ -733,7 +771,7 @@ fi
if [ "$SLACKBUILD" = "local" ]; then
sh $PKG.SlackBuild.sbopkg || rm -rf $PKG/sbopkg_build.lck
fi
echo "Done building $PKG."
echo "Done building package."
rm -rf $TMP/sbopkg_build.lck
cd $LOCALREPO/$SLACKVER
}