#!/usr/bin/env spython # Einar Karttunen 9.6.2001 # this file must be distributed under GNU GPL import os import sys if os.getuid()!=0: print "!!! etc-update must be run by root" sys.exit(1) import commands import portage import string import re if not portage.settings["CONFIG_PROTECT"]: print "no CONFIG_PROTECTed directories" sys.exit(2) req = re.compile('\._cfg\d\d\d\d_') for d in string.split(portage.settings["CONFIG_PROTECT"]): if os.path.isdir(d): r = commands.getstatusoutput("find "+d+" -iname '._cfg????_*'") if r[0] == 0: for file in string.split(r[1]): path, bare = re.split(req,file) bare = path + bare print "new: "+file+" orig: "+bare os.system("diff -Bbs "+file+" "+bare) r = raw_input("overwrite old "+bare+" with new? [yN] ") if r == 'y': os.system('mv -fv '+file+' '+bare) else: print "error in 'find'"