LinuxQuestions.org
Visit Jeremy's Blog.
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 05-15-2008, 10:20 AM   #1
Lufbery
Senior Member
 
Registered: Aug 2006
Location: Harrisburg, PA
Distribution: Slackware 64 14.2
Posts: 1,180
Blog Entries: 29

Rep: Reputation: 135Reputation: 135
Question on script for .new files from UPGRADE.TXT


Hi all,

I'm upgrading Slackware from 12 to 12.1 and things have gone pretty well. I'm at the point where I need to work with the .new configuration files and I've got a question.

The UPGRADE.TXT file says:

Quote:
Fix your config files. Some of the config files in /etc are going to need your attention. You'll find the new incoming config files on your system with the ".new" extension. You may need to fill these in with information from your old config files and then move them over.

Feel brave? You can use this little script to install all of the .new config files in /etc. If you've made any local changes you'll need to add them to the newly installed files. Your old config files will be copied to *.bak. Anyway, it might be an easier starting point. Here it is:

Code:
   #!/bin/sh
   cd /etc
   find . -name "*.new" | while read configfile ; do
    if [ ! "$configfile" = "./rc.d/rc.inet1.conf.new" \
     -a ! "$configfile" = "./group.new" \
     -a ! "$configfile" = "./passwd.new" \
     -a ! "$configfile" = "./shadow.new" ]; then
     cp -a $(echo $configfile | rev | cut -f 2- -d . | rev) \
      $(echo $configfile | rev | cut -f 2- -d . | rev).bak 2> /dev/null
     mv $configfile $(echo $configfile | rev | cut -f 2- -d . | rev)
    fi
   done
My script-reading skills are still pretty shaky. Does this script just move the rc.inet1.conf, group, passwd, and shadow files, or does it NOT move those files?

Will this script find all the .new files and install them?

In short, what exactly does this script do?

Thanks,

-Drew
 
Old 05-15-2008, 10:28 AM   #2
jong357
Senior Member
 
Registered: May 2003
Location: Columbus, OH
Distribution: DIYSlackware
Posts: 1,914

Rep: Reputation: 52
if [ ! "$configfile" = "./rc.d/rc.inet1.conf.new" \
-a ! "$configfile" = "./group.new" \
-a ! "$configfile" = "./passwd.new" \
-a ! "$configfile" = "./shadow.new" ]; then

Basically it reads:

if whatever.new doesn't equal group, passwd, shadow or rc.inet1.conf then give the originals a .bak extension and then rename the new ones so they don't have a .new extension.

So it leaves those for your manual attention. The "!" is telling it to exclude those files. Remove that and then it will only handle those files.

Last edited by jong357; 05-15-2008 at 10:34 AM.
 
Old 05-15-2008, 10:40 AM   #3
jong357
Senior Member
 
Registered: May 2003
Location: Columbus, OH
Distribution: DIYSlackware
Posts: 1,914

Rep: Reputation: 52
Try adding a verbose switch to the mv command before you run it. Would be better to actually see what's going on IMO.

mv -v $configfile $(echo $configfile | rev | cut -f 2- -d . | rev)
 
Old 05-15-2008, 10:57 AM   #4
jong357
Senior Member
 
Registered: May 2003
Location: Columbus, OH
Distribution: DIYSlackware
Posts: 1,914

Rep: Reputation: 52
Code:
#!/bin/sh
   cd /etc
   find . -name "*.new" | while read configfile ; do
    if [ ! "$configfile" = "./rc.d/rc.inet1.conf.new" \
     -a ! "$configfile" = "./group.new" \
     -a ! "$configfile" = "./passwd.new" \
     -a ! "$configfile" = "./shadow.new" ]; then
     cp -a $(echo $configfile | rev | cut -f 2- -d . | rev) \
      $(echo $configfile | rev | cut -f 2- -d . | rev).bak 2> /dev/null
     mv -v $configfile $(echo $configfile | rev | cut -f 2- -d . | rev)
    else
     echo "$configfile needs your manual attention..."
    fi
   done
That would be a "better" (more informative) script....
 
Old 05-15-2008, 11:30 AM   #5
Lufbery
Senior Member
 
Registered: Aug 2006
Location: Harrisburg, PA
Distribution: Slackware 64 14.2
Posts: 1,180

Original Poster
Blog Entries: 29

Rep: Reputation: 135Reputation: 135
Jong,

Thanks for the reply. The gist is that the script leaves the four named configuration files alone and handles the rest.

Thanks!

I'll make the "verbose" change, run it, and see what happens.

Regards,

-Drew
 
Old 05-15-2008, 01:20 PM   #6
T3slider
Senior Member
 
Registered: Jul 2007
Distribution: Slackware64-14.1
Posts: 2,367

Rep: Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843Reputation: 843
You should also note that if you made any changes to the original 12.0 files, you will have to add those changes to the new 12.1 files. After running that script, the 12.1 config files will have the proper names and your 12.0 files will have *.bak names -- you can look through the .bak files (`find /etc -name *.bak` should show you all of the .bak files created) and add your changes to the new files (without the .bak extensions).
 
Old 05-15-2008, 01:59 PM   #7
Lufbery
Senior Member
 
Registered: Aug 2006
Location: Harrisburg, PA
Distribution: Slackware 64 14.2
Posts: 1,180

Original Poster
Blog Entries: 29

Rep: Reputation: 135Reputation: 135
Quote:
Originally Posted by T3slider View Post
You should also note that if you made any changes to the original 12.0 files, you will have to add those changes to the new 12.1 files. After running that script, the 12.1 config files will have the proper names and your 12.0 files will have *.bak names -- you can look through the .bak files (`find /etc -name *.bak` should show you all of the .bak files created) and add your changes to the new files (without the .bak extensions).
Thanks. I figured that was the point, but I was worried that the group, shadow, and passwd files would be changed.

When I add things to my configuration files, I usually put in a comment like:

## Added by me

That makes is a lot easier to see what I changed.

Regards,

-Drew
 
Old 05-15-2008, 02:11 PM   #8
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,443

Rep: Reputation: 73
You might also want to read HowTo Upgrade Slackware 12.0 to 12.1 and pay particular attention to the notes about the config files (such as those under /etc/modprobe.d).
 
Old 05-15-2008, 03:06 PM   #9
stu_mueller
Member
 
Registered: Aug 2006
Location: England
Distribution: Slackware, Zenwalk
Posts: 114

Rep: Reputation: 15
Sorry to butt in on this thread, but I have a question that seems relevant.

The passwd and group files have users and groups that you have created, how should these be handled when you upgrade. should the passwd.new be renamed to passwd, and any users you setup in your original passwd file just be copied over to the new passwd file?

Thats what I did on my upgrade but I'm not sure if thats right. It seems to have worked

Stuart
 
Old 05-15-2008, 03:46 PM   #10
shadowsnipes
Senior Member
 
Registered: Sep 2005
Distribution: Slackware
Posts: 1,443

Rep: Reputation: 73
Quote:
Originally Posted by stu_mueller View Post
Sorry to butt in on this thread, but I have a question that seems relevant.

The passwd and group files have users and groups that you have created, how should these be handled when you upgrade. should the passwd.new be renamed to passwd, and any users you setup in your original passwd file just be copied over to the new passwd file?

Thats what I did on my upgrade but I'm not sure if thats right. It seems to have worked

Stuart
From my upgrade HowTo
Quote:
/etc/group.new → Remove
/etc/passwd.new → Remove
/etc/shadow.new → Remove
/etc/gshadow.new → Remove
The new group and passwd files would only be useful if there were some new groups or users needed for some new feature, and something like that would have been mentioned in CHANGES_AND_HINTS.TXT. It wasn't so they were removed promptly.
 
  


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
shell script to move files from one system to another sytem with file names in a txt coral_km Linux - Newbie 3 02-13-2008 10:23 PM
script to convert msg files from outlook to txt frenchn00b Linux - General 3 10-03-2007 01:59 AM
Modify Perl script to work with txt - Permissions script joangopan Programming 4 09-14-2007 09:20 PM
UPGRADE.TXT over several releases mike_y Slackware 2 08-30-2006 01:38 AM
A cool script to search within a hell of TXT files guarriman Linux - General 7 12-08-2004 07:21 AM

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

All times are GMT -5. The time now is 01:11 AM.

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