diff --git a/etc/bash_completion.d/wp-cli b/bash_completion.d/wp-cli similarity index 100% rename from etc/bash_completion.d/wp-cli rename to bash_completion.d/wp-cli diff --git a/usr/local/bin/wp-create-db-user-from-config.sh b/bin/wp-create-db-user-from-config.sh similarity index 100% rename from usr/local/bin/wp-create-db-user-from-config.sh rename to bin/wp-create-db-user-from-config.sh diff --git a/usr/local/bin/wp-installer.sh b/bin/wp-installer.sh similarity index 100% rename from usr/local/bin/wp-installer.sh rename to bin/wp-installer.sh diff --git a/etc/fail2ban/filter.d/wp-auth.conf b/fail2ban/filter.d/wp-auth.conf similarity index 100% rename from etc/fail2ban/filter.d/wp-auth.conf rename to fail2ban/filter.d/wp-auth.conf diff --git a/etc/fail2ban/filter.d/xmlrpc.conf b/fail2ban/filter.d/xmlrpc.conf similarity index 100% rename from etc/fail2ban/filter.d/xmlrpc.conf rename to fail2ban/filter.d/xmlrpc.conf diff --git a/etc/fail2ban/jail.d/wp-auth.conf b/fail2ban/jail.d/wp-auth.conf similarity index 100% rename from etc/fail2ban/jail.d/wp-auth.conf rename to fail2ban/jail.d/wp-auth.conf diff --git a/etc/fail2ban/jail.d/xmlrpc.conf b/fail2ban/jail.d/xmlrpc.conf similarity index 100% rename from etc/fail2ban/jail.d/xmlrpc.conf rename to fail2ban/jail.d/xmlrpc.conf diff --git a/install.sh b/install.sh index 12c582a..e75de8f 100755 --- a/install.sh +++ b/install.sh @@ -16,30 +16,30 @@ sudo mv wp-cli.phar /usr/local/bin/wp chmod +x /usr/local/bin/wp # configure wp-cli bash completion -cp etc/bash_completion.d/wp-cli /etc/bash_completion.d/ +cp bash_completion.d/wp-cli /etc/bash_completion.d/ chmod 644 /etc/bash_completion.d/wp-cli # install wp user scripts -cp usr/local/bin/wp-* /usr/local/bin +cp bin/wp-* /usr/local/bin chmod 755 /usr/local/bin/wp-* # install & enable wp systemd cron -cp usr/local/sbin/wp-cron.sh /usr/local/sbin/ +cp sbin/wp-cron.sh /usr/local/sbin/ chmod 755 /usr/local/sbin/wp-cron.sh if [[ ! -d /usr/local/lib/systemd/system ]]; then mkdir -p /usr/local/lib/systemd/system fi -cp usr/local/lib/systemd/system/wp-cron.* /usr/local/lib/systemd/system/ +cp systemd/wp-cron.* /usr/local/lib/systemd/system/ chmod 644 /usr/local/lib/systemd/system/wp-cron.* systemctl enable wp-cron.timer systemctl start wp-cron.timer # fail2ban wordpress configs if [[ -d /etc/fail2ban/ ]]; then - chmod 644 etc/fail2ban/filter.d/ - cp -a etc/fail2ban/filter.d/* /etc/fail2ban/filter.d/ - chmod 644 etc/fail2ban/jail.d/ - cp -a etc/fail2ban/jail.d/* /etc/fail2ban/jail.d/ + chmod 644 fail2ban/filter.d/* + cp -a fail2ban/filter.d/* /etc/fail2ban/filter.d/ + chmod 644 etc/fail2ban/jail.d/* + cp -a fail2ban/jail.d/* /etc/fail2ban/jail.d/ systemctl restart fail2ban else echo "Fail2ban not installed, skipping fail2ban wordpress configs." diff --git a/usr/local/sbin/wp-cron.sh b/sbin/wp-cron.sh similarity index 100% rename from usr/local/sbin/wp-cron.sh rename to sbin/wp-cron.sh diff --git a/usr/local/lib/systemd/system/wp-cron.service b/systemd/wp-cron.service similarity index 100% rename from usr/local/lib/systemd/system/wp-cron.service rename to systemd/wp-cron.service diff --git a/usr/local/lib/systemd/system/wp-cron.timer b/systemd/wp-cron.timer similarity index 100% rename from usr/local/lib/systemd/system/wp-cron.timer rename to systemd/wp-cron.timer diff --git a/update.sh b/update.sh index 6fa80de..f59e316 100755 --- a/update.sh +++ b/update.sh @@ -14,47 +14,47 @@ else fi # update scripts in bin -chmod 755 usr/local/bin/* -readarray -t bin_script_array < <(ls -1 usr/local/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 usr/local/bin/$bin_script /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 usr/local/bin/$bin_script /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 usr/local/bin/$bin_script /usr/local/bin/$bin_script + cp 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 +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 -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 +if ! diff -q sbin/wp-cron.sh /usr/local/sbin/wp-cron.sh ; then + cp 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 +if ! diff -q lib/systemd/system/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 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 +if ! diff -q lib/systemd/system/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 chmod 644 /usr/local/lib/systemd/system/wp-cron.timer echo "wp-cron.timer updated" echo @@ -63,29 +63,29 @@ fi # check fail2ban wordpress configs if [[ -d /etc/fail2ban/ ]]; then RESTARTF2B=false - if ! diff -q etc/fail2ban/filter.d/wp-auth.conf /etc/fail2ban/filter.d/wp-auth.conf ; then - cp etc/fail2ban/filter.d/wp-auth.conf /etc/fail2ban/filter.d/wp-auth.conf + if ! diff -q 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 chmod 644 /etc/fail2ban/filter.d/wp-auth.conf echo "fail2ban/filter.d/wp-auth.conf updated" echo RESTARTF2B=true fi - if ! diff -q etc/fail2ban/filter.d/xmlrpc.conf /etc/fail2ban/filter.d/xmlrpc.conf ; then - cp etc/fail2ban/filter.d/xmlrpc.conf /etc/fail2ban/filter.d/xmlrpc.conf + if ! diff -q fail2ban/filter.d/xmlrpc.conf /etc/fail2ban/filter.d/xmlrpc.conf ; then + cp fail2ban/filter.d/xmlrpc.conf /etc/fail2ban/filter.d/xmlrpc.conf chmod 644 /etc/fail2ban/filter.d/xmlrpc.conf echo "fail2ban/filter.d/xmlrpc.conf updated" echo RESTARTF2B=true fi - if ! diff -q etc/fail2ban/jail.d/wp-auth.conf /etc/fail2ban/jail.d/wp-auth.conf ; then - cp etc/fail2ban/jail.d/wp-auth.conf /etc/fail2ban/jail.d/wp-auth.conf + if ! diff -q 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 chmod 644 /etc/fail2ban/jail.d/wp-auth.conf echo "fail2ban/jail.d/wp-auth.conf updated" echo RESTARTF2B=true fi - if ! diff -q etc/fail2ban/jail.d/xmlrpc.conf /etc/fail2ban/jail.d/xmlrpc.conf ; then - cp etc/fail2ban/jail.d/xmlrpc.conf /etc/fail2ban/jail.d/xmlrpc.conf + if ! diff -q fail2ban/jail.d/xmlrpc.conf /etc/fail2ban/jail.d/xmlrpc.conf ; then + cp fail2ban/jail.d/xmlrpc.conf /etc/fail2ban/jail.d/xmlrpc.conf chmod 644 /etc/fail2ban/jail.d/xmlrpc.conf echo "fail2ban/jail.d/xmlrpc.conf updated" echo