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.
I would like to know if there is a way to define a default action for .new config files when updating packages with slackpkg? I would like that the old configuration is kept on a regular update and I am not prompted at the end of the update process.
POSTINST
Enables (on) or disables (off) slackpkg's post-installation features, such as checking for new (*.new) configuration files and new kernel images, and prompts you for what it should do.
The default value of POSTINST is "on".
From command line, you can use -postinst=value.
Does it work? I do not know. I have never tried as part of updating is dealing with any incoming .new files.
The conservative presumption with Slackware administration is the user decides how to handle config changes. Hence the installation of "dot new" files. The user is expected to compare the new config file with the existing config file and decide what changes to make or accept.
The slackpg prompts can be disabled in /etc/slapckpkg/slackpkg.conf.
To list the "dot new" files:
[sudo] find /etc -name *.new
To provide a basic interface to review *.new files, consider the dotnew package from the Salix repos. The package is compatible with the stock Slackware. Otherwise try:
Thanks for pointing that out. I am aware of that and my original question was not about the general handling of .new files. I personally use sudo slackpkg new-config for that purpose.
Thanks for pointing that out. I am aware of that and my original question was not about the general handling of .new files. I personally use sudo slackpkg new-config for that purpose.
In that case, why not set the following to off?
Code:
# Enables (on) or disables (off) slackpkg's post-installation features, such
# as checking for new (*.new) configuration files and new kernel images, and
# prompts you for what it should do. Default=on
POSTINST=on
I really should read the thread before posting.
Last edited by Richard Cranium; 10-24-2019 at 11:14 PM.
From my current recollection, there's no easy way to override built-in functions. However, you could do something like this:
Rename /usr/libexec/slackpkg/functions.d/post-functions.sh to e.g. stock-post-functions.sh, then create a new post-functions.sh that first sources the renamed file and then redefines the looknew() function to do what you want it to do.
A better approach would be, instead of the renaming business, to create a new file in functions.d/ with your looknew() redefinition, and then append a line to the post-functions.sh to source your redefinition file.
Either of those approaches will break when the slackpkg package is upgraded or reinstalled, but the latter approach is less maintenance intensive, as it only requires re-adding the append line to the stock post-functions.sh file.
From my current recollection, there's no easy way to override built-in functions...
I agree that built in functions are not easy to override. A "wrapper" script(s) to use the functionality already available is a good alternative. For the OP a wrapper script would include for example:
Code:
slackpkg -postinst=off upgrade-all
or
POSTINST=off slackpkg upgrade-all
followed by:
Code:
slackpkg -only_new_dotnew=on upgrade-all
or
ONLY_NEW_DOTNEW=on slackpkg new-config
Both configuration options work. allend already quoted the POSTINST option above. Here's the ONLY_NEW_DOTNEW option from 'man slackpkg.conf':
Quote:
ONLY_NEW_DOTNEW
When POSTINST is set to "on", slackpkg will search for all .new files inside /etc and
prompt the user for what to do with them. However, some users prefer to see only the
.new files installed in slackpkg's last execution, so if this applies to you, set
ONLY_NEW_DOTNEW to "on".
The default value of ONLY_NEW_DOTNEW is "off". Only change this if you know what are
you doing...
From command line, you can use -only_new_dotnew=value.
I use a wrapper script for slackpkg that includes variations of both commands.
Awhile ago I patched pkgtools on my system to only create a .new file when the upstream (default) config has changed. I was getting tired of it asking me to look at differences in config files just because I edited something in the one on disk, and the .new file would just overwrite those changes. My solution doesn't involve slackpkg. The downside is that I need to keep a copy of the default config, but that doesn't bother me. To me, the OP's request could be risky, because sometimes default config files change upstream for a good reason, and leaving the old config file in place might cause stability or security issues.
Last edited by montagdude; 10-30-2019 at 09:10 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.