Use full paths to be cron friendly
This commit is contained in:
parent
1513b43163
commit
5301cdac9b
1 changed files with 12 additions and 12 deletions
|
@ -29,21 +29,21 @@ function update() {
|
||||||
|
|
||||||
pushd "${tempdir}"
|
pushd "${tempdir}"
|
||||||
echo "Downloading..."
|
echo "Downloading..."
|
||||||
curl -L -O "${tarball_url}"
|
/usr/bin/curl -L -O "${tarball_url}"
|
||||||
curl -L -O "${gpg_url}"
|
/usr/bin/curl -L -O "${gpg_url}"
|
||||||
|
|
||||||
# GPG key of project
|
# GPG key of project
|
||||||
echo "Verifying the archive integrity..."
|
echo "Verifying the archive integrity..."
|
||||||
curl -s -O "https://github.com/RiotRobot.gpg"
|
/usr/bin/curl -s -O "https://github.com/RiotRobot.gpg"
|
||||||
gpg -o RiotRobot.ring --dearmor RiotRobot.gpg
|
/usr/bin/gpg -o RiotRobot.ring --dearmor RiotRobot.gpg
|
||||||
gpg --no-default-keyring --keyring ./RiotRobot.ring --verify "${gpg_file}"
|
/usr/bin/gpg --no-default-keyring --keyring ./RiotRobot.ring --verify "${gpg_file}"
|
||||||
|
|
||||||
echo "Extracting archive..."
|
echo "Extracting archive..."
|
||||||
tar xfv "${tarball_file}"
|
tar xfv "${tarball_file}"
|
||||||
folder_name=$(basename "${tarball_file}" .tar.gz)
|
folder_name=$(basename "${tarball_file}" .tar.gz)
|
||||||
# Update Element, but don't destroy the existing configuration
|
# Update Element, but don't destroy the existing configuration
|
||||||
echo "Copying new files..."
|
echo "Copying new files..."
|
||||||
rsync -rXH "${folder_name}/" "${destination}/" \
|
/usr/bin/rsync -rXH "${folder_name}/" "${destination}/" \
|
||||||
--delete \
|
--delete \
|
||||||
--exclude config.json \
|
--exclude config.json \
|
||||||
--chown "${WEB_USER}":"${WEB_USER}"
|
--chown "${WEB_USER}":"${WEB_USER}"
|
||||||
|
@ -58,24 +58,24 @@ trap 'cleanup ${tmpdir}' EXIT
|
||||||
HOMESERVER_URL="https://chat.dennogumi.org"
|
HOMESERVER_URL="https://chat.dennogumi.org"
|
||||||
DESTINATION_PATH="/srv/www/htdocs/chat.dennogumi.org"
|
DESTINATION_PATH="/srv/www/htdocs/chat.dennogumi.org"
|
||||||
WEB_USER="nginx"
|
WEB_USER="nginx"
|
||||||
github_data=$(curl -s https://api.github.com/repos/vector-im/element-web/releases/latest)
|
github_data=$(/usr/bin/curl -s https://api.github.com/repos/vector-im/element-web/releases/latest)
|
||||||
|
|
||||||
current_version=$(curl -s "${HOMESERVER_URL}/version")
|
current_version=$(/usr/bin/curl -s "${HOMESERVER_URL}/version")
|
||||||
remote_version=$(echo "${github_data}" | jq -r '.name')
|
remote_version=$(echo "${github_data}" | /usr/bin/jq -r '.name')
|
||||||
|
|
||||||
echo "Checking for version updates..."
|
echo "Checking for version updates..."
|
||||||
|
|
||||||
if version_gt "${remote_version}" "v${current_version}"
|
if version_gt "${remote_version}" "v${current_version}"
|
||||||
then
|
then
|
||||||
echo "New version found: ${remote_version}"
|
echo "New version found: ${remote_version}"
|
||||||
changelog=$(echo "${github_data}" | jq -r '.body')
|
changelog=$(echo "${github_data}" | /usr/bin/jq -r '.body')
|
||||||
echo "Changes in this version:"
|
echo "Changes in this version:"
|
||||||
echo "${changelog}"
|
echo "${changelog}"
|
||||||
asset_name=$(echo "${github_data}" | jq -r '.assets[] |
|
asset_name=$(echo "${github_data}" | /usr/bin/jq -r '.assets[] |
|
||||||
select(.browser_download_url|endswith("tar.gz")) |
|
select(.browser_download_url|endswith("tar.gz")) |
|
||||||
select(.name|startswith("riot")).browser_download_url')
|
select(.name|startswith("riot")).browser_download_url')
|
||||||
gpg_key_name=$(
|
gpg_key_name=$(
|
||||||
echo "${github_data}" | jq -r '.assets[] |
|
echo "${github_data}" | /usr/bin/jq -r '.assets[] |
|
||||||
select(.browser_download_url|endswith("asc")) |
|
select(.browser_download_url|endswith("asc")) |
|
||||||
select(.name|startswith("riot")).browser_download_url')
|
select(.name|startswith("riot")).browser_download_url')
|
||||||
echo "Updating Element.im from ${current_version} to ${remote_version}..."
|
echo "Updating Element.im from ${current_version} to ${remote_version}..."
|
||||||
|
|
Loading…
Add table
Reference in a new issue