Only copy files which have changed

This commit is contained in:
Bob Mottram 2017-08-05 21:16:37 +01:00
parent f703a95971
commit bbcc17f2d1
3 changed files with 44 additions and 7 deletions

View File

@ -326,9 +326,25 @@ function encrypt_all_email {
fi
if [ -f /usr/local/bin/${PROJECT_NAME}-encrypt-mail ]; then
cp -u /usr/local/bin/${PROJECT_NAME}-encrypt-mail /usr/bin/encmaildir
if [ ! -f /usr/bin/encmaildir ]; then
cp /usr/local/bin/${PROJECT_NAME}-encrypt-mail /usr/bin/encmaildir
else
HASH1=$(sha256sum /usr/local/bin/${PROJECT_NAME}-encrypt-mail | awk -F ' ' '{print $1}')
HASH2=$(sha256sum /usr/bin/encmaildir | awk -F ' ' '{print $1}')
if [[ "$HASH1" != "$HASH2" ]]; then
cp /usr/local/bin/${PROJECT_NAME}-encrypt-mail /usr/bin/encmaildir
fi
fi
else
cp -u /usr/bin/${PROJECT_NAME}-encrypt-mail /usr/bin/encmaildir
if [ ! -f /usr/bin/encmaildir ]; then
cp /usr/bin/${PROJECT_NAME}-encrypt-mail /usr/bin/encmaildir
else
HASH1=$(sha256sum /usr/bin/${PROJECT_NAME}-encrypt-mail | awk -F ' ' '{print $1}')
HASH2=$(sha256sum /usr/bin/encmaildir | awk -F ' ' '{print $1}')
if [[ "$HASH1" != "$HASH2" ]]; then
cp /usr/bin/${PROJECT_NAME}-encrypt-mail /usr/bin/encmaildir
fi
fi
fi
if [[ $(is_completed $FUNCNAME) == "1" ]]; then

View File

@ -90,10 +90,13 @@ function firewall_block_bad_ip_ranges {
function global_rate_limit {
if ! grep -q "tcp_challenge_ack_limit" /etc/sysctl.conf; then
echo 'net.ipv4.tcp_challenge_ack_limit = 999999999' >> /etc/sysctl.conf
sysctl -p -q
else
sed -i 's|net.ipv4.tcp_challenge_ack_limit.*|net.ipv4.tcp_challenge_ack_limit = 999999999|g' /etc/sysctl.conf
if ! grep -q "net.ipv4.tcp_challenge_ack_limit = 999999999" /etc/sysctl.conf; then
sed -i 's|net.ipv4.tcp_challenge_ack_limit.*|net.ipv4.tcp_challenge_ack_limit = 999999999|g' /etc/sysctl.conf
sysctl -p -q
fi
fi
sysctl -p -q
}
function enable_ipv6 {

View File

@ -95,13 +95,31 @@ function set_repo_commit {
chown -R www-data:www-data $repo_dir
fi
if [[ $repo_dir == *"gpgit" ]]; then
cp -u gpgit.pl /usr/bin/gpgit.pl
if [ ! -f /usr/bin/gpgit.pl ]; then
cp gpgit.pl /usr/bin/gpgit.pl
else
HASH1=$(sha256sum gpgit.pl | awk -F ' ' '{print $1}')
HASH2=$(sha256sum /usr/bin/gpgit.pl | awk -F ' ' '{print $1}')
if [[ "$HASH1" != "$HASH2" ]]; then
cp gpgit.pl /usr/bin/gpgit.pl
fi
fi
fi
if [[ $repo_dir == *"cleanup-maildir" ]]; then
cp -u $INSTALL_DIR/cleanup-maildir/cleanup-maildir /usr/bin
if [ ! -f /usr/bin/cleanup-maildir ]; then
cp $INSTALL_DIR/cleanup-maildir/cleanup-maildir /usr/bin
else
HASH1=$(sha256sum $INSTALL_DIR/cleanup-maildir/cleanup-maildir | awk -F ' ' '{print $1}')
HASH2=$(sha256sum /usr/bin/cleanup-maildir | awk -F ' ' '{print $1}')
if [[ "$HASH1" != "$HASH2" ]]; then
cp $INSTALL_DIR/cleanup-maildir/cleanup-maildir /usr/bin
fi
fi
fi
if [[ $repo_dir == *"nginx_ensite" ]]; then
make install
if [ ! -f /usr/local/bin/nginx_ensite ]; then
make install
fi
fi
if [[ $repo_dir == *"inadyn" ]]; then
./configure