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
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}"
apt-get update &>/dev/null
@ -72,7 +73,9 @@ function update_script() {
# Last Action
echo "${RELEASE}" >/opt/${APP}_version.txt
echo "${IMG_RELEASE}" >/opt/${APP}_IMG_version.txt
msg_ok "Updated $APP to ${RELEASE}"
msg_ok "Updated $APP images to ${IMG_RELEASE}"
# Starting httpd
msg_info "Starting apache"
@ -91,4 +94,4 @@ description
msg_ok "Completed Successfully!\n"
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:80${CL}"
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:80${CL}"

View File

@ -6,7 +6,7 @@
# Source: https://5e.tools/
# Import Functions und Setup
source /dev/stdin <<< "$FUNCTIONS_FILE_PATH"
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
color
verb_ip6
catch_errors
@ -28,24 +28,25 @@ msg_ok "Installed Dependencies"
# Setup App
msg_info "Setup 5etools"
echo "<Location /server-status>\n"\
" SetHandler server-status\n"\
" Order deny,allow\n"\
" Allow from all\n"\
"</Location>\n"\
>> /etc/apache2/apache2.conf
echo "<Location /server-status>\n""\
SetHandler server-status\n""\
Order deny,allow\n""\
Allow from all\n""\
</Location>\n" \
>>/etc/apache2/apache2.conf
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) }')
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"
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"
msg_ok "Set up 5etools"
msg_info "Setting up 5etools images"
wget -q "https://github.com/5etools-mirror-2/5etools-img/archive/refs/tags/${RELEASE}.zip"
unzip -q "${RELEASE}.zip" -d "/opt/${APP}/img"
rm -rf "${RELEASE}.zip"
wget -q "https://github.com/5etools-mirror-2/5etools-img/archive/refs/tags/${IMG_RELEASE}.zip"
unzip -q "${IMG_RELEASE}.zip" -d "/opt/5etools/img"
rm -rf "${IMG_RELEASE}.zip"
msg_info "Set up 5etools images"
ln -s "/opt/5etools" /var/www/html