From de38c7fb1d169dc2c0952c2c47ec82745d9f65f4 Mon Sep 17 00:00:00 2001 From: Matthew Saunders Brown Date: Wed, 16 Nov 2022 14:08:21 -0800 Subject: [PATCH] use full paths for scripts --- .../bash_completion.d}/wp-cli | 0 install.sh | 8 ++--- update.sh | 32 +++++++++---------- .../bin}/wp-create-db-user-from-config.sh | 0 {bin => usr/local/bin}/wp-installer.sh | 0 .../local/lib/systemd/system}/wp-cron.service | 0 .../local/lib/systemd/system}/wp-cron.timer | 0 {sbin => usr/local/sbin}/wp-cron.sh | 0 8 files changed, 20 insertions(+), 20 deletions(-) rename {bash_completion.d => etc/bash_completion.d}/wp-cli (100%) rename {bin => usr/local/bin}/wp-create-db-user-from-config.sh (100%) rename {bin => usr/local/bin}/wp-installer.sh (100%) rename {systemd => usr/local/lib/systemd/system}/wp-cron.service (100%) rename {systemd => usr/local/lib/systemd/system}/wp-cron.timer (100%) rename {sbin => usr/local/sbin}/wp-cron.sh (100%) diff --git a/bash_completion.d/wp-cli b/etc/bash_completion.d/wp-cli similarity index 100% rename from bash_completion.d/wp-cli rename to etc/bash_completion.d/wp-cli diff --git a/install.sh b/install.sh index 6362976..61bba2c 100755 --- a/install.sh +++ b/install.sh @@ -16,20 +16,20 @@ sudo mv wp-cli.phar /usr/local/bin/wp chmod +x /usr/local/bin/wp # configure wp-cli bash completion -cp bash_completion.d/wp-cli /etc/bash_completion.d/ +cp etc/bash_completion.d/wp-cli /etc/bash_completion.d/ chmod 644 /etc/bash_completion.d/wp-cli # install wp user scripts -cp bin/wp-* /usr/local/bin +cp usr/local/bin/wp-* /usr/local/bin chmod 755 /usr/local/bin/wp-* # install & enable wp systemd cron -cp sbin/wp-cron.sh /usr/local/sbin/ +cp usr/local/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 systemd/wp-cron.* /usr/local/lib/systemd/system/ +cp usr/local/lib/systemd/system/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 diff --git a/update.sh b/update.sh index a3d3fcc..711b4db 100755 --- a/update.sh +++ b/update.sh @@ -14,48 +14,48 @@ else fi # update scripts in bin -chmod 755 bin/* -readarray -t bin_script_array < <(ls -1 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 bin/$bin_script /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 bin/$bin_script /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 bin/$bin_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 bash_completion.d/wp-cli /etc/bash_completion.d/wp-cli ; then - cp bash_completion.d/wp-cli /etc/bash_completion.d/wp-cli +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 sbin/wp-cron.sh /usr/local/sbin/wp-cron.sh ; then - cp sbin/wp-cron.sh /usr/local/sbin/wp-cron.sh +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 "sbin/wp-cron.sh updated" + echo "wp-cron.sh updated" echo fi # check systemd timer for update -if ! diff -q 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 +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 "systemd/wp-cron.service updated" + echo "wp-cron.service updated" echo fi -if ! diff -q systemd/wp-cron.timer /usr/local/lib/systemd/system/wp-cron.timer ; then - cp systemd/wp-cron.timer /usr/local/lib/systemd/system/wp-cron.timer +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 "systemd/wp-cron.timer updated" + echo "wp-cron.timer updated" echo fi diff --git a/bin/wp-create-db-user-from-config.sh b/usr/local/bin/wp-create-db-user-from-config.sh similarity index 100% rename from bin/wp-create-db-user-from-config.sh rename to usr/local/bin/wp-create-db-user-from-config.sh diff --git a/bin/wp-installer.sh b/usr/local/bin/wp-installer.sh similarity index 100% rename from bin/wp-installer.sh rename to usr/local/bin/wp-installer.sh diff --git a/systemd/wp-cron.service b/usr/local/lib/systemd/system/wp-cron.service similarity index 100% rename from systemd/wp-cron.service rename to usr/local/lib/systemd/system/wp-cron.service diff --git a/systemd/wp-cron.timer b/usr/local/lib/systemd/system/wp-cron.timer similarity index 100% rename from systemd/wp-cron.timer rename to usr/local/lib/systemd/system/wp-cron.timer diff --git a/sbin/wp-cron.sh b/usr/local/sbin/wp-cron.sh similarity index 100% rename from sbin/wp-cron.sh rename to usr/local/sbin/wp-cron.sh