SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Yes, spinning is useful for search, install, etc. I don't use slackpkg from many time and I forgot which functions use it.
My question regards the check-updates function.
Seems case (in)sensitive searching was broken again, so I pushed some commits on spinning and searching. Please check it.
For example, try with "slackpkg search ConsoleKit", it will not work when case-sensitive searching is disabled.
# Show spinning if enabled:
touch ${TMPDIR}/waiting
echo -n "Searching for updates... "
[[ ! ${SPINNING} = "off" ]]; spinning ${TMPDIR}/waiting &
note that the ; must be &&
But better is
Code:
if [[ ! ${SPINNING} = "off" ]];then
echo -n "Searching for updates... "
spinning ${TMPDIR}/waiting &
fi
so if spinning is disabled it show nothing before ending.
The idea - and my doubt for spinning in check-updates - was that it is usually used in batch/cron scripts, where the user do not see nothing, and the output is parsed in a variable:
The spinning seems to cause troubles when user hit CTRL+C. In this case, slackpkg hangs and needs to be killed manually :
Code:
$ slackpkg upgrade-all
Checking local integrity... DONE
Looking for packages to upgrade. Please wait... ^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^
C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^
C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C/
In fact, slackpkg+ hangs because of the statement "wait" in function cleanup() :
Code:
120- function cleanup(){
121- if [ "$CMD" == "update" ];then
122- if [ "$ANSWER" != "Y" ] && [ "$ANSWER" != "y" ]; then
123- touch $WORKDIR/pkglist
124- fi
125- fi
126- [ "$SPINNING" = "off" ] || tput cnorm
127- if [ "$DELALL" = "on" ] && [ "$NAMEPKG" != "" ]; then
128- rm $CACHEPATH/$NAMEPKG &>/dev/null
129- fi
130: wait
Without this statement, slackpkg+ can be stopped with CTRL+C :
Code:
$ slackpkg upgrade-all
Checking local integrity... DONE
Looking for packages to upgrade. Please wait... ^C
Another way, if the statement "wait" is required, is to delete the file ${TMPDIR}/waiting at start of cleanup(). Here is a patch to do that (for slackpkg+ dev/1.7b1) :
Code:
--- slackpkgplus.sh.git_1.7b1 2016-01-25 16:21:50.898399670 +0100
+++ slackpkgplus.sh 2016-01-25 16:21:50.898399670 +0100
@@ -118,6 +118,8 @@
# Override cleanup() to improve log messages and debug functions
#
function cleanup(){
+ [ "$SPINNING" != "off" ] && rm -f ${TMPDIR}/waiting
+
if [ "$CMD" == "update" ];then
if [ "$ANSWER" != "Y" ] && [ "$ANSWER" != "y" ]; then
touch $WORKDIR/pkglist
wait was added in 1.3.1 version, to wait the end of makeinstlog.sh; this feature was removed after a few and the 'wait' was not removed, so yes, it is not needed.
I think that we can both remove the wait statement and add the rm waiting (sometime in past I obtained that after an unclean exit, the spinning remained active out of slackpkg).
@yars
thankyou for patch.
But I prefer to see and discuss it here, so next time please post patch here.
slackpkg+ is has monolitic code, so is many difficult manage it via github. I prefer apply patch manually. Specially when I've some unpushed commits.
Also I'm not an expert of git/github (I use it just to versioning and backup the code and keep it available from anywhere; no more)
However for now seems that spinning in check-updates contains a bug due the >/dev/null 2>&1 when you press ctrl+c
it seems to not reset correctly the tty, so you must to run 'reset' manually to see the cursor.
removing >/dev/null 2>&1 to checkchangelog all works fine.
I made small needed adjustment.
Code:
--- a/src/slackpkgplus.sh
+++ b/src/slackpkgplus.sh
@@ -118,6 +118,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
# Override cleanup() to improve log messages and debug functions
#
function cleanup(){
+ rm -f ${TMPDIR}/waiting
if [ "$CMD" == "update" ];then
if [ "$ANSWER" != "Y" ] && [ "$ANSWER" != "y" ]; then
touch $WORKDIR/pkglist
@@ -127,7 +128,6 @@ if [ "$SLACKPKGPLUS" = "on" ];then
if [ "$DELALL" = "on" ] && [ "$NAMEPKG" != "" ]; then
rm $CACHEPATH/$NAMEPKG &>/dev/null
fi
- wait
if [ $VERBOSE -gt 2 ];then
echo "The temp directory $TMPDIR will NOT be removed!" >>$TMPDIR/info.log
echo
@@ -877,6 +877,8 @@ if [ "$SLACKPKGPLUS" = "on" ];then
cat ${WORKDIR}/pkglist | applyblacklist > ${TMPDIR}/pkglist
touch ${TMPDIR}/waiting
+ echo -n "Looking for $PATTERN in package list. Please wait... "
+ [ "$SPINNING" = "off" ] || spinning ${TMPDIR}/waiting &
[ "$SENSITIVE_SEARCH" = "off" ] && GREPOPTS="--ignore-case"
@@ -945,11 +947,11 @@ if [ "$SLACKPKGPLUS" = "on" ];then
done < $PKGINFOS
done
+ rm ${TMPDIR}/waiting
rm -f $PKGLIST $PKGINFOS
LIST=$(echo -e $LIST | tr \ "\n" | uniq )
- rm ${TMPDIR}/waiting
echo -e "DONE\n"
} # END function searchPackages()
@@ -1617,6 +1619,13 @@ if [ "$SLACKPKGPLUS" = "on" ];then
echo -n "" > ~/.slackpkg/updated-repos.txt
UPDATES=false
+
+ touch ${TMPDIR}/waiting
+ if [[ ! ${SPINNING} = "off" ]]; then
+ echo -n "Searching for updates... "
+ spinning ${TMPDIR}/waiting &
+ fi
+
if [ $VERBOSE -eq 3 ];then
checkchangelog
else
@@ -1666,6 +1675,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
[ -s "${TMPDIR}/updated-repos.txt" ] && UPDATES=true
fi
+ rm -f ${TMPDIR}/waiting
if $UPDATES ; then
echo "News on ChangeLog.txt"
That is a variant to keep the spinning until the output in slackpkg search where there are many many packages. But I'm not sure to keep it.
When I run slackpkg search slackware there are many results. At the end of search the spinning is stopped, but searchlistEX does a lot of think, piped to a 'sort' command.
This may take a lot, and during this time the user does not have the spinning.
This patch add it.
However there are not many case on which search give long output.
Most useful may be in slackpkg upgrade-all that sometime can take a lot (and that is another process that I want try do speedup).
Code:
--- a/src/slackpkgplus.sh
+++ b/src/slackpkgplus.sh
@@ -118,16 +118,17 @@ if [ "$SLACKPKGPLUS" = "on" ];then
# Override cleanup() to improve log messages and debug functions
#
function cleanup(){
+ rm -f ${TMPDIR}/waiting
if [ "$CMD" == "update" ];then
if [ "$ANSWER" != "Y" ] && [ "$ANSWER" != "y" ]; then
touch $WORKDIR/pkglist
fi
fi
+ [ "$TTYREDIRECTION" ] && exec 1>&3 2>&4
[ "$SPINNING" = "off" ] || tput cnorm
if [ "$DELALL" = "on" ] && [ "$NAMEPKG" != "" ]; then
rm $CACHEPATH/$NAMEPKG &>/dev/null
fi
- wait
if [ $VERBOSE -gt 2 ];then
echo "The temp directory $TMPDIR will NOT be removed!" >>$TMPDIR/info.log
echo
@@ -877,6 +878,8 @@ if [ "$SLACKPKGPLUS" = "on" ];then
cat ${WORKDIR}/pkglist | applyblacklist > ${TMPDIR}/pkglist
touch ${TMPDIR}/waiting
+ echo -n "Looking for $PATTERN in package list. Please wait... "
+ [ "$SPINNING" = "off" ] || spinning ${TMPDIR}/waiting &
[ "$SENSITIVE_SEARCH" = "off" ] && GREPOPTS="--ignore-case"
@@ -945,13 +948,13 @@ if [ "$SLACKPKGPLUS" = "on" ];then
done < $PKGINFOS
done
+ #rm ${TMPDIR}/waiting
rm -f $PKGLIST $PKGINFOS
LIST=$(echo -e $LIST | tr \ "\n" | uniq )
- rm ${TMPDIR}/waiting
- echo -e "DONE\n"
+ #echo -e "DONE\n"
} # END function searchPackages()
#### ===== PRIORITY AND SEARCH FUNCTIONS ===== #####
@@ -1586,6 +1589,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
PATTERN=$(echo $ARG | sed -e 's/\+/\\\+/g' -e 's/\./\\\./g' -e 's/ /\|/g')
searchPackages $PATTERN
+ OUTPUT="$(
case $CMD in
search)
if [ "$LIST" = "" ]; then
@@ -1607,6 +1611,10 @@ if [ "$SLACKPKGPLUS" = "on" ];then
fi
;;
esac
+ )"
+ rm $TMPDIR/waiting
+ echo "DONE"
+ echo "$OUTPUT"
cleanup
fi # "$CMD" == "search" / "file-search"
@@ -1617,10 +1625,21 @@ if [ "$SLACKPKGPLUS" = "on" ];then
echo -n "" > ~/.slackpkg/updated-repos.txt
UPDATES=false
+
+ touch ${TMPDIR}/waiting
+ if [[ ! ${SPINNING} = "off" ]]; then
+ echo -n "Searching for updates... "
+ spinning ${TMPDIR}/waiting &
+ fi
+
if [ $VERBOSE -eq 3 ];then
checkchangelog
else
+ exec 3>&1 4>&2
+ TTYREDIRECTION=1
checkchangelog >/dev/null 2>&1
+ TTYREDIRECTION=""
+ exec 1>&3 2>&4
fi
if [ $? -ne 0 ]; then
@@ -1666,6 +1685,7 @@ if [ "$SLACKPKGPLUS" = "on" ];then
[ -s "${TMPDIR}/updated-repos.txt" ] && UPDATES=true
fi
+ rm -f ${TMPDIR}/waiting
if $UPDATES ; then
echo "News on ChangeLog.txt"
I found that if I'm doing an upgrade with upgradepkg manually and during this time I run slackpkg upgrade-all (to have a preview of future updates), slackpkg may damage the /var/log/packages
This becouse the sanity_check() not only CHECK the integrity, but try to recover it automatically.
Code:
for i in $(ls -1 $ROOT/var/log/packages | \
egrep -- "^.*-(${ARCH}|fw|noarch)-[^-]+-upgraded"); do
REVNAME=$(echo ${i} | awk -F'-upgraded' '{ print $1 }')
mv $ROOT/var/log/packages/${i} $ROOT/var/log/packages/${REVNAME}
mv $ROOT/var/log/scripts/${i} $ROOT/var/log/scripts/${REVNAME}
done
To avoid it I want to add a check to see if there are pkgtools running.
Code:
if ps -ef|grep -q -w -e upgradepkg -e installpkg -e removepkg;then
echo "FATAL! You may have an upgrade in progress"
echo "Please try later"
cleanup
fi
But this is not sufficient. It also match a "vi upgradepkg.sh" for example, or the user had run ROOT=/chroot upgradepkg ..., that does not conflict with slackpkg. I tried to check the content of /var/log/setup/tmp (this should be always empty). But it may be not-empty becouse a previous failed upgrade, or it may be empty becouse upgradepkg did start to write into it. Another way is to check for *:* in /var/log/packages, but upgradepkg may take a lot before create it.
I'm wondering if I screwed up something in my config or if an older version of slackpkg+ config. Then again it is more likely my lack of understanding patches in relation to standard installed packages.
I was looking for an upgrade/patch to apr and found that the official repository of packages/patches has apr-1.5.0. However, if I run slackpkg search apr then apr-1.5.0 shows uninstalled. slackpkg info apr shows information for both 1.5.0 and 1.4.6 (the original 14.1 package.) This seemed weird so I thought check /var/log/packages and it shows in /var/log/removed_packages/apr-1.4.6 upgraded on 2015-03-09 (the date I installed 14.1-64 and did an update for patches per the install instructions). If I look in /var/log/packages there is no apr package or apr-util package. Then I thought what else isn't updating. Next on the patches list is bash to version 4.2.053. If I run slackpkg info bash, I see both 4.2.053 and 4.2.045,slackpkg search only show 4.2.053 as uninstalled, while /var/log/removed_packages/bash-4.2.045-x86_64-upgraded 2015-03-09.19:40:01. Running "bash --version" shows 4.2.53(2)-release. So the bash 4.2.53 version is installed due to a upgrade on March 9 of 2015. Now I'm totally confused, why does slackpkg search show it uninstalled?
I did some investigation into where does slackpkg.conf store it's files. It seems that slackpkg uses /var/lib/slackpkg and if I look there I see archives for all my slackpkgplus repositories, along with patches, pasture, extra, and testing. But I notice LASTUPDATE file not changed since 2015-03-09. How would I know if that is correct?
I have been using slackpkg+ since shortly after install. So,at this point it appears I have no apr or apr-util installed on my system. Yes I simply can install them again, no big deal. But I want to know why they were uninstalled, should they be installed and updated to patches level, and if there is a way to get slackpkg search to properly show the packages installed. BTW, I have seen security patches installed with a slackpkg upgrade-all in the last year, but it seems inconsistent and I have sometimes had to type the specific file name as in the security mailing list notice. Yes there is a lot I do not understanding about the patches and how and when they are suppose to be installed, a reference to how to learn that would be appreciated since I'm still learning in this first year of using Slackware 64 14.1 on a desktop.
My questions:
1) should I find all patches installed on my system, or only those that are actively being used?
2) should /var/lib/slackpkg/LASTUPDATE show the date of the last slackpkg(+) update?
3) is there a command to update the slackpkgplus search db (is it looking in /var/log/packages vs the online repository) so it properly shows the installed packages?
4) if all should be installed, then what part of slackpkg.conf or slackpkgplus.conf should be configured to assure their installation?
5) I did try the command slackpkg install slackware which responded with "No packages match the pattern for install." Which is what slackpkg upgrade-all also responds. This command is suppose to install every package of slackware available in the official repositories. Any clue what I should check for why the patches are showing as uninstalled for installed packages?
If either my currect slackpkg.conf or slackpkgplus.conf files are needed please let me know.
UPDATE: If I run "slackpkg install patches" it will find all the patches available and offer to install them for me. So getting all the patches installed was simple once I realized that I could do a search on a repository. But what I'm not sure about is if this is how it should work?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.