mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-06-09 20:58:12 +01:00
Glance: Use separate directory for configuration files (#14906)
* Refactor * FIX
This commit is contained in:
+9
-12
@@ -29,25 +29,22 @@ function update_script() {
|
|||||||
msg_error "No ${APP} Installation Found!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit
|
exit
|
||||||
fi
|
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
|
if check_for_gh_release "glance" "glanceapp/glance"; then
|
||||||
msg_info "Stopping Service"
|
msg_info "Stopping Service"
|
||||||
systemctl stop glance
|
systemctl stop glance
|
||||||
msg_ok "Stopped Service"
|
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"
|
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"
|
msg_info "Starting Service"
|
||||||
systemctl start glance
|
systemctl start glance
|
||||||
msg_ok "Started Service"
|
msg_ok "Started Service"
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ update_os
|
|||||||
fetch_and_deploy_gh_release "glance" "glanceapp/glance" "prebuild" "latest" "/opt/glance" "glance-linux-amd64.tar.gz"
|
fetch_and_deploy_gh_release "glance" "glanceapp/glance" "prebuild" "latest" "/opt/glance" "glance-linux-amd64.tar.gz"
|
||||||
|
|
||||||
msg_info "Configuring Glance"
|
msg_info "Configuring Glance"
|
||||||
cat <<EOF >/opt/glance/glance.yml
|
mkdir -p /opt/glance_data
|
||||||
|
cat <<EOF >/opt/glance_data/glance.yml
|
||||||
pages:
|
pages:
|
||||||
- name: Startpage
|
- name: Startpage
|
||||||
width: slim
|
width: slim
|
||||||
@@ -39,22 +40,22 @@ EOF
|
|||||||
msg_ok "Configured Glance"
|
msg_ok "Configured Glance"
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
service_path="/etc/systemd/system/glance.service"
|
cat <<EOF >/etc/systemd/system/glance.service
|
||||||
echo "[Unit]
|
[Unit]
|
||||||
Description=Glance Daemon
|
Description=Glance Daemon
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
WorkingDirectory=/opt/glance
|
WorkingDirectory=/opt/glance
|
||||||
ExecStart=/opt/glance/glance --config /opt/glance/glance.yml
|
ExecStart=/opt/glance/glance --config /opt/glance_data/glance.yml
|
||||||
TimeoutStopSec=20
|
TimeoutStopSec=20
|
||||||
KillMode=process
|
KillMode=process
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target" >$service_path
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
systemctl enable -q --now glance
|
systemctl enable -q --now glance
|
||||||
msg_ok "Created Service"
|
msg_ok "Created Service"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user