Archiv verlassen und diese Seite im Standarddesign anzeigen : Kleine Bash Frage
Hallo, irgendwie krieg ichs net hin (: Immer wenn ich ein emerge -Dau world (gentoo) mache muss ich soviele Configs updaten. Das mach ich dann mit denen wo ich was angepasst habe. Aber viele will ich einfach default übernehmen.
Daher bräucht ich etwas was folgendes macht:
Alle Dateien in /etc die nach dem Schema ._cfg????_filename aufgebaut sind nach filename umbenennen und davor filename nach filename.backup`date +%F` umbenennen.
Also z.B.: /etc/conf.d/._cfg0000_net.example
Zuerst: /etc/conf.d/net.example => /etc/conf.d/net.example.backup`date +%F`
Dann: /etc/conf.d/._cfg0000_net.example => /etc/conf.d/net.example
muss es denn unbedingt bash sein?
mit perl könntest du z.B. ganz einfach nen regulären ausdruck auf die dateinamen loslassen und bei "erfolg" die dateien ensprechend umbenennen.
drdope
2006-08-21, 20:15:23
Many people have posted on the forums about their problems with the etc-update script which
is used for updating protected config files. As a result I decided to write an easy to use
script with a smart auto-update function, but without the risk of breaking your system.
I also added the possibility to use GUI diff/merge tools for updating all configuration
files that contain your customized settings. Combined with automatic backups this makes
a perfectly safe and convenient alternative for updating your configuration files.
The cfg-update script will check if a file, you are about to update, has been modified by you
after it was installed. If it hasn't been modified by you it means that it can be automatically
replaced with the new version of that particular configuration file. But if the file has
been modified by you, it will check if it can do an automatic 3-way merge. If the file has been
updated before, there is a backup of the previous ._cfg0000_file and cfg-update can use it as
an ancestor file for the 3-way merge. It will first try the automatic 3-way merge with diff3
but if it finds a merge-conflict it will re-schedule the file for manual updating in your
preferred diff/merge tool, together with all the modified files that couldn't be automatically
replaced or 3-way merged.
The script will present both the old and new version in a graphical diff/merge tool (xxdiff,
kdiff3, meld or others) which allows you to simply click on the lines you want to keep or add.
After updating your config files you can always restore the previous version and retry updating
because cfg-update backups both the new and old version of config files before it completes an update...
http://forums.gentoo.org/viewtopic.php?t=86622
;)
vBulletin®, Copyright ©2000-2024, Jelsoft Enterprises Ltd.