Update wallos.sh
This commit is contained in:
parent
0791f32835
commit
ea6311e190
14
ct/wallos.sh
14
ct/wallos.sh
@ -55,24 +55,28 @@ function default_settings() {
|
|||||||
|
|
||||||
function update_script() {
|
function update_script() {
|
||||||
header_info
|
header_info
|
||||||
|
check_container_storage
|
||||||
|
check_container_resources
|
||||||
if [[ ! -d /opt/wallos ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
|
if [[ ! -d /opt/wallos ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
|
||||||
if (( $(df /boot | awk 'NR==2{gsub("%","",$5); print $5}') > 80 )); then
|
|
||||||
read -r -p "Warning: Storage is dangerously low, continue anyway? <y/N> " prompt
|
|
||||||
[[ ${prompt,,} =~ ^(y|yes)$ ]] || exit
|
|
||||||
fi
|
|
||||||
RELEASE=$(curl -s https://api.github.com/repos/ellite/Wallos/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
RELEASE=$(curl -s https://api.github.com/repos/ellite/Wallos/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||||
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
|
||||||
msg_info "Updating ${APP} to ${RELEASE}"
|
msg_info "Updating ${APP} to ${RELEASE}"
|
||||||
cd /opt
|
cd /opt
|
||||||
wget -q "https://github.com/ellite/Wallos/archive/refs/tags/v${RELEASE}.zip"
|
wget -q "https://github.com/ellite/Wallos/archive/refs/tags/v${RELEASE}.zip"
|
||||||
mv /opt/wallos/db/wallos.db /opt/wallos.db
|
mkdir -p /opt/uploads
|
||||||
|
if [ -f "/opt/wallos/db/wallos.db" ]; then
|
||||||
|
mv "/opt/wallos/db/wallos.db" "/opt/wallos.db"
|
||||||
|
fi
|
||||||
|
mv /opt/wallos/images/uploads/* /opt/uploads_backup/
|
||||||
unzip -q v${RELEASE}.zip
|
unzip -q v${RELEASE}.zip
|
||||||
rm -rf /opt/wallos
|
rm -rf /opt/wallos
|
||||||
mv Wallos-${RELEASE} /opt/wallos
|
mv Wallos-${RELEASE} /opt/wallos
|
||||||
rm -rf /opt/wallos/db/wallos.empty.db
|
rm -rf /opt/wallos/db/wallos.empty.db
|
||||||
mv /opt/wallos.db /opt/wallos/db/wallos.db
|
mv /opt/wallos.db /opt/wallos/db/wallos.db
|
||||||
|
mv /opt/uploads_backup/* /opt/wallos/images/uploads
|
||||||
chown -R www-data:www-data /opt/wallos
|
chown -R www-data:www-data /opt/wallos
|
||||||
chmod -R 755 /opt/wallos
|
chmod -R 755 /opt/wallos
|
||||||
|
mkdir -p /var/log/cron
|
||||||
curl http://localhost/endpoints/db/migrate.php &>/dev/null
|
curl http://localhost/endpoints/db/migrate.php &>/dev/null
|
||||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||||
msg_ok "Updated ${APP}"
|
msg_ok "Updated ${APP}"
|
||||||
|
Loading…
Reference in New Issue
Block a user