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.
Okay, so I couldn't stop thinking about this problem, and I believe I have a solution. (Whether Pat thinks it's a good solution may be a different story.) The idea is that each time config() is called in doinst.sh, it compares the new file with a reference (presumably unmodified) config file rather than the actual installed config file, which may include user edits. It then saves a new reference config file.
Code:
config() {
NEW="$1"
OLD="$(dirname $NEW)/$(basename $NEW .new)"
REF="${OLD}.ref"
# If there's no config file by that name, mv it over:
if [ ! -r $OLD ]; then
cp $NEW $REF
mv $NEW $OLD
else
# If reference config file doesn't exist, fall back to the old behavior
if [ ! -r $REF ]; then
if [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy
mv $NEW $REF
else
cp $NEW $REF
fi
else
if [ "$(cat $REF | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy
mv $NEW $REF
else
cp $NEW $REF
fi
fi
fi
}
Unfortunately, this also requires some changes to installpkg and upgradepkg. Because upgradepkg runs installpkg twice, doinst.sh also gets executed twice, and therefore on the second run $REF always has the same contents as $NEW, so $NEW is always discarded. This patch causes doinst.sh to only be executed once with upgradepkg.
Code:
--- upgradepkg.orig 2018-08-23 23:38:24.378352677 -0400
+++ upgradepkg 2018-08-23 23:30:51.966761078 -0400
@@ -302,11 +302,11 @@
# Next, the new package is pre-installed:
if [ "$VERBOSE" = "verbose" ]; then
- /sbin/installpkg $INCOMINGDIR/$NNAME
+ /sbin/installpkg --preinstall $INCOMINGDIR/$NNAME
RETCODE=$?
else
echo "Pre-installing package $NEW..."
- /sbin/installpkg $INCOMINGDIR/$NNAME 1> /dev/null
+ /sbin/installpkg --preinstall $INCOMINGDIR/$NNAME 1> /dev/null
RETCODE=$?
fi
# Make sure that worked:
--- installpkg.orig 2018-08-23 23:37:54.342581247 -0400
+++ installpkg 2018-08-23 23:31:38.568951574 -0400
@@ -145,6 +145,7 @@
# Parse options:
MODE=install # standard text-mode
+PREINSTALL=0
while [ 0 ]; do
if [ "$1" = "-warn" -o "$1" = "--warn" ]; then
MODE=warn
@@ -188,6 +189,9 @@
fi
ROOT="$2"
shift 2
+ elif [ "$1" = "-preinstall" -o "$1" = "--preinstall" ]; then
+ PREINSTALL=1
+ shift 1
else
break
fi
@@ -517,7 +521,7 @@
/sbin/ldconfig
fi
- if [ -f $ROOT/install/doinst.sh ]; then
+ if [ -f $ROOT/install/doinst.sh -a $PREINSTALL -eq 0 ]; then
if [ "$MODE" = "install" ]; then
echo "Executing install script for $(basename $package)."
fi
I have tested a bit, and it seems to have the right behavior:
If the .new config file matches the .ref config file, .new is not installed.
If the .new config file is different from the .ref config file, .new is installed.
If there is no .ref file, it falls back to the old behavior.
In no case is the user's existing config file overwritten.
Last edited by montagdude; 08-23-2018 at 10:52 PM.
Seems that using terminus-v* font for setup isn't so good idea.
This fonts (with -v*) have 512 glyphs and use foreground intensity bit to switch between A/B 256 sets. As result the console can use only 8 foreground colors instead of 16 as for fonts with 256 glyphs. In this mode dialog's "windows" has no shaded boxes and looks ugly (for ex. screenshot from this message https://www.linuxquestions.org/quest...ps-4175636135/).
How about using one of 256 glyphs terminus (not terminus-v*) ?
The idea is that each time config() is called in doinst.sh, it compares the new file with a reference (presumably unmodified) config file rather than the actual installed config file, which may include user edits. It then saves a new reference config file.
Why save the config files instead of the md5 checksums? One file, for example, /var/lib/pkgtools/checksums.md5 would contain lines like
( cd usr/bin ; rm -rf man )
( cd usr/bin ; ln -sf ../share/texmf-dist/doc/man man )
This breaks "man", sorry.
A workaround fix is to remove the symlink in within the buildscript, but i'll fix this within texmf_get.sh.
An unrelated question: Would it be possible to include package ucs into TeX Live Slackware installation? There are several other packages listing it as required, as shown by "grep ucs /usr/share/texmf-dist/tex -ri | grep -i Require" (admittedly, in most cases it's optional, but still there are some where it's not).
Not quite, and apparently I was not very clear. Let me try again. I will use ntp as an example, since it was recently upgraded in 14.2. On my system, I had uncommented a few lines in /etc/ntp.conf. When ntp was upgraded, /etc/ntp.conf.new was installed, which only differed from /etc/ntp.conf by having those lines commented again. In other words, /etc/ntp.conf.new was offering to revert the changes I had made. My request is to prevent this from happening. In other words, if ntp.conf in the ntp-4.2.8p12 package is not any different from the one in the previous version, then I would like it to not be installed as ntp.conf.new, because it is in fact not new.
My brain just exploded. <grin>
Maybe to much coffee, not enough beer. If you commented out two lines in ntp.conf, then you have changed it. The new, even if everything is the same "except" for those two commented out lines, the new ntp.conf IS different; thus the ntp.conf.new is installed. With every update to ntp.conf I go through the merge process after upgraded with slackpkg.
Distribution: slackware 15.0 64bit, 14.2 64 and 32bit and arm, ubuntu and rasbian
Posts: 495
Rep:
conf.new proposal
I had though of md5's too. You don't need a separate file for them either, they could be in the package doinst.
something like if (calculated md5sum of new conf) != (saved in script md5sum of previous package version of conf file) or (conf file does not exist in situ) then create conf.new version, otherwise do nothing.
The down side of this is that if you messed up the config you would have to remove the config entirely, not just uninstall the package to be presented with a new config
the other downside is Pat would have to keep track of all those md5sums in the doinstall.sh
It also could present a problem if the project changes the name or number of conf files. (I know it isn't in slack114.2 but think dovecot going from single config to config+config directory with more config files. In that case, the functional result did not change, but the default example configs did.)
It would have another problem; what if the config changed in one update, but not the next one. If you had missed an update, when you applied the latest version it would not change the config because the last one had not changed. It would not know that you had the version previous to that, as it could only compare the config with the previous version, not the one before it. This problem (user not doing every update available in sequence) is much more of an issue as it negates any benefit you might gain from implementing it. In fact this one seems to be a show-stopper for the idea.
So, IF your proposal is accepted, in the name of some questionable commodity, the entire /etc folder will be spammed with *.ref files?
One for every config file? OMG!
Heck! Even on RHEL provisioning I do not seen something like this...
It could always have an on/off switch in a config file..or the ref file reside in another directory. I know I could have used those *.ref files when I borked a few config files.
ps. Might want to turn down the drama responses you might get better feedback.
An unrelated question: Would it be possible to include package ucs into TeX Live Slackware installation? There are several other packages listing it as required, as shown by "grep ucs /usr/share/texmf-dist/tex -ri | grep -i Require" (admittedly, in most cases it's optional, but still there are some where it's not).
When i find time, i will implement that on creation of texlive-base, \RequirePackage will be checked, and hard deps will be added too.
Don't know how this works out, but it's desireable that nothing in the stock texlive package depends on an external(e.g. SBo) package, while keeping the the stock package small.
So, IF your proposal is accepted, in the name of some questionable commodity, the entire /etc folder will be spammed with *.ref files?
One for every config file? OMG!
Heck! Even on RHEL provisioning I do not seen something like this...
Who cares? Plus, they have a valid purpose; sometimes it is useful to have a quick way to check what you changed in the config file. Anyway, as others have said, there are other ways to accomplish the same purpose, such as storing the checksums instead of the files.
One way to handle the *.new challenge is provided by the Salix devs. The applet is called -- drum roll -- dotnew. One option in the applet is to view a diff of the affected files. Or a vimdiff.
Some Slackers have been asking for sbopkg, slackpkg+, slapt-get/gslapt to be added to the Slackware /extra repo. Perhaps most if not all of the Salix admin tools could be included in that wish list.
Maybe to much coffee, not enough beer. If you commented out two lines in ntp.conf, then you have changed it. The new, even if everything is the same "except" for those two commented out lines, the new ntp.conf IS different; thus the ntp.conf.new is installed. With every update to ntp.conf I go through the merge process after upgraded with slackpkg.
That's the point. I don't want to have to go through the diff and merge process just to confirm that I really do want to keep the changes that I already made. I would like to only consider changes that are actually new.
That's the point. I don't want to have to go through the diff and merge process just to confirm that I really do want to keep the changes that I already made. I would like to only consider changes that are actually new.
Well I can certainly understand that. I think we are taking the simple of of KIS. I'm always for less work. Maintaining -current takes some work. I'm fine with that. Looking at ntp.conf as the example. You change two lines from the default, the new ntp.conf is unchanged except for those two lines. I can see that. How you going to tell the installer yours is the same except for those two lines?
What about may use case? My ntp.conf has 4 parts, 9 lines in all that have changed from the default. Some configurations files are a nightmare (cups.conf) for example. I gotten to the point of selecting keep (cups.conf.new) then deleting it after processing via slackpkg is finished so it won't come up again because I know there are no changes affecting my setup.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.