mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-02-13 11:19:16 +00:00
Clean-up.
This commit is contained in:
parent
816e81c49d
commit
15f995d190
@ -37,30 +37,17 @@ function update_script() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# 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) }')
|
msg_info "Updating $APP..."
|
||||||
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
|
apt-get update &>/dev/null
|
||||||
apt-get -y upgrade &>/dev/null
|
apt-get -y upgrade &>/dev/null
|
||||||
|
|
||||||
# Creating Backup
|
|
||||||
msg_info "Creating Backup"
|
|
||||||
mv "/opt/${APP}" "/opt/${APP}-backup"
|
|
||||||
msg_ok "Backup Created"
|
|
||||||
|
|
||||||
# Execute Update
|
# Execute Update
|
||||||
msg_info "Setting up 5etools"
|
msg_info "Updating 5etools"
|
||||||
wget -q "https://github.com/5etools-mirror-3/5etools-src/archive/refs/tags/${RELEASE}.zip"
|
cd /opt/5etools
|
||||||
unzip -q "${RELEASE}.zip" -d "/opt/${APP}"
|
git pull --recurse-submodules --jobs=10
|
||||||
rm -rf "${RELEASE}.zip"
|
cd ~
|
||||||
msg_ok "Set up 5etools"
|
msg_info "Updated 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"
|
|
||||||
msg_info "Set up 5etools images"
|
|
||||||
|
|
||||||
chown -R www-data: "/opt/${APP}"
|
chown -R www-data: "/opt/${APP}"
|
||||||
chmod -R 755 "/opt/${APP}"
|
chmod -R 755 "/opt/${APP}"
|
||||||
@ -70,20 +57,6 @@ function update_script() {
|
|||||||
$STD apt-get -y autoremove
|
$STD apt-get -y autoremove
|
||||||
$STD apt-get -y autoclean
|
$STD apt-get -y autoclean
|
||||||
msg_ok "Cleanup Completed"
|
msg_ok "Cleanup Completed"
|
||||||
|
|
||||||
# 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"
|
|
||||||
apache2ctl start
|
|
||||||
msg_ok "Started apache"
|
|
||||||
else
|
|
||||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
|
||||||
fi
|
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,8 +21,7 @@ $STD apt-get install -y \
|
|||||||
sudo \
|
sudo \
|
||||||
git \
|
git \
|
||||||
jq \
|
jq \
|
||||||
apache2 \
|
apache2
|
||||||
unzip
|
|
||||||
|
|
||||||
msg_ok "Installed Dependencies"
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
@ -36,17 +35,14 @@ echo "<Location /server-status>\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) }')
|
|
||||||
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"
|
git clone https://github.com/5etools-mirror-3/5etools-src /opt/5etools
|
||||||
unzip -q "${RELEASE}.zip" -d "/opt/5etools"
|
|
||||||
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/${IMG_RELEASE}.zip"
|
cd /opt/5etools
|
||||||
unzip -q "${IMG_RELEASE}.zip" -d "/opt/5etools/img"
|
git submodule add -f https://github.com/5etools-mirror-2/5etools-img "img"
|
||||||
rm -rf "${IMG_RELEASE}.zip"
|
git pull --recurse-submodules --jobs=10
|
||||||
|
cd ~
|
||||||
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
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user