Add check for current tag
This commit is contained in:
parent
d1f54072d4
commit
f23f051c0d
1 changed files with 34 additions and 28 deletions
|
@ -91,34 +91,40 @@ if [ "${DEBUG}" == "true" ]; then
|
||||||
echo "Changing to Mastodon's home directory '${mastodon_home}'..."
|
echo "Changing to Mastodon's home directory '${mastodon_home}'..."
|
||||||
fi
|
fi
|
||||||
cd "${mastodon_home}" || exit 3
|
cd "${mastodon_home}" || exit 3
|
||||||
if [ "${DEBUG}" == "true" ]; then
|
current_tag=$(git name-rev --name-only HEAD | awk 'BEGIN {FS="/"} {print($2)}')
|
||||||
echo "Fetching from repository..."
|
if [ "${current_tag}" != "${tag}" ]; then
|
||||||
fi
|
|
||||||
"${pre_command}"sudo -u mastodon git fetch
|
|
||||||
if [ "${DEBUG}" == "true" ]; then
|
|
||||||
echo "Changing to reference '${tag}'..."
|
|
||||||
fi
|
|
||||||
"${pre_command}"sudo -u mastodon git checkout "${tag}"
|
|
||||||
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"
|
|
||||||
if [ "${dummy}" == "true" ]; then
|
|
||||||
echo "sudo -u postgres pg_dump mastodon | gzip -c > \"${backup_file}\""
|
|
||||||
else
|
|
||||||
if [ "${DEBUG}" == "true" ]; then
|
if [ "${DEBUG}" == "true" ]; then
|
||||||
echo "Creating a backup of the database in '${backup_file}'..."
|
echo "Fetching from repository..."
|
||||||
fi
|
fi
|
||||||
sudo -u postgres pg_dump mastodon | gzip -c > "${backup_file}"
|
"${pre_command}"sudo -u mastodon git fetch
|
||||||
|
if [ "${DEBUG}" == "true" ]; then
|
||||||
|
echo "Changing to reference '${tag}'..."
|
||||||
|
fi
|
||||||
|
"${pre_command}"sudo -u mastodon git checkout "${tag}"
|
||||||
|
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"
|
||||||
|
if [ "${dummy}" == "true" ]; then
|
||||||
|
echo "sudo -u postgres pg_dump mastodon | gzip -c > \"${backup_file}\""
|
||||||
|
else
|
||||||
|
if [ "${DEBUG}" == "true" ]; then
|
||||||
|
echo "Creating a backup of the database in '${backup_file}'..."
|
||||||
|
fi
|
||||||
|
sudo -u postgres pg_dump mastodon | gzip -c > "${backup_file}"
|
||||||
|
fi
|
||||||
|
if [ "${DEBUG}" == "true" ]; then
|
||||||
|
echo "Running bundle install..."
|
||||||
|
fi
|
||||||
|
"${pre_command}"sudo -u mastodon bundle install
|
||||||
|
if [ "${DEBUG}" == "true" ]; then
|
||||||
|
echo "Running yarm install..."
|
||||||
|
fi
|
||||||
|
"${pre_command}"sudo -u mastodon yarn install --frozen-lockfile
|
||||||
|
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
|
||||||
|
else
|
||||||
|
echo "Current branch is already '${tag}'"
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
if [ "${DEBUG}" == "true" ]; then
|
|
||||||
echo "Running bundle install..."
|
|
||||||
fi
|
|
||||||
"${pre_command}"sudo -u mastodon bundle install
|
|
||||||
if [ "${DEBUG}" == "true" ]; then
|
|
||||||
echo "Running yarm install..."
|
|
||||||
fi
|
|
||||||
"${pre_command}"sudo -u mastodon yarn install --frozen-lockfile
|
|
||||||
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
|
|
||||||
|
|
Loading…
Reference in a new issue