ansible-roles/etc-git/files/etc-git-optimize

18 lines
424 B
Bash

#!/bin/sh
set -u
repositories="/etc /etc/bind/ /usr/share/scripts"
for repository in ${repositories}; do
if [ -d "${repository}/.git" ]; then
if [ ${repository} = "/usr/share/scripts" ]; then
mount -o remount,rw /usr
fi
git --git-dir="${repository}/.git" gc --quiet
if [ ${repository} = "/usr/share/scripts" ]; then
mount -o remount /usr
fi
fi
done