How to integrate changed files into the current system

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to integrate changed files into the current system

Karl Godt
Administrator
This post was updated on .
In the git $PWD .

Here is how I do it :

find -type f -mmin -240 | grep -v 'git'

Finds files that had been modified up to 240 minutes ago without the git files .
Gives me for example:

./woof-code/rootfs-skeleton/etc/rc.d/rc.shutdown

.

Now I set the unneeded "./woof-code/rootfs-skeleton" into a variable like so :

D='./woof-code/rootfs-skeleton'

. D for Delete .

find -type f -mmin -240 | grep -v 'git' | while read f ; do S=`echo "$f" | sed "s#$D##"`; echo $S; done

then  gives me

/etc/rc.d/rc.shutdown

. S for System .

find -type f -mmin -240 | grep -v 'git' | while read f ; do S=`echo "$f" | sed "s#$D##"`; echo $S; SD=${S%/*}; echo $SD;done

then gives me

/etc/rc.d/rc.shutdown
/etc/rc.d

. SD for SystemDirectory .

find -type f -mmin -240 | grep -v 'git' | while read f ; do S=`echo "$f" | sed "s#$D##"`; echo $S; SD=${S%/*}; echo $SD; cp -a --backup=numbered "$f" "$SD";done

now copies the changed file(s) in --archive mode to preserve file status, permissions and times and makes a backup of existing files before that they are overwritten :

ls -1 /etc/rc.d/rc.shutdown*

for example shows this :

/etc/rc.d/rc.shutdown
/etc/rc.d/rc.shutdown.~1~
/etc/rc.d/rc.shutdown.~2~

.

Voilá .

Now I can immediately test the modified file .

Loading...