Glance: Use separate directory for configuration files (#14906)

* Refactor

* FIX
This commit is contained in:
Slaviša Arežina
2026-06-03 15:33:29 +02:00
committed by GitHub
parent bbd9b715e6
commit 8532da6cb6
2 changed files with 16 additions and 18 deletions

View File

@@ -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"

View File

@@ -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 <<EOF >/opt/glance/glance.yml
mkdir -p /opt/glance_data
cat <<EOF >/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 <<EOF >/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"