Open main menu

Changes

621 bytes added ,  09:35, 22 September 2016
update to avoid recursive git repos
Say you want to keep track of changes to the configuration directory or file of some app. You also want to make it automatic and painless. Etckeeper leverages the commit hook in git to create that mirror. So, for example, the most critical aspect of your [[wiki]] is the <code>LocalSettings.php</code> configuration file. You don't want to commit the file to the version control of the project because it would expose sensitive data. etckeeper can be used to track changes to any file on the filesystem, but it's done discretely on the host.
git repos in the directories you want to track can cause problems. One useful addition is to filter out anything found in '.gitignore' per the discussion at https://stackoverflow.com/questions/13713101/rsync-exclude-according-to-gitignore-hgignore-svnignore-like-filter-c Or, since this script is just using rsync, you can add your own special cases as rsync calls
echo " $LOCAL_PATH"
mkdir -p $MIRROR_ROOT/$LOCAL_PATH
rsync -a --filter=':- .gitignore' $LOCAL_PATH/ $MIRROR_ROOT/$LOCAL_PATH
}
rsync -a $LOCAL_PATH $MIRROR_ROOT/$DIRPATH
}
 
# special case where we don't want to mirror a sub-directory
# we could also add a dummy .gitignore to the 'bin' directory
rsync -a --exclude=ansible/ /home/greg/bin/ $MIRROR_ROOT/home/greg/bin/
###########################################
mirror_file "/var/www/html/wiki/LocalSettings.php"
mirror_dir "/home/greg/data"
## Special case handled above## mirror_dir "/home/greg/bin"
</source>
4,558

edits