mirror of
https://github.com/sbopkg/sbopkg
synced 2024-11-12 21:10:21 +03:00
when cli interface is used, add in ability to check whether there is a locally edited slackbuild and if so, offer the user the choice to build the original or the edited one; also add in ability to log the build process from the cli (using tee) -- this is the same log governed by KEEPLOG, normally $TMP/sbopkg-build-log
This commit is contained in:
parent
250c4cb11b
commit
a1e6cdde94
@ -187,39 +187,42 @@ as the root user in order to build packages." 8 30
|
|||||||
fi
|
fi
|
||||||
OUTPUT=$TMP/sbopkg_output
|
OUTPUT=$TMP/sbopkg_output
|
||||||
search_package $APP
|
search_package $APP
|
||||||
SLACKBUILD=""
|
# SLACKBUILD=""
|
||||||
if [ ! -e $PKGPATH/$APP.SlackBuild.sbopkg ]; then
|
# if [ ! -e $PKGPATH/$APP.SlackBuild.sbopkg ]; then
|
||||||
SLACKBUILD="original"
|
# SLACKBUILD="original"
|
||||||
else
|
# else
|
||||||
if [ "$DIAG" = 1 ]; then
|
# if [ "$DIAG" = 1 ]; then
|
||||||
while [ 0 ]; do
|
# while [ 0 ]; do
|
||||||
dialog --title "Choose SlackBuild" --menu "A local \
|
# dialog --title "Choose SlackBuild" --menu "A local \
|
||||||
SlackBuild was found in addition to the original SlackBuild. \
|
#SlackBuild was found in addition to the original SlackBuild. \
|
||||||
Which one would you like to use?" 10 60 2 \
|
#Which one would you like to use?" 10 60 2 \
|
||||||
"Original" "Use the original SlackBuild" \
|
#"Original" "Use the original SlackBuild" \
|
||||||
"Local" "Use the local SlackBuild" 2>$TMP/sbopkg_bld_selection
|
#"Local" "Use the local SlackBuild" 2>$TMP/sbopkg_bld_selection
|
||||||
|
#
|
||||||
if [ $? = 1 ]; then
|
# if [ $? = 1 ]; then
|
||||||
# Need this to get back to $APP info menu
|
# # Need this to get back to $APP info menu
|
||||||
SLACKBUILD="cancel"
|
# SLACKBUILD="cancel"
|
||||||
break
|
# break
|
||||||
fi
|
# fi
|
||||||
B="$(cat $TMP/sbopkg_bld_selection)"
|
# B="$(cat $TMP/sbopkg_bld_selection)"
|
||||||
if [ "$B" = "Original" ]; then
|
# if [ "$B" = "Original" ]; then
|
||||||
SLACKBUILD="original"
|
# SLACKBUILD="original"
|
||||||
break
|
# break
|
||||||
fi
|
# fi
|
||||||
if [ "$B" = "Local" ]; then
|
# if [ "$B" = "Local" ]; then
|
||||||
SLACKBUILD="local"
|
# SLACKBUILD="local"
|
||||||
break
|
# break
|
||||||
fi
|
# fi
|
||||||
done
|
# done
|
||||||
else
|
# else
|
||||||
# Need to add a way for cli users to make the same choice;
|
# echo "A local SlackBuild was found in addition to the \
|
||||||
# defaults to original SlackBuild for now
|
#original SlackBuild. Which one would you like to use? Please enter
|
||||||
SLACKBUILD="original"
|
#'O' for original, 'L' for local, or 'X' to exit."
|
||||||
fi
|
# read ANS
|
||||||
fi
|
# SLACKBUILD="original"
|
||||||
|
# fi
|
||||||
|
# fi
|
||||||
|
pick_slackbuild
|
||||||
if [ $SLACKBUILD = "cancel" ]; then
|
if [ $SLACKBUILD = "cancel" ]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
@ -233,7 +236,7 @@ Which one would you like to use?" 10 60 2 \
|
|||||||
if [ "$KEEPLOG" = "YES" ]; then
|
if [ "$KEEPLOG" = "YES" ]; then
|
||||||
cat $OUTPUT >> $TMP/sbopkg-build-log
|
cat $OUTPUT >> $TMP/sbopkg-build-log
|
||||||
fi
|
fi
|
||||||
rm -f $OUTPUT
|
rm -rf $OUTPUT
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -456,6 +459,58 @@ has been deleted." 8 30
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pick_slackbuild () {
|
||||||
|
# This function checks to see if there is a locally-edited
|
||||||
|
# SlackBuild (which has the *.sbopkg" suffix) and then asks the
|
||||||
|
# user which one he wants to use to build a package.
|
||||||
|
SLACKBUILD=""
|
||||||
|
if [ ! -e $PKGPATH/$PKGNAME.SlackBuild.sbopkg ]; then
|
||||||
|
SLACKBUILD="original"
|
||||||
|
else
|
||||||
|
if [ "$DIAG" = 1 ]; then
|
||||||
|
while [ 0 ]; do
|
||||||
|
dialog --title "Choose SlackBuild" --menu "A local \
|
||||||
|
SlackBuild was found in addition to the original SlackBuild. \
|
||||||
|
Which one would you like to use?" 10 60 2 \
|
||||||
|
"Original" "Use the original SlackBuild" \
|
||||||
|
"Local" "Use the local SlackBuild" 2>$TMP/sbopkg_bld_selection
|
||||||
|
if [ $? = 1 ]; then
|
||||||
|
# Need this to get back to $APP info menu
|
||||||
|
SLACKBUILD="cancel"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
B="$(cat $TMP/sbopkg_bld_selection)"
|
||||||
|
if [ "$B" = "Original" ]; then
|
||||||
|
SLACKBUILD="original"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
if [ "$B" = "Local" ]; then
|
||||||
|
SLACKBUILD="local"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
while true; do
|
||||||
|
echo "A local SlackBuild for $PKGNAME was found in \
|
||||||
|
addition to the original SlackBuild."
|
||||||
|
echo "Which one would you like to use? Please enter \
|
||||||
|
'O' for original, 'L' for local, or 'C' to cancel."
|
||||||
|
read ANS
|
||||||
|
case $ANS in
|
||||||
|
o* | O* ) SLACKBUILD="original" ; break
|
||||||
|
;;
|
||||||
|
l* | L* ) SLACKBUILD="local" ; break
|
||||||
|
;;
|
||||||
|
c* | C* ) SLACKBUILD="cancel" ; exit 0
|
||||||
|
;;
|
||||||
|
* ) echo "Unknown response."
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
cleanup () {
|
cleanup () {
|
||||||
rm -rf $TMP/sbopkg_*
|
rm -rf $TMP/sbopkg_*
|
||||||
cd $CWD
|
cd $CWD
|
||||||
@ -497,6 +552,11 @@ if [ "$R" = "Browse" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$R" = "Search" ]; then
|
if [ "$R" = "Search" ]; then
|
||||||
|
# Ideally, it would be nice for the app to automatically jump to
|
||||||
|
# the package information screen if it is found -- i.e. the menu
|
||||||
|
# that displays the options to view the docs, edit the slackbuild,
|
||||||
|
# etc but for now, this works. At least it provides the category,
|
||||||
|
# which can sometimes be hard to remember. :-)
|
||||||
dialog --inputbox "Enter the name of a package you would like \
|
dialog --inputbox "Enter the name of a package you would like \
|
||||||
to search for" 0 0 2>/$TMP/sbopkg_search_request
|
to search for" 0 0 2>/$TMP/sbopkg_search_request
|
||||||
if [ $? = 1 ]; then
|
if [ $? = 1 ]; then
|
||||||
@ -590,11 +650,23 @@ if [ -n "$BUILD" ]; then
|
|||||||
to build packages."
|
to build packages."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
OUTPUT=$TMP/sbopkg_output
|
||||||
for PKGBUILD in $BUILD; do
|
for PKGBUILD in $BUILD; do
|
||||||
echo "Building $PKGBUILD"
|
echo "Building $PKGBUILD"
|
||||||
search_package $PKGBUILD
|
search_package $PKGBUILD
|
||||||
build_package $PKGBUILD
|
pick_slackbuild
|
||||||
|
rm -rf $TMP/sbopkg_build.lck
|
||||||
|
touch $TMP/sbopkg_build.lck
|
||||||
|
( build_package $PKGNAME 2>&1 | tee $OUTPUT )
|
||||||
|
while [ -f $TMP/sbopkg_build.lck ]; do
|
||||||
|
tail -f $OUTPUT
|
||||||
|
done
|
||||||
|
if [ "$KEEPLOG" = "YES" ]; then
|
||||||
|
cat $OUTPUT >> $TMP/sbopkg-build-log
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
rm -rf $OUTPUT
|
||||||
|
exit 0
|
||||||
cleanup
|
cleanup
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user