62 lines
2.0 KiB
Bash
Executable File
62 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# update repo
|
|
git pull
|
|
|
|
# update wp-cli
|
|
if [ -f /usr/local/bin/wp ]; then
|
|
/usr/local/bin/wp cli update --yes --quiet --allow-root
|
|
else
|
|
# wp-cli not found, download & install
|
|
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
|
|
sudo mv wp-cli.phar /usr/local/bin/wp
|
|
chmod +x /usr/local/bin/wp
|
|
fi
|
|
|
|
# update scripts in bin
|
|
chmod 755 usr/local/bin/*
|
|
readarray -t bin_script_array < <(ls -1 usr/local/bin/)
|
|
for bin_script in "${bin_script_array[@]}"; do
|
|
if [ -f /usr/local/bin/$bin_script ]; then
|
|
if ! diff -q usr/local/bin/$bin_script /usr/local/bin/$bin_script ; then
|
|
echo "Updating /usr/local/bin/$bin_script"
|
|
cp usr/local/bin/$bin_script /usr/local/bin/$bin_script
|
|
echo
|
|
fi
|
|
else
|
|
echo "Adding new script /usr/local/bin/$bin_script"
|
|
cp usr/local/bin/$bin_script /usr/local/bin/$bin_script
|
|
echo
|
|
fi
|
|
done
|
|
|
|
# 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 wp-cron.sh for update
|
|
if ! diff -q usr/local/sbin/wp-cron.sh /usr/local/sbin/wp-cron.sh ; then
|
|
cp usr/local/sbin/wp-cron.sh /usr/local/sbin/wp-cron.sh
|
|
chmod 755 /usr/local/sbin/wp-cron.sh
|
|
echo "wp-cron.sh updated"
|
|
echo
|
|
fi
|
|
|
|
# check systemd timer for update
|
|
if ! diff -q usr/local/lib/systemd/system/wp-cron.service /usr/local/lib/systemd/system/wp-cron.service ; then
|
|
cp usr/local/lib/systemd/systemd/wp-cron.service /usr/local/lib/systemd/system/wp-cron.service
|
|
chmod 644 /usr/local/lib/systemd/system/wp-cron.service
|
|
echo "wp-cron.service updated"
|
|
echo
|
|
fi
|
|
if ! diff -q usr/local/lib/systemd/system/wp-cron.timer /usr/local/lib/systemd/system/wp-cron.timer ; then
|
|
cp usr/local/lib/systemd/system/wp-cron.timer /usr/local/lib/systemd/system/wp-cron.timer
|
|
chmod 644 /usr/local/lib/systemd/system/wp-cron.timer
|
|
echo "wp-cron.timer updated"
|
|
echo
|
|
fi
|