LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 06-06-2016, 04:16 PM   #1
stoa
Member
 
Registered: Dec 2013
Posts: 54

Rep: Reputation: Disabled
slackpkg new-config not finding .new files


Hi all:

I'm having a little problem with updating some config files. If I issue the command
Code:
root@slackware:~# slackpkg new-config


Searching for NEW configuration files
                No .new files found.
slackpkg tells me there are no .new files.

However,
Code:
root@slackware:~# find /etc -name "*.new"
/etc/passwd.new
/etc/shadow.new
says that there are.

I've looked through the /usr/sbin/slackpkg script, and the separate slackpkg functions file called by that script at /usr/libexec/slackpkg/core-functions.sh but I didn't find anything that would explain the above issue. I'm not that experienced at scripting, though.

I've also searched the net and this site without luck.

Any helpful ideas out there?
 
Old 06-06-2016, 04:19 PM   #2
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.2
Posts: 3,464

Rep: Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808
IIRC, if /etc/passwd.new has the exact same contents as /etc/passwd, you won't get the prompt. (Actually, I believe the md5sums of the files are compared for equality.) Actually, that's for all the *.new to * comparisons.

Wrong answer! See correct answers below.

Last edited by Richard Cranium; 06-06-2016 at 04:50 PM.
 
Old 06-06-2016, 04:20 PM   #3
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,230

Rep: Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724Reputation: 724
maybe they are blacklisted by slackpkg as it's highly unlikely one would want to let slackpkg update those files

edit: yes, try:
Code:
grep "shadow\|passwd" /usr/libexec/slackpkg/functions.d/*

Last edited by keefaz; 06-06-2016 at 04:27 PM.
 
Old 06-06-2016, 04:29 PM   #4
ponce
LQ Guru
 
Registered: Aug 2004
Location: Pisa, Italy
Distribution: Slackware
Posts: 5,000

Rep: Reputation: Disabled
Quote:
Originally Posted by stoa View Post
Hi all:

I'm having a little problem with updating some config files. If I issue the command
Code:
root@slackware:~# slackpkg new-config


Searching for NEW configuration files
                No .new files found.
slackpkg tells me there are no .new files.

However,
Code:
root@slackware:~# find /etc -name "*.new"
/etc/passwd.new
/etc/shadow.new
says that there are.

I've looked through the /usr/sbin/slackpkg script, and the separate slackpkg functions file called by that script at /usr/libexec/slackpkg/core-functions.sh but I didn't find anything that would explain the above issue. I'm not that experienced at scripting, though.

I've also searched the net and this site without luck.

Any helpful ideas out there?
yes, as keefaz just wrote (beating me as I was writing the same thing!), those file are between the ones that are excluded when finding the *.new: see the file /usr/libexec/slackpkg/functions.d/post-functions.sh
Code:
        FILES=$(find /etc -name "*.new" ${ONLY_NEW_DOTNEW} \
                -not -name "rc.inet1.conf.new" \
                -not -name "group.new" \
                -not -name "passwd.new" \
                -not -name "shadow.new" \
                -not -name "gshadow.new" 2>/dev/null)
 
Old 06-06-2016, 04:54 PM   #5
stoa
Member
 
Registered: Dec 2013
Posts: 54

Original Poster
Rep: Reputation: Disabled
Always a most helpful group - it is much appreciated.

That "blacklist" in /usr/libexec/slackpkg/core-functions.sh was exactly what I was looking for in the two files I initially referenced.

If I could impose further, as my scripting is weak, how does that post-functions.sh file get called? I can't find a reference to it in either the slackpkg script or the /usr/libexec/slackpkg/core-functions.sh script it directly references.

Mr. Cranium: Thanks, I'll save that info for another day - /etc/passwd had in fact changed, so that wasn't the issue, at least not in this particular case.
 
Old 06-06-2016, 05:49 PM   #6
allend
LQ 5k Club
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 5,278

Rep: Reputation: 1921Reputation: 1921Reputation: 1921Reputation: 1921Reputation: 1921Reputation: 1921Reputation: 1921Reputation: 1921Reputation: 1921Reputation: 1921Reputation: 1921
Quote:
how does that post-functions.sh file get called?
From /usr/sbin/slackpkg
Code:
#========================================================================
#
# READ EXTRA FUNCTIONS 
#

# If you want a new function or need a rewrite of an existing
# feature, you can put your new function in a shell script under
# /usr/libexec/slackpkg/functions.d/
#
# Remember - the new function scripts need to be executable
#
for i in /usr/libexec/slackpkg/functions.d/*.sh; do
        if [ -x $i ]; then
                . $i
        fi
done
This is a neat feature that makes it easy to customise slackpkg.

Last edited by allend; 06-06-2016 at 05:51 PM.
 
Old 06-06-2016, 06:05 PM   #7
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.2
Posts: 3,464

Rep: Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808
Quote:
Originally Posted by stoa View Post
Mr. Cranium: Thanks, I'll save that info for another day - /etc/passwd had in fact changed, so that wasn't the issue, at least not in this particular case.
What actually happens is that installpkg will remove the .new file if it is exact match of the file without the .new extension. So you shouldn't see a .new file in that case.

My earlier reply was pretty much spherically wrong: It is just as wrong no matter how you look at it.
 
Old 06-06-2016, 07:22 PM   #8
stoa
Member
 
Registered: Dec 2013
Posts: 54

Original Poster
Rep: Reputation: Disabled
Quote:
From /usr/sbin/slackpkg
aaand there it is! How many times I glossed right over that! Thank you so much.
 
Old 06-07-2016, 07:44 AM   #9
bassmadrigal
LQ Guru
 
Registered: Nov 2003
Location: West Jordan, UT, USA
Distribution: Slackware
Posts: 6,185

Rep: Reputation: 3924Reputation: 3924Reputation: 3924Reputation: 3924Reputation: 3924Reputation: 3924Reputation: 3924Reputation: 3924Reputation: 3924Reputation: 3924Reputation: 3924
Quote:
Originally Posted by Richard Cranium View Post
What actually happens is that installpkg will remove the .new file if it is exact match of the file without the .new extension. So you shouldn't see a .new file in that case.

My earlier reply was pretty much spherically wrong: It is just as wrong no matter how you look at it.
For further clarification, in case any are wondering, it actually only happens if the package maintainer (whether that be Pat, Eric, Robby, or one of the SBo package maintainers) adds checks for those files in the doinst.sh file within the package. The check that occurs is the code below (below that, you would just call the config function with the .new file). Basically, if nothing exists, it will remove the .new extension. If the other file already exists, it will do an MD5 hash for both files, and if they match, it will just delete the .new. If they don't, the .new will stay until you decide what to do with it.

Code:
config() {
  NEW="$1"
  OLD="$(dirname $NEW)/$(basename $NEW .new)"
  # If there's no config file by that name, mv it over:
  if [ ! -r $OLD ]; then
    mv $NEW $OLD
  elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
    # toss the redundant copy
    rm $NEW
  fi
  # Otherwise, we leave the .new copy for the admin to consider...
}
 
Old 06-07-2016, 11:37 AM   #10
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: Carrollton, Texas
Distribution: Slackware64 14.2
Posts: 3,464

Rep: Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808Reputation: 1808
src2pkg, IIRC, will put that in for you.

Then again, maybe I should quit while I can still see daylight out of the hole.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] Delete all .orig config files after slackpkg update process karthigan Slackware 4 12-09-2010 09:31 PM
Delete all .orig config files after slackpkg update process karthigan Slackware 3 12-08-2010 03:20 PM
Will a 'slackpkg upgrade-all overwrite my wireless config? mutexe Slackware 24 08-31-2009 06:44 AM
finding and using config files for xsane UGT001 Linux - General 2 04-17-2005 08:32 PM

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

All times are GMT -5. The time now is 02:46 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration