diff --git a/ct/glance.sh b/ct/glance.sh index f9e4eaff5..d377c6fb5 100644 --- a/ct/glance.sh +++ b/ct/glance.sh @@ -29,25 +29,22 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi + if [[ ! -d /opt/glance_data ]]; then + msg_info "Creating config directory" + mkdir -p /opt/glance_data/ + cp /opt/glance/*.yml /opt/glance_data/ + sed -i 's|/opt/glance/glance\.yml|/opt/glance_data/glance.yml|' /etc/systemd/system/glance.service + systemctl daemon-reload + msg_ok "Created config directory" + fi + if check_for_gh_release "glance" "glanceapp/glance"; then msg_info "Stopping Service" systemctl stop glance msg_ok "Stopped Service" - if [[ -f /opt/glance/glance.yml ]]; then - msg_info "Backing up glance.yml" - cp /opt/glance/glance.yml /tmp/glance.yml.bak - msg_ok "Backed up glance.yml" - fi - CLEAN_INSTALL=1 fetch_and_deploy_gh_release "glance" "glanceapp/glance" "prebuild" "latest" "/opt/glance" "glance-linux-amd64.tar.gz" - if [[ -f /tmp/glance.yml.bak ]]; then - msg_info "Restoring glance.yml" - mv /tmp/glance.yml.bak /opt/glance/glance.yml - msg_ok "Restored glance.yml" - fi - msg_info "Starting Service" systemctl start glance msg_ok "Started Service" diff --git a/install/glance-install.sh b/install/glance-install.sh index 58fbdc43a..2c1f97a34 100644 --- a/install/glance-install.sh +++ b/install/glance-install.sh @@ -16,7 +16,8 @@ update_os fetch_and_deploy_gh_release "glance" "glanceapp/glance" "prebuild" "latest" "/opt/glance" "glance-linux-amd64.tar.gz" msg_info "Configuring Glance" -cat </opt/glance/glance.yml +mkdir -p /opt/glance_data +cat </opt/glance_data/glance.yml pages: - name: Startpage width: slim @@ -39,22 +40,22 @@ EOF msg_ok "Configured Glance" msg_info "Creating Service" -service_path="/etc/systemd/system/glance.service" -echo "[Unit] +cat </etc/systemd/system/glance.service +[Unit] Description=Glance Daemon After=network.target [Service] Type=simple WorkingDirectory=/opt/glance -ExecStart=/opt/glance/glance --config /opt/glance/glance.yml +ExecStart=/opt/glance/glance --config /opt/glance_data/glance.yml TimeoutStopSec=20 KillMode=process Restart=on-failure [Install] -WantedBy=multi-user.target" >$service_path - +WantedBy=multi-user.target +EOF systemctl enable -q --now glance msg_ok "Created Service"