building out update script
This commit is contained in:
parent
605e17eb99
commit
ff87d250d7
52
update.sh
52
update.sh
|
@ -1,7 +1,47 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
git pull
|
|
||||||
chmod 755 bin/*
|
|
||||||
cp bin/* /usr/local/bin/
|
|
||||||
|
|
||||||
# do diffs on etc configs
|
# update repo
|
||||||
# update libexec/vmail-quota-warning.sh
|
git pull
|
||||||
|
|
||||||
|
# update scripts in bin
|
||||||
|
chmod 755 bin/*
|
||||||
|
readarray -t bin_script_array < <(ls -1 bin/)
|
||||||
|
for bin_script in "${bin_script_array[@]}"; do
|
||||||
|
if [ -f /usr/local/bin/$bin_script ]; then
|
||||||
|
if ! diff -q bin/$bin_script /usr/local/bin/$bin_script ; then
|
||||||
|
echo "Updating /usr/local/bin/$bin_script"
|
||||||
|
cp bin/$bin_script /usr/local/bin/$bin_script
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Adding new script /usr/local/bin/$bin_script"
|
||||||
|
cp bin/$bin_script /usr/local/bin/$bin_script
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# check etc configs for diffs
|
||||||
|
readarray -t etc_configs_array < <(find etc/ -type f)
|
||||||
|
for etc_config in "${etc_configs_array[@]}"; do
|
||||||
|
if [ -f /$etc_config ]; then
|
||||||
|
if ! diff -q $etc_config /$etc_config ; then
|
||||||
|
echo To update run:
|
||||||
|
echo diff $etc_config /$etc_config
|
||||||
|
echo cp $etc_config /$etc_config
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Adding new config file /$etc_config"
|
||||||
|
cp $etc_config /$etc_config
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# update libexec script
|
||||||
|
if ! diff -q libexec/vmail-quota-warning.sh /usr/libexec/vmail-quota-warning.sh ; then
|
||||||
|
cp libexec/vmail-quota-warning.sh /usr/libexec/vmail-quota-warning.sh
|
||||||
|
chmod 750 /usr/libexec/vmail-quota-warning.sh
|
||||||
|
chown dovecot:mail /usr/libexec/vmail-quota-warning.sh
|
||||||
|
echo "/usr/libexec/vmail-quota-warning.sh updated"
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user