Introduced image versions.

This commit is contained in:
Johanna Rührig 2025-01-01 15:50:02 +01:00
parent bc4810ef67
commit 816e81c49d
2 changed files with 17 additions and 13 deletions

View File

@ -38,7 +38,8 @@ function update_script() {
# Crawling the new version and checking whether an update is required # Crawling the new version and checking whether an update is required
RELEASE=$(curl -s https://api.github.com/repos/5etools-mirror-3/5etools-src/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') RELEASE=$(curl -s https://api.github.com/repos/5etools-mirror-3/5etools-src/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f "/opt/5etools_version.txt" ]]; then IMG_RELEASE=$(curl -s https://api.github.com/repos/5etools-mirror-2/5etools-img/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ "${IMG_RELEASE}" != "$(cat /opt/${APP}_IMG_version.txt)" ]] || [[ ! -f "/opt/5etools_version.txt" ]] || [[ ! -f "/opt/5etools_IMG_version.txt" ]]; then
msg_info "Updating $APP to ${RELEASE}" msg_info "Updating $APP to ${RELEASE}"
apt-get update &>/dev/null apt-get update &>/dev/null
@ -72,7 +73,9 @@ function update_script() {
# Last Action # Last Action
echo "${RELEASE}" >/opt/${APP}_version.txt echo "${RELEASE}" >/opt/${APP}_version.txt
echo "${IMG_RELEASE}" >/opt/${APP}_IMG_version.txt
msg_ok "Updated $APP to ${RELEASE}" msg_ok "Updated $APP to ${RELEASE}"
msg_ok "Updated $APP images to ${IMG_RELEASE}"
# Starting httpd # Starting httpd
msg_info "Starting apache" msg_info "Starting apache"

View File

@ -28,24 +28,25 @@ msg_ok "Installed Dependencies"
# Setup App # Setup App
msg_info "Setup 5etools" msg_info "Setup 5etools"
echo "<Location /server-status>\n"\ echo "<Location /server-status>\n""\
" SetHandler server-status\n"\ SetHandler server-status\n""\
" Order deny,allow\n"\ Order deny,allow\n""\
" Allow from all\n"\ Allow from all\n""\
"</Location>\n"\ </Location>\n" \
>>/etc/apache2/apache2.conf >>/etc/apache2/apache2.conf
rm -rf /var/www/html rm -rf /var/www/html
RELEASE=$(curl -s https://api.github.com/repos/5etools-mirror-3/5etools-src/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') RELEASE=$(curl -s https://api.github.com/repos/5etools-mirror-3/5etools-src/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
IMG_RELEASE=$(curl -s https://api.github.com/repos/5etools-mirror-2/5etools-img/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
msg_info "Setting up 5etools" msg_info "Setting up 5etools"
wget -q "https://github.com/5etools-mirror-3/5etools-src/archive/refs/tags/${RELEASE}.zip" wget -q "https://github.com/5etools-mirror-3/5etools-src/archive/refs/tags/${RELEASE}.zip"
unzip -q "${RELEASE}.zip" -d "/opt/${APP}" unzip -q "${RELEASE}.zip" -d "/opt/5etools"
rm -rf "${RELEASE}.zip" rm -rf "${RELEASE}.zip"
msg_ok "Set up 5etools" msg_ok "Set up 5etools"
msg_info "Setting up 5etools images" msg_info "Setting up 5etools images"
wget -q "https://github.com/5etools-mirror-2/5etools-img/archive/refs/tags/${RELEASE}.zip" wget -q "https://github.com/5etools-mirror-2/5etools-img/archive/refs/tags/${IMG_RELEASE}.zip"
unzip -q "${RELEASE}.zip" -d "/opt/${APP}/img" unzip -q "${IMG_RELEASE}.zip" -d "/opt/5etools/img"
rm -rf "${RELEASE}.zip" rm -rf "${IMG_RELEASE}.zip"
msg_info "Set up 5etools images" msg_info "Set up 5etools images"
ln -s "/opt/5etools" /var/www/html ln -s "/opt/5etools" /var/www/html