fix update.sh to work with new file structure
This commit is contained in:
parent
538417f0e2
commit
4dba66458b
63
update.sh
63
update.sh
|
@ -14,78 +14,87 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# update scripts in bin
|
# update scripts in bin
|
||||||
chmod 755 bin/*
|
chmod 755 local/bin/*
|
||||||
readarray -t bin_script_array < <(ls -1 bin/)
|
readarray -t bin_script_array < <(ls -1 local/bin/)
|
||||||
for bin_script in "${bin_script_array[@]}"; do
|
for bin_script in "${bin_script_array[@]}"; do
|
||||||
if [ -f /usr/local/bin/$bin_script ]; then
|
if [ -f /usr/local/bin/$bin_script ]; then
|
||||||
if ! diff -q bin/$bin_script /usr/local/bin/$bin_script ; then
|
if ! diff -q local/bin/$bin_script /usr/local/bin/$bin_script ; then
|
||||||
echo "Updating /usr/local/bin/$bin_script"
|
echo "Updating /usr/local/bin/$bin_script"
|
||||||
cp bin/$bin_script /usr/local/bin/$bin_script
|
cp local/bin/$bin_script /usr/local/bin/$bin_script
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Adding new script /usr/local/bin/$bin_script"
|
echo "Adding new script /usr/local/bin/$bin_script"
|
||||||
cp bin/$bin_script /usr/local/bin/$bin_script
|
cp local/bin/$bin_script /usr/local/bin/$bin_script
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# check bash completion config for update
|
|
||||||
if ! diff -q bash_completion.d/wp-cli /etc/bash_completion.d/wp-cli ; then
|
|
||||||
cp bash_completion.d/wp-cli /etc/bash_completion.d/wp-cli
|
|
||||||
chmod 644 /etc/bash_completion.d/wp-cli
|
|
||||||
echo "bash completion config updated"
|
|
||||||
echo
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check wp-cron.sh for update
|
# check wp-cron.sh for update
|
||||||
if ! diff -q sbin/wp-cron.sh /usr/local/sbin/wp-cron.sh ; then
|
if ! diff -q local/sbin/wp-cron.sh /usr/local/sbin/wp-cron.sh ; then
|
||||||
cp sbin/wp-cron.sh /usr/local/sbin/wp-cron.sh
|
cp local/sbin/wp-cron.sh /usr/local/sbin/wp-cron.sh
|
||||||
chmod 755 /usr/local/sbin/wp-cron.sh
|
chmod 755 /usr/local/sbin/wp-cron.sh
|
||||||
echo "wp-cron.sh updated"
|
echo "wp-cron.sh updated"
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check systemd timer for update
|
# check systemd timer for update
|
||||||
if ! diff -q lib/systemd/system/wp-cron.service /usr/local/lib/systemd/system/wp-cron.service ; then
|
if ! diff -q local/systemd/wp-cron.service /usr/local/lib/systemd/system/wp-cron.service ; then
|
||||||
cp systemd/wp-cron.service /usr/local/lib/systemd/system/wp-cron.service
|
cp local/systemd/wp-cron.service /usr/local/lib/systemd/system/wp-cron.service
|
||||||
chmod 644 /usr/local/lib/systemd/system/wp-cron.service
|
chmod 644 /usr/local/lib/systemd/system/wp-cron.service
|
||||||
echo "wp-cron.service updated"
|
echo "wp-cron.service updated"
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
if ! diff -q lib/systemd/system/wp-cron.timer /usr/local/lib/systemd/system/wp-cron.timer ; then
|
if ! diff -q local/systemd/wp-cron.timer /usr/local/lib/systemd/system/wp-cron.timer ; then
|
||||||
cp lib/systemd/system/wp-cron.timer /usr/local/lib/systemd/system/wp-cron.timer
|
cp local/systemd/wp-cron.timer /usr/local/lib/systemd/system/wp-cron.timer
|
||||||
chmod 644 /usr/local/lib/systemd/system/wp-cron.timer
|
chmod 644 /usr/local/lib/systemd/system/wp-cron.timer
|
||||||
echo "wp-cron.timer updated"
|
echo "wp-cron.timer updated"
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# check apache wp-security config for update
|
||||||
|
if ! diff -q etc/apache2/conf-available/wp-security.conf /etc/apache2/conf-available/wp-security.conf ; then
|
||||||
|
cp etc/apache2/conf-available/wp-security.conf /etc/apache2/conf-available/wp-security.conf
|
||||||
|
chmod 644 /etc/apache2/conf-available/wp-security.conf
|
||||||
|
systemctl restart apache2
|
||||||
|
echo "wp-security updated"
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check bash completion config for update
|
||||||
|
if ! diff -q etc/bash_completion.d/wp-cli /etc/bash_completion.d/wp-cli ; then
|
||||||
|
cp etc/bash_completion.d/wp-cli /etc/bash_completion.d/wp-cli
|
||||||
|
chmod 644 /etc/bash_completion.d/wp-cli
|
||||||
|
echo "bash completion config updated"
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
# check fail2ban wordpress configs
|
# check fail2ban wordpress configs
|
||||||
if [[ -d /etc/fail2ban/ ]]; then
|
if [[ -d /etc/fail2ban/ ]]; then
|
||||||
RESTARTF2B=false
|
RESTARTF2B=false
|
||||||
if ! diff -q fail2ban/filter.d/wp-auth.conf /etc/fail2ban/filter.d/wp-auth.conf ; then
|
if ! diff -q etc/fail2ban/filter.d/wp-auth.conf /etc/fail2ban/filter.d/wp-auth.conf ; then
|
||||||
cp fail2ban/filter.d/wp-auth.conf /etc/fail2ban/filter.d/wp-auth.conf
|
cp etc/fail2ban/filter.d/wp-auth.conf /etc/fail2ban/filter.d/wp-auth.conf
|
||||||
chmod 644 /etc/fail2ban/filter.d/wp-auth.conf
|
chmod 644 /etc/fail2ban/filter.d/wp-auth.conf
|
||||||
echo "fail2ban/filter.d/wp-auth.conf updated"
|
echo "fail2ban/filter.d/wp-auth.conf updated"
|
||||||
echo
|
echo
|
||||||
RESTARTF2B=true
|
RESTARTF2B=true
|
||||||
fi
|
fi
|
||||||
if ! diff -q fail2ban/filter.d/xmlrpc.conf /etc/fail2ban/filter.d/xmlrpc.conf ; then
|
if ! diff -q etc/fail2ban/filter.d/xmlrpc.conf /etc/fail2ban/filter.d/xmlrpc.conf ; then
|
||||||
cp fail2ban/filter.d/xmlrpc.conf /etc/fail2ban/filter.d/xmlrpc.conf
|
cp etc/fail2ban/filter.d/xmlrpc.conf /etc/fail2ban/filter.d/xmlrpc.conf
|
||||||
chmod 644 /etc/fail2ban/filter.d/xmlrpc.conf
|
chmod 644 /etc/fail2ban/filter.d/xmlrpc.conf
|
||||||
echo "fail2ban/filter.d/xmlrpc.conf updated"
|
echo "fail2ban/filter.d/xmlrpc.conf updated"
|
||||||
echo
|
echo
|
||||||
RESTARTF2B=true
|
RESTARTF2B=true
|
||||||
fi
|
fi
|
||||||
if ! diff -q fail2ban/jail.d/wp-auth.conf /etc/fail2ban/jail.d/wp-auth.conf ; then
|
if ! diff -q etc/fail2ban/jail.d/wp-auth.conf /etc/fail2ban/jail.d/wp-auth.conf ; then
|
||||||
cp fail2ban/jail.d/wp-auth.conf /etc/fail2ban/jail.d/wp-auth.conf
|
cp etc/fail2ban/jail.d/wp-auth.conf /etc/fail2ban/jail.d/wp-auth.conf
|
||||||
chmod 644 /etc/fail2ban/jail.d/wp-auth.conf
|
chmod 644 /etc/fail2ban/jail.d/wp-auth.conf
|
||||||
echo "fail2ban/jail.d/wp-auth.conf updated"
|
echo "fail2ban/jail.d/wp-auth.conf updated"
|
||||||
echo
|
echo
|
||||||
RESTARTF2B=true
|
RESTARTF2B=true
|
||||||
fi
|
fi
|
||||||
if ! diff -q fail2ban/jail.d/xmlrpc.conf /etc/fail2ban/jail.d/xmlrpc.conf ; then
|
if ! diff -q etc/fail2ban/jail.d/xmlrpc.conf /etc/fail2ban/jail.d/xmlrpc.conf ; then
|
||||||
cp fail2ban/jail.d/xmlrpc.conf /etc/fail2ban/jail.d/xmlrpc.conf
|
cp etc/fail2ban/jail.d/xmlrpc.conf /etc/fail2ban/jail.d/xmlrpc.conf
|
||||||
chmod 644 /etc/fail2ban/jail.d/xmlrpc.conf
|
chmod 644 /etc/fail2ban/jail.d/xmlrpc.conf
|
||||||
echo "fail2ban/jail.d/xmlrpc.conf updated"
|
echo "fail2ban/jail.d/xmlrpc.conf updated"
|
||||||
echo
|
echo
|
||||||
|
|
Loading…
Reference in New Issue
Block a user