Only copy email archiving script if it has changed
This commit is contained in:
parent
5914a8c190
commit
6122296b59
|
@ -497,16 +497,35 @@ function email_archiving {
|
|||
|
||||
# ensure that the mail archive script is up to date
|
||||
if [ -f /usr/local/bin/${PROJECT_NAME}-archive-mail ]; then
|
||||
cp /usr/local/bin/${PROJECT_NAME}-archive-mail /etc/cron.daily/archivemail
|
||||
if [ ! -f /etc/cron.daily/archivemail ]; then
|
||||
cp /usr/local/bin/${PROJECT_NAME}-archive-mail /etc/cron.daily/archivemail
|
||||
chmod +x /etc/cron.daily/archivemail
|
||||
else
|
||||
HASH1=$(sha256sum /usr/local/bin/${PROJECT_NAME}-archive-mail | awk -F ' ' '{print $1}')
|
||||
HASH2=$(sha256sum /etc/cron.daily/archivemail | awk -F ' ' '{print $1}')
|
||||
if [[ "$HASH1" != "$HASH2" ]]; then
|
||||
cp /usr/local/bin/${PROJECT_NAME}-archive-mail /etc/cron.daily/archivemail
|
||||
chmod +x /etc/cron.daily/archivemail
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if [ -f /usr/bin/${PROJECT_NAME}-archive-mail ]; then
|
||||
cp /usr/bin/${PROJECT_NAME}-archive-mail /etc/cron.daily/archivemail
|
||||
if [ ! -f /etc/cron.daily/archivemail ]; then
|
||||
cp /usr/bin/${PROJECT_NAME}-archive-mail /etc/cron.daily/archivemail
|
||||
chmod +x /etc/cron.daily/archivemail
|
||||
else
|
||||
HASH1=$(sha256sum /usr/local/bin/${PROJECT_NAME}-archive-mail | awk -F ' ' '{print $1}')
|
||||
HASH2=$(sha256sum /etc/cron.daily/archivemail | awk -F ' ' '{print $1}')
|
||||
if [[ "$HASH1" != "$HASH2" ]]; then
|
||||
cp /usr/local/bin/${PROJECT_NAME}-archive-mail /etc/cron.daily/archivemail
|
||||
chmod +x /etc/cron.daily/archivemail
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo "/usr/bin/${PROJECT_NAME}-archive-mail was not found. ${PROJECT_NAME} might not have fully installed."
|
||||
exit 62379
|
||||
fi
|
||||
fi
|
||||
chmod +x /etc/cron.daily/archivemail
|
||||
|
||||
# update to the next commit
|
||||
function_check set_repo_commit
|
||||
|
|
Loading…
Reference in New Issue