Suggestion for UPGRADE.TXT (point 5: Fix your config files.)
by andrew.46 from LinuxQuestions.org on (#5GDGM)
I have a very small suggestion, with the upcoming Slackware 15 release, for point 5 in the file UPGRADE.TXT. This section deals with moving over config files with the '.new' extension. There is a small script suggested which copies files over and leaves a '.bak' backup behind. Just to refresh people's minds the script is as follows:
Code:#!/bin/sh
cd /etc
find . -name "*.new" | while read configfile ; do
if [ ! "$configfile" = "./rc.d/rc.inet1.conf.new" \
-a ! "$configfile" = "./rc.d/rc.local.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 --verbose $configfile $(echo $configfile | rev | cut -f 2- -d . | rev)
fi
doneThere are of course some sensible exclusions there and my suggestion is that the following file could be added to these:
Code:-a ! "$configfile" = "./rc.d/rc.modules.local.new" \Through my own blind use of this script (great script but stupid user) I inadvertently stopped DKMS module rebuilding my NVidia driver whenever I changed kernels. Fixed on my own system with the above line (and restored from the .bak file) but perhaps this might be a useful addition?
Mind you I guess the script could exclude all files in /etc that have the suffix '.local.new'?


Code:#!/bin/sh
cd /etc
find . -name "*.new" | while read configfile ; do
if [ ! "$configfile" = "./rc.d/rc.inet1.conf.new" \
-a ! "$configfile" = "./rc.d/rc.local.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 --verbose $configfile $(echo $configfile | rev | cut -f 2- -d . | rev)
fi
doneThere are of course some sensible exclusions there and my suggestion is that the following file could be added to these:
Code:-a ! "$configfile" = "./rc.d/rc.modules.local.new" \Through my own blind use of this script (great script but stupid user) I inadvertently stopped DKMS module rebuilding my NVidia driver whenever I changed kernels. Fixed on my own system with the above line (and restored from the .bak file) but perhaps this might be a useful addition?
Mind you I guess the script could exclude all files in /etc that have the suffix '.local.new'?