2025-11-02 23:49:54 -08:00
|
|
|
#!/usr/bin/env bash
|
2026-09-02 13:14:48 +02:00
|
|
|
_cs_boot="${COMMUNITY_SCRIPTS_CORE_DIR:-$(dirname "${BASH_SOURCE[0]}")/../../core}/core/build.func"
|
|
|
|
|
source "$_cs_boot" 2>/dev/null || source <(curl -fsSL "${COMMUNITY_SCRIPTS_CORE_URL:-https://raw.githubusercontent.com/community-scripts/core/main}/core/build.func")
|
2026-01-06 13:28:12 +01:00
|
|
|
# Copyright (c) 2021-2026 community-scripts ORG
|
2026-08-07 19:45:32 +02:00
|
|
|
# Author: MickLesk (CanbiZ) | Co-Author: Tom Frenzel (tomfrenzel)
|
2025-08-08 08:13:24 +02:00
|
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
|
|
|
# Source: https://github.com/danielbrendel/hortusfox-web
|
|
|
|
|
|
|
|
|
|
APP="HortusFox"
|
|
|
|
|
var_tags="${var_tags:-plants}"
|
|
|
|
|
var_cpu="${var_cpu:-2}"
|
|
|
|
|
var_ram="${var_ram:-2048}"
|
|
|
|
|
var_disk="${var_disk:-5}"
|
|
|
|
|
var_os="${var_os:-debian}"
|
2025-11-12 10:56:18 +01:00
|
|
|
var_version="${var_version:-13}"
|
2026-06-12 00:16:15 +10:00
|
|
|
var_arm64="${var_arm64:-yes}"
|
2025-08-08 08:13:24 +02:00
|
|
|
var_unprivileged="${var_unprivileged:-1}"
|
|
|
|
|
|
|
|
|
|
header_info "$APP"
|
|
|
|
|
variables
|
|
|
|
|
color
|
|
|
|
|
catch_errors
|
|
|
|
|
|
|
|
|
|
function update_script() {
|
|
|
|
|
header_info
|
|
|
|
|
check_container_storage
|
|
|
|
|
check_container_resources
|
|
|
|
|
if [[ ! -d /opt/hortusfox ]]; then
|
|
|
|
|
msg_error "No ${APP} Installation Found!"
|
|
|
|
|
exit
|
|
|
|
|
fi
|
2025-12-16 15:11:22 +01:00
|
|
|
setup_mariadb
|
2025-09-16 11:11:54 +02:00
|
|
|
if check_for_gh_release "hortusfox" "danielbrendel/hortusfox-web"; then
|
2025-08-08 08:13:24 +02:00
|
|
|
msg_info "Stopping Service"
|
|
|
|
|
systemctl stop apache2
|
|
|
|
|
msg_ok "Stopped Service"
|
|
|
|
|
|
2026-08-07 19:45:32 +02:00
|
|
|
cd /opt/hortusfox
|
|
|
|
|
if [[ ! -s app/migrations/migrations.list ]]; then
|
|
|
|
|
msg_info "Rebuilding HortusFox migration history"
|
|
|
|
|
local database_tables
|
|
|
|
|
database_tables="$(mariadb -u root -D hortusfox -NBe "SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = DATABASE();")"
|
|
|
|
|
: >app/migrations/migrations.list
|
|
|
|
|
local migration migration_file table_name
|
|
|
|
|
for migration in app/migrations/*.php; do
|
|
|
|
|
migration_file="${migration##*/}"
|
|
|
|
|
table_name="${migration_file%.php}"
|
|
|
|
|
if [[ "$migration_file" == "VersionModel.php" ]] || grep -Fxq "$table_name" <<<"$database_tables"; then
|
|
|
|
|
php -r 'echo hash("sha512", $argv[1]), PHP_EOL;' -- "$migration_file" >>app/migrations/migrations.list
|
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
msg_ok "Rebuilt HortusFox migration history"
|
|
|
|
|
fi
|
|
|
|
|
if [[ ! -f app/migrations/verhist.json && -f ~/.hortusfox ]]; then
|
|
|
|
|
printf '["%s"]\n' "$(<~/.hortusfox)" >app/migrations/verhist.json
|
|
|
|
|
fi
|
|
|
|
|
|
2026-10-03 08:19:10 +02:00
|
|
|
create_backup /opt/hortusfox/.env \
|
2026-08-07 19:45:32 +02:00
|
|
|
/opt/hortusfox/app/migrations/migrations.list \
|
|
|
|
|
/opt/hortusfox/app/migrations/verhist.json \
|
|
|
|
|
/opt/hortusfox/public/img \
|
|
|
|
|
/opt/hortusfox/public/themes
|
2025-08-08 08:13:24 +02:00
|
|
|
|
2026-10-03 08:19:10 +02:00
|
|
|
CLEAN_INSTALL=1 CLEAN_INSTALL_KEEP="public/attachments public/backup public/exports public/snd" fetch_and_deploy_gh_release "hortusfox" "danielbrendel/hortusfox-web" "tarball"
|
2026-08-07 19:45:32 +02:00
|
|
|
restore_backup
|
2025-08-08 08:13:24 +02:00
|
|
|
|
|
|
|
|
msg_info "Updating HortusFox"
|
|
|
|
|
cd /opt/hortusfox
|
2026-05-03 22:29:06 +02:00
|
|
|
export COMPOSER_ALLOW_SUPERUSER=1
|
2025-08-08 08:13:24 +02:00
|
|
|
$STD composer install --no-dev --optimize-autoloader
|
2026-08-07 19:45:32 +02:00
|
|
|
$STD php asatru migrate:list
|
2026-05-03 22:29:06 +02:00
|
|
|
$STD php asatru migrate:upgrade
|
2025-08-08 08:13:24 +02:00
|
|
|
$STD php asatru calendar:classes
|
2026-08-07 19:45:32 +02:00
|
|
|
$STD php asatru plants:attributes
|
|
|
|
|
$STD php asatru aquashell:config
|
2025-08-12 09:38:24 +00:00
|
|
|
chown -R www-data:www-data /opt/hortusfox
|
2025-08-08 08:13:24 +02:00
|
|
|
msg_ok "Updated HortusFox"
|
|
|
|
|
|
|
|
|
|
msg_info "Starting Service"
|
|
|
|
|
systemctl start apache2
|
|
|
|
|
msg_ok "Started Service"
|
2026-08-07 19:45:32 +02:00
|
|
|
|
2025-10-30 09:24:16 -07:00
|
|
|
msg_ok "Updated successfully!"
|
2025-08-08 08:13:24 +02:00
|
|
|
fi
|
|
|
|
|
exit
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
start
|
|
|
|
|
build_container
|
|
|
|
|
description
|
|
|
|
|
|
2026-01-06 22:57:40 +01:00
|
|
|
msg_ok "Completed successfully!\n"
|
2025-08-08 08:13:24 +02:00
|
|
|
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
2026-06-03 11:03:13 +02:00
|
|
|
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
|
|
|
|
|
echo -e "${GATEWAY}${BGN}http://${IP}${CL}"
|