LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-02-2009, 01:27 AM   #1
james2b
Member
 
Registered: Feb 2007
Location: Washington state, USA
Distribution: Ubuntu Mate 18.04, Mint 19.1
Posts: 360

Rep: Reputation: 45
Question keep old or install new configuration files during slackpkg upgrade-all ?


Is it best to keep the old, or overwrite with the new configuration files which are found during a "slackpkg upgrade-all", run in a terminal as root for the newer software packages? First "slackpkg update" is run, and then I run; "slackpkg install-new", and last that upgrade-all command. And here is that tool; http://sourceforge.net/projects/slackpkg/
 
Old 03-02-2009, 02:23 AM   #2
samac
Senior Member
 
Registered: Mar 2004
Location: Kirkwall, Orkney
Distribution: Linux Mint 20.3 - Cinnamon
Posts: 1,425

Rep: Reputation: 139Reputation: 139
It depends if you have modified any of the configuration files. Slackpkg gives you the option to prompt for each file and to look at the differences. This will give you the information you need to make your decision.

samac
 
Old 03-02-2009, 02:52 AM   #3
james2b
Member
 
Registered: Feb 2007
Location: Washington state, USA
Distribution: Ubuntu Mate 18.04, Mint 19.1
Posts: 360

Original Poster
Rep: Reputation: 45
Question

I did try the prompt option, and then the (D)differences option for the first package. Then I could not enter any more commands in that terminal window since the "user-name#" cursor was not there to type, it just had a small box at the bottom of the terminal, so it was like stuck then ?
 
Old 03-02-2009, 03:32 AM   #4
samac
Senior Member
 
Registered: Mar 2004
Location: Kirkwall, Orkney
Distribution: Linux Mint 20.3 - Cinnamon
Posts: 1,425

Rep: Reputation: 139Reputation: 139
at that point you decide whether to keep or overwrite. I usually keep the old file and merge in any changes by text editor.

samac
 
Old 03-02-2009, 03:37 AM   #5
tommcd
Senior Member
 
Registered: Jun 2006
Location: Philadelphia PA USA
Distribution: Lubuntu, Slackware
Posts: 2,230

Rep: Reputation: 293Reputation: 293Reputation: 293
To find all the .new config files run:
Code:
find /etc -name "*.new"
To update the .new files run:
Code:
mv /etc/file_name.new /etc/file_name
 
1 members found this post helpful.
Old 03-02-2009, 04:04 AM   #6
niels.horn
Senior Member
 
Registered: Mar 2007
Location: Rio de Janeiro - Brazil
Distribution: Slackware64-current
Posts: 1,004

Rep: Reputation: 91
Or, if you skipped some .new files (used the option "K"eep), you can let slackpkg search for them again later with
Code:
slackpkg new-config
 
1 members found this post helpful.
Old 03-02-2009, 10:51 AM   #7
Michielvw
Member
 
Registered: May 2005
Location: Leicester,UK
Distribution: Slackware
Posts: 108

Rep: Reputation: 19
Personally I always keep the configs. Those configs that are unchanged between the new and the old packages are merged in principle anyway (see the doinst config() function in most packages).

Other than that, like I said, I keep the configs and as root I run `find /etc/ -name "*.new"' and diff all files by hand and then decide if they need to move over. I have found that colordiff (available at SlackBuilds.org) really makes things easier on my eyes there as well.
 
Old 03-08-2024, 05:57 PM   #8
linux91
Member
 
Registered: Feb 2004
Location: Williamson, New York, USA
Distribution: (Minix), SLS, Slackware 0.99-15, Current, Qubes-OS
Posts: 111

Rep: Reputation: 43
A very direct way to maintain new configurations in Slackware

This hasn't been updated in over a decade so maybe this will help someone or spark more efficient ways to maintain configuration files in Slackware.
A very simple revision control method may help keep configuration files sorted
out and available for comparison with new revisions.
More sophisticated methods exist using svn, mercurial, or even git, but this is
a very straight forward method.
A script may ease the process of processing new configuration files.
This could be automated further, but this a very basic way.

In this method, configuration file revisions are saved using the file modificaton date.
For example, a revision of a file
file.conf
is saved in the current directory as
file.conf.YYYYMMDD_hhmm
The more time consuming steps of this method involve retrieving and adding the
modification date.
A script can help here.
A script named cnm.sh was created to reduce the number of steps to create
revisions of configuration files.

Code:
#!/bin/bash
# file: cnm.sh
# date: 20240303
# desc: Make a copy of a file with a name using the modify date
# note: This script lives at /usr/local/sbin
# note: This script must be run from the command line as sudo
#       if in a system directory.
# note: make cnm.sh executable: sudo chmod +x /usr/local/sbin/cnm.sh
fname=$(basename -- "$1")
fext="${fname##*.}"
# echo $fext
if [[ $fext = "new" ]]; then
	cp -afp $1 `ls $1 | sed 's/\.new$//'`.`date -r $1 "+%Y%m%d_%H%M"`
else
	# Can't use $fname with filenames like slackpkg.conf
	cp -afp $1 $1.`date -r $1 "+%Y%m%d_%H%M"`
fi
The following is an example session which uses this script.

An upgrade with slackpkg may report several configuration files require attention.
Packages that had configuration changes
/etc/postfix/access.new
/etc/postfix/canonical.new
/etc/postfix/generic.new
/etc/postfix/header_checks.new
/etc/postfix/relocated.new
/etc/postfix/virtual.new
/etc/slackpkg/blacklist.new
/etc/slackpkg/mirrors.new
/etc/slackpkg/slackpkg.conf.new

So an example of a comparison and revision update session can be:
cd /etc/postfix/
sudo cnm access # make access.20230903_1339
sudo cnm access.new # make access.20240307_1458
sudo vi -d access access.new # modify access with access.new as necessary
sudo mv access.new access # or just replace with the new version

The as found listing for the postfix/access configuration files:
$ ls -l access*
-rw-r--r-- 1 root root 21111 Sep 3 2023 access
-rw-r--r-- 1 root root 21147 Mar 7 14:58 access.new

The as left listing for the postfix/access configuration files:
$ ls -l access*
-rw-r--r-- 1 root root 21147 Mar 7 14:58 access
-rw-r--r-- 1 root root 21111 Sep 3 2023 access.20230903_1339
-rw-r--r-- 1 root root 21147 Mar 7 14:58 access.20240307_1458

Most configurations are not uniquely modified and can be simply updated.
A quick review of the changes is always warranted prior to updating.
tkdiff is useful in these instances.
sudo cnm canonical
sudo cnm canonical.new
tkdiff cononical cononcial.new
sudo mv canonical.new canonical

sudo cnm generic
sudo cnm generic.new
tkdiff generic generic.new
sudo mv generic.new generic

sudo cnm header_checks
sudo cnm header_checks.new
tkdiff header_checks header_checks.new
sudo mv header_checks.new header_checks

sudo cnm relocated
sudo cnm relocated.new
tkdiff relocated relocated.new
sudo mv relocated.new relocated

sudo cnm virtual
sudo cnm virtual.new
tkdiff virtual virtual.new
sudo mv virtual.new virtual

Some new files are identical to existing revisions and are removed.
cd ../slackpkg/
sudo diff -s blacklist.20210531_1624 blacklist.new
Files blacklist.20210531_1624 and blacklist.new are identical
sudo rm blacklist.new

sudo diff -s mirrors.20240308_0939 mirrors.new
Files mirrors.20240308_0939 and mirrors.new are identical
sudo rm mirrors.new
 
3 members found this post helpful.
Old 03-13-2024, 10:33 AM   #9
r1w1s1
Member
 
Registered: Mar 2004
Location: São Paulo - Brazil
Distribution: Slackware
Posts: 66
Blog Entries: 1

Rep: Reputation: 42
Quote:
Originally Posted by linux91 View Post
This hasn't been updated in over a decade so maybe this will help someone or spark more efficient ways to maintain configuration files in Slackware.
A very simple revision control method may help keep configuration files sorted
out and available for comparison with new revisions.
More sophisticated methods exist using svn, mercurial, or even git, but this is
a very straight forward method.
A script may ease the process of processing new configuration files.
This could be automated further, but this a very basic way.

In this method, configuration file revisions are saved using the file modificaton date.
For example, a revision of a file
file.conf
is saved in the current directory as
file.conf.YYYYMMDD_hhmm
The more time consuming steps of this method involve retrieving and adding the
modification date.
A script can help here.
A script named cnm.sh was created to reduce the number of steps to create
revisions of configuration files.

Code:
#!/bin/bash
# file: cnm.sh
# date: 20240303
# desc: Make a copy of a file with a name using the modify date
# note: This script lives at /usr/local/sbin
# note: This script must be run from the command line as sudo
#       if in a system directory.
# note: make cnm.sh executable: sudo chmod +x /usr/local/sbin/cnm.sh
fname=$(basename -- "$1")
fext="${fname##*.}"
# echo $fext
if [[ $fext = "new" ]]; then
	cp -afp $1 `ls $1 | sed 's/\.new$//'`.`date -r $1 "+%Y%m%d_%H%M"`
else
	# Can't use $fname with filenames like slackpkg.conf
	cp -afp $1 $1.`date -r $1 "+%Y%m%d_%H%M"`
fi
The following is an example session which uses this script.

An upgrade with slackpkg may report several configuration files require attention.
Packages that had configuration changes
/etc/postfix/access.new
/etc/postfix/canonical.new
/etc/postfix/generic.new
/etc/postfix/header_checks.new
/etc/postfix/relocated.new
/etc/postfix/virtual.new
/etc/slackpkg/blacklist.new
/etc/slackpkg/mirrors.new
/etc/slackpkg/slackpkg.conf.new

So an example of a comparison and revision update session can be:
cd /etc/postfix/
sudo cnm access # make access.20230903_1339
sudo cnm access.new # make access.20240307_1458
sudo vi -d access access.new # modify access with access.new as necessary
sudo mv access.new access # or just replace with the new version

The as found listing for the postfix/access configuration files:
$ ls -l access*
-rw-r--r-- 1 root root 21111 Sep 3 2023 access
-rw-r--r-- 1 root root 21147 Mar 7 14:58 access.new

The as left listing for the postfix/access configuration files:
$ ls -l access*
-rw-r--r-- 1 root root 21147 Mar 7 14:58 access
-rw-r--r-- 1 root root 21111 Sep 3 2023 access.20230903_1339
-rw-r--r-- 1 root root 21147 Mar 7 14:58 access.20240307_1458

Most configurations are not uniquely modified and can be simply updated.
A quick review of the changes is always warranted prior to updating.
tkdiff is useful in these instances.
sudo cnm canonical
sudo cnm canonical.new
tkdiff cononical cononcial.new
sudo mv canonical.new canonical

sudo cnm generic
sudo cnm generic.new
tkdiff generic generic.new
sudo mv generic.new generic

sudo cnm header_checks
sudo cnm header_checks.new
tkdiff header_checks header_checks.new
sudo mv header_checks.new header_checks

sudo cnm relocated
sudo cnm relocated.new
tkdiff relocated relocated.new
sudo mv relocated.new relocated

sudo cnm virtual
sudo cnm virtual.new
tkdiff virtual virtual.new
sudo mv virtual.new virtual

Some new files are identical to existing revisions and are removed.
cd ../slackpkg/
sudo diff -s blacklist.20210531_1624 blacklist.new
Files blacklist.20210531_1624 and blacklist.new are identical
sudo rm blacklist.new

sudo diff -s mirrors.20240308_0939 mirrors.new
Files mirrors.20240308_0939 and mirrors.new are identical
sudo rm mirrors.new
Nice! I think the git approach is very nice! I used only for my personal dotfile but I think the same idea for configuration files.
 
Old 03-13-2024, 12:35 PM   #10
hitest
Guru
 
Registered: Mar 2004
Location: Canada
Distribution: Void, Slackware, Debian, OpenBSD
Posts: 7,345

Rep: Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746Reputation: 3746
I always choose K after # slackpkg upgrade-all.
 
1 members found this post helpful.
Old 03-13-2024, 01:00 PM   #11
Tonus
Senior Member
 
Registered: Jan 2007
Location: Paris, France
Distribution: Slackware-15.0
Posts: 1,407
Blog Entries: 3

Rep: Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514Reputation: 514
I always choose prompt, eventually diff, then overwrite or merge.

It may be cumbersome following -current if you let a few weeks between updates. Still, makes me feel secure.
 
Old 03-13-2024, 04:48 PM   #12
fourtysixandtwo
Member
 
Registered: Jun 2021
Location: Alberta
Distribution: Slackware...mostly
Posts: 325

Rep: Reputation: 216Reputation: 216Reputation: 216
Why not just use etckeeper (wrapper that uses git by default and adds file metadata, etc) from SBo? I've been using it for years now.

https://slackbuilds.org/repository/1...arch=etckeeper
 
1 members found this post helpful.
Old 03-14-2024, 10:37 PM   #13
linux91
Member
 
Registered: Feb 2004
Location: Williamson, New York, USA
Distribution: (Minix), SLS, Slackware 0.99-15, Current, Qubes-OS
Posts: 111

Rep: Reputation: 43
Many tailored configuration files are modified in ways that merging with a new file is difficult to automate, and will not provide a workable result. It seems that 'vi -d cnfg cnfg.new' has worked for the most part.
 
Old 03-15-2024, 06:19 AM   #14
chrisretusn
Senior Member
 
Registered: Dec 2005
Location: Philippines
Distribution: Slackware64-current
Posts: 2,979

Rep: Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556Reputation: 1556
Quote:
Originally Posted by james2b View Post
Is it best to keep the old, or overwrite with the new configuration files which are found during a "slackpkg upgrade-all"
It's not just upgrade-all, if you "upgrade" a single package or list of packages and there are changes to configuration files you will also be prompted.

The key is to know what configuration files you have made changes to. If you are using slackpkg-15.0.10, then you will see a list of files that have changed shown before the prompt. If you are certain that you have not made any changes to any of the listed configuration files then (O)verwrite should be the favored option. If you make a mistake, all is not lost. By default slackpkg backups up the original configuration file with the *.orig extension (ORIG_BACKUPS=on in slackpkg.conf). If needed you can merge needed changes in to the overwritten configuration file manually. Same applies to (K)eep, the *.new configuration file then be merged manually with the unchanged configuration file. I use (P)rompt if there are not a lot of changes and select (K)eep, (O)verwrite, (R)emove, (D)iff or (M)erge as needed (I've never tried using vimdiff) for each configuration file. If there is a boatload of changed files I will select (O)verwrite to enure changes to configuration files I have not modified are made and make adjustments to the configuration files I have modified using the backup. I use the (K)eep option mostly on configuration files that I know merge does not do well on. I merge those manually. I rarely use (R)emove, but the are times when it's appropriate.

One thing I try to do with all configuration files is to made the changes "friendly" for merging so that only the changed line(s) or added line(s) appear in the merge for picking left or right. Occasionally a manual edit/merge is required.

One of my favorite tools for doing merges between two configuration files not being handled by slackpkg is mc for *.new or *.orig files.
 
1 members found this post helpful.
Old 03-21-2024, 04:06 AM   #15
dchmelik
Senior Member
 
Registered: Nov 2008
Location: USA
Distribution: Slackware, FreeBSD, Illumos, NetBSD, DragonflyBSD, Plan9, Inferno, OpenBSD, FreeDOS, HURD
Posts: 1,074

Rep: Reputation: 149Reputation: 149
I tried to diff/merge but it was too difficult to figure out, so I had to keep configuration as I had and then compare/contrast changes and update manually.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to install .tgz files with the slackpkg tool james2b Slackware 6 12-16-2008 06:49 PM
Upgrade with slackpkg STARHARVEST Slackware 11 05-17-2008 07:07 PM
slackpkg and jre upgrade uselpa Slackware 5 07-23-2005 09:47 AM
dist upgrade with slackpkg cb951303 Slackware 7 06-20-2005 08:59 PM
slackpkg upgrade _mu_ Slackware 9 01-29-2004 08:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:40 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration