mirror of
https://github.com/community-scripts/ProxmoxVED.git
synced 2026-04-20 09:38:42 -05:00
Rename Companion to Bitfocus Companion: files, slug, paths, service, remove system user (Anti-Pattern #9)
This commit is contained in:
@@ -5,7 +5,7 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV
|
||||
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||
# Source: https://github.com/bitfocus/companion
|
||||
|
||||
APP="Companion"
|
||||
APP="Bitfocus Companion"
|
||||
var_tags="${var_tags:-automation;media}"
|
||||
var_cpu="${var_cpu:-2}"
|
||||
var_ram="${var_ram:-512}"
|
||||
@@ -24,7 +24,7 @@ function update_script() {
|
||||
check_container_storage
|
||||
check_container_resources
|
||||
|
||||
if [[ ! -f /opt/companion/companion_headless.sh ]]; then
|
||||
if [[ ! -f /opt/bitfocus-companion/companion_headless.sh ]]; then
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit 1
|
||||
fi
|
||||
@@ -38,23 +38,22 @@ function update_script() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${RELEASE}" == "$(cat ~/.companion 2>/dev/null)" ]]; then
|
||||
if [[ "${RELEASE}" == "$(cat ~/.bitfocus-companion 2>/dev/null)" ]]; then
|
||||
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||
exit
|
||||
fi
|
||||
|
||||
msg_info "Stopping ${APP}"
|
||||
systemctl stop companion
|
||||
systemctl stop bitfocus-companion
|
||||
msg_ok "Stopped ${APP}"
|
||||
|
||||
msg_info "Updating ${APP} to v${RELEASE}"
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_from_url "$ASSET_URL" "/opt/companion"
|
||||
chown -R companion:companion /opt/companion
|
||||
echo "${RELEASE}" >~/.companion
|
||||
CLEAN_INSTALL=1 fetch_and_deploy_from_url "$ASSET_URL" "/opt/bitfocus-companion"
|
||||
echo "${RELEASE}" >~/.bitfocus-companion
|
||||
msg_ok "Updated ${APP} to v${RELEASE}"
|
||||
|
||||
msg_info "Starting ${APP}"
|
||||
systemctl start companion
|
||||
systemctl start bitfocus-companion
|
||||
msg_ok "Started ${APP}"
|
||||
|
||||
msg_ok "Update Successful"
|
||||
@@ -29,26 +29,21 @@ fi
|
||||
msg_ok "Found Companion v${RELEASE}"
|
||||
|
||||
msg_info "Downloading Bitfocus Companion v${RELEASE}"
|
||||
fetch_and_deploy_from_url "$ASSET_URL" "/opt/companion"
|
||||
fetch_and_deploy_from_url "$ASSET_URL" "/opt/bitfocus-companion"
|
||||
msg_ok "Downloaded and Extracted Bitfocus Companion v${RELEASE}"
|
||||
|
||||
msg_info "Installing udev Rules"
|
||||
if [[ -f /opt/companion/50-companion-headless.rules ]]; then
|
||||
cp /opt/companion/50-companion-headless.rules /etc/udev/rules.d/
|
||||
if [[ -f /opt/bitfocus-companion/50-companion-headless.rules ]]; then
|
||||
cp /opt/bitfocus-companion/50-companion-headless.rules /etc/udev/rules.d/
|
||||
udevadm control --reload-rules
|
||||
udevadm trigger
|
||||
fi
|
||||
msg_ok "Installed udev Rules"
|
||||
|
||||
msg_info "Creating companion User"
|
||||
useradd --system --no-create-home --shell /usr/sbin/nologin companion 2>/dev/null || true
|
||||
mkdir -p /opt/companion-config
|
||||
chown -R companion:companion /opt/companion-config
|
||||
chown -R companion:companion /opt/companion
|
||||
msg_ok "Created companion User"
|
||||
mkdir -p /opt/bitfocus-companion-config
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/companion.service
|
||||
cat <<EOF >/etc/systemd/system/bitfocus-companion.service
|
||||
[Unit]
|
||||
Description=Bitfocus Companion
|
||||
After=network.target
|
||||
@@ -56,23 +51,19 @@ Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=companion
|
||||
ExecStart=/opt/companion/companion_headless.sh --config-dir /opt/companion-config
|
||||
WorkingDirectory=/opt/companion
|
||||
ExecStart=/opt/bitfocus-companion/companion_headless.sh --config-dir /opt/bitfocus-companion-config
|
||||
WorkingDirectory=/opt/bitfocus-companion
|
||||
Restart=on-failure
|
||||
RestartSec=5
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
SyslogIdentifier=companion
|
||||
Environment=NODE_ENV=production
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now companion
|
||||
systemctl enable -q --now bitfocus-companion
|
||||
msg_ok "Created Service"
|
||||
|
||||
echo "${RELEASE}" >~/.companion
|
||||
echo "${RELEASE}" >~/.bitfocus-companion
|
||||
|
||||
motd_ssh
|
||||
customize
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "Bitfocus Companion",
|
||||
"slug": "companion",
|
||||
"slug": "bitfocus-companion",
|
||||
"categories": [
|
||||
19
|
||||
],
|
||||
@@ -12,11 +12,11 @@
|
||||
"documentation": "https://user.bitfocus.io/docs",
|
||||
"website": "https://bitfocus.io/companion",
|
||||
"logo": "https://raw.githubusercontent.com/bitfocus/companion/main/assets/icon.png",
|
||||
"description": "Bitfocus Companion enables the Elgato Stream Deck and other controllers to trigger actions in broadcast software. Installs headless with a dedicated system user and systemd service, fetching the latest release via the Bitfocus API.",
|
||||
"description": "Bitfocus Companion enables the Elgato Stream Deck and other controllers to trigger actions in broadcast software. Installs headless with systemd service, fetching the latest release via the Bitfocus API.",
|
||||
"install_methods": [
|
||||
{
|
||||
"type": "default",
|
||||
"script": "ct/companion.sh",
|
||||
"script": "ct/bitfocus-companion.sh",
|
||||
"resources": {
|
||||
"cpu": 2,
|
||||
"ram": 512,
|
||||
Reference in New Issue
Block a user