diff --git a/files/update_mastodon.sh b/files/update_mastodon.sh index 14324b1..ad4f9a0 100755 --- a/files/update_mastodon.sh +++ b/files/update_mastodon.sh @@ -75,12 +75,6 @@ else fi fi -if [ "${dummy}" == "true" ]; then - pre_command="echo " -else - pre_command="" -fi - mastodon_home="$(grep "^mastodon:" /etc/passwd | awk 'BEGIN {FS=":"} {print($6)}')/live" if [ ! -d "${mastodon_home}" ]; then printf "The home for the user mastodon '%s', doesn't exist." "${mastodon_home}" @@ -96,11 +90,19 @@ if [ "${current_tag}" != "${tag}" ]; then if [ "${DEBUG}" == "true" ]; then echo "Fetching from repository..." fi - "${pre_command}"sudo -u mastodon git fetch + if [ "${dummy}" == "true" ]; then + echo sudo -u mastodon git fetch + else + sudo -u mastodon git fetch + fi if [ "${DEBUG}" == "true" ]; then echo "Changing to reference '${tag}'..." fi - "${pre_command}"sudo -u mastodon git checkout "${tag}" + if [ "${dummy}" == "true" ]; then + echo sudo -u mastodon git checkout "${tag}" + else + sudo -u mastodon git checkout "${tag}" + fi current_date=$(date +%Y-%m-%d-%H-%M-%S) mkdir -p /var/backups/postgres backup_file="/var/backups/postgres/pgdump_pre_update_mastodon_to_${tag}_${current_date}.sql.gz" @@ -115,15 +117,27 @@ if [ "${current_tag}" != "${tag}" ]; then if [ "${DEBUG}" == "true" ]; then echo "Running bundle install..." fi - "${pre_command}"sudo -u mastodon bundle install + if [ "${dummy}" == "true" ]; then + echo sudo -u mastodon bundle install + else + sudo -u mastodon bundle install + fi if [ "${DEBUG}" == "true" ]; then echo "Running yarm install..." fi - "${pre_command}"sudo -u mastodon yarn install --frozen-lockfile + if [ "${dummy}" == "true" ]; then + echo sudo -u mastodon yarn install --frozen-lockfile + else + sudo -u mastodon yarn install --frozen-lockfile + fi if [ "${DEBUG}" == "true" ]; then echo "Restarting Mastodon services..." fi - "${pre_command}"sudo systemctl restart mastodon-sidekiq.service mastodon-web.service mastodon-streaming mastodon-streaming@4000.service + if [ "${dummy}" == "true" ]; then + echo sudo systemctl restart mastodon-sidekiq.service mastodon-web.service mastodon-streaming mastodon-streaming@4000.service + else + sudo systemctl restart mastodon-sidekiq.service mastodon-web.service mastodon-streaming mastodon-streaming@4000.service + fi else echo "Current branch is already '${tag}'" exit 0 diff --git a/manifests/init.pp b/manifests/init.pp index 7307995..431a13b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -79,7 +79,7 @@ class mastodon ( String $db_user = 'mastodon', String $db_password = 'S3cr3TP4ssw0rd', Integer $db_port = 5432, - String $mastodon_version = 'v4.2.5', + String $mastodon_version = 'v4.2.7', String $ruby_version = '3.2.3', String $mastodon_user = 'mastodon', String $mastodon_group = 'mastodon',