Skip to content

Instantly share code, notes, and snippets.

@phunehehe phunehehe/newconfig
Created Feb 25, 2011

Embed
What would you like to do?
In Gentoo, after updating you may see the message "IMPORTANT: <number> config files in '/etc' need updating.". This script looks for all the files that need to be updated, then overwrite old config files with new ones. Useful when there are a lot of new c
#! /bin/sh
# Update: There is no point using this, we have `etc-update'
for new_config in $(find /etc/ -name '._cfg????_*')
do
old_config=$(echo $new_config | sed 's:\([a-zA-Z0-9]*\)\._cfg[0-9]\{4\}_\([a-zA-Z0-9]*\):\1\2:')
if [[ -f "$new_config" || -f "$old_config" ]]
then
mv $new_config $old_config
else
echo "Something is wrong with $new_config ."
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.