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
|
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
|
||||||
# Source: https://github.com/bitfocus/companion
|
# Source: https://github.com/bitfocus/companion
|
||||||
|
|
||||||
APP="Companion"
|
APP="Bitfocus Companion"
|
||||||
var_tags="${var_tags:-automation;media}"
|
var_tags="${var_tags:-automation;media}"
|
||||||
var_cpu="${var_cpu:-2}"
|
var_cpu="${var_cpu:-2}"
|
||||||
var_ram="${var_ram:-512}"
|
var_ram="${var_ram:-512}"
|
||||||
@@ -24,7 +24,7 @@ function update_script() {
|
|||||||
check_container_storage
|
check_container_storage
|
||||||
check_container_resources
|
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!"
|
msg_error "No ${APP} Installation Found!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -38,23 +38,22 @@ function update_script() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
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}"
|
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg_info "Stopping ${APP}"
|
msg_info "Stopping ${APP}"
|
||||||
systemctl stop companion
|
systemctl stop bitfocus-companion
|
||||||
msg_ok "Stopped ${APP}"
|
msg_ok "Stopped ${APP}"
|
||||||
|
|
||||||
msg_info "Updating ${APP} to v${RELEASE}"
|
msg_info "Updating ${APP} to v${RELEASE}"
|
||||||
CLEAN_INSTALL=1 fetch_and_deploy_from_url "$ASSET_URL" "/opt/companion"
|
CLEAN_INSTALL=1 fetch_and_deploy_from_url "$ASSET_URL" "/opt/bitfocus-companion"
|
||||||
chown -R companion:companion /opt/companion
|
echo "${RELEASE}" >~/.bitfocus-companion
|
||||||
echo "${RELEASE}" >~/.companion
|
|
||||||
msg_ok "Updated ${APP} to v${RELEASE}"
|
msg_ok "Updated ${APP} to v${RELEASE}"
|
||||||
|
|
||||||
msg_info "Starting ${APP}"
|
msg_info "Starting ${APP}"
|
||||||
systemctl start companion
|
systemctl start bitfocus-companion
|
||||||
msg_ok "Started ${APP}"
|
msg_ok "Started ${APP}"
|
||||||
|
|
||||||
msg_ok "Update Successful"
|
msg_ok "Update Successful"
|
||||||
@@ -29,26 +29,21 @@ fi
|
|||||||
msg_ok "Found Companion v${RELEASE}"
|
msg_ok "Found Companion v${RELEASE}"
|
||||||
|
|
||||||
msg_info "Downloading Bitfocus 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_ok "Downloaded and Extracted Bitfocus Companion v${RELEASE}"
|
||||||
|
|
||||||
msg_info "Installing udev Rules"
|
msg_info "Installing udev Rules"
|
||||||
if [[ -f /opt/companion/50-companion-headless.rules ]]; then
|
if [[ -f /opt/bitfocus-companion/50-companion-headless.rules ]]; then
|
||||||
cp /opt/companion/50-companion-headless.rules /etc/udev/rules.d/
|
cp /opt/bitfocus-companion/50-companion-headless.rules /etc/udev/rules.d/
|
||||||
udevadm control --reload-rules
|
udevadm control --reload-rules
|
||||||
udevadm trigger
|
udevadm trigger
|
||||||
fi
|
fi
|
||||||
msg_ok "Installed udev Rules"
|
msg_ok "Installed udev Rules"
|
||||||
|
|
||||||
msg_info "Creating companion User"
|
mkdir -p /opt/bitfocus-companion-config
|
||||||
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"
|
|
||||||
|
|
||||||
msg_info "Creating Service"
|
msg_info "Creating Service"
|
||||||
cat <<EOF >/etc/systemd/system/companion.service
|
cat <<EOF >/etc/systemd/system/bitfocus-companion.service
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=Bitfocus Companion
|
Description=Bitfocus Companion
|
||||||
After=network.target
|
After=network.target
|
||||||
@@ -56,23 +51,19 @@ Wants=network-online.target
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=companion
|
ExecStart=/opt/bitfocus-companion/companion_headless.sh --config-dir /opt/bitfocus-companion-config
|
||||||
ExecStart=/opt/companion/companion_headless.sh --config-dir /opt/companion-config
|
WorkingDirectory=/opt/bitfocus-companion
|
||||||
WorkingDirectory=/opt/companion
|
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
RestartSec=5
|
RestartSec=5
|
||||||
StandardOutput=journal
|
|
||||||
StandardError=journal
|
|
||||||
SyslogIdentifier=companion
|
|
||||||
Environment=NODE_ENV=production
|
Environment=NODE_ENV=production
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
EOF
|
EOF
|
||||||
systemctl enable -q --now companion
|
systemctl enable -q --now bitfocus-companion
|
||||||
msg_ok "Created Service"
|
msg_ok "Created Service"
|
||||||
|
|
||||||
echo "${RELEASE}" >~/.companion
|
echo "${RELEASE}" >~/.bitfocus-companion
|
||||||
|
|
||||||
motd_ssh
|
motd_ssh
|
||||||
customize
|
customize
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Bitfocus Companion",
|
"name": "Bitfocus Companion",
|
||||||
"slug": "companion",
|
"slug": "bitfocus-companion",
|
||||||
"categories": [
|
"categories": [
|
||||||
19
|
19
|
||||||
],
|
],
|
||||||
@@ -12,11 +12,11 @@
|
|||||||
"documentation": "https://user.bitfocus.io/docs",
|
"documentation": "https://user.bitfocus.io/docs",
|
||||||
"website": "https://bitfocus.io/companion",
|
"website": "https://bitfocus.io/companion",
|
||||||
"logo": "https://raw.githubusercontent.com/bitfocus/companion/main/assets/icon.png",
|
"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": [
|
"install_methods": [
|
||||||
{
|
{
|
||||||
"type": "default",
|
"type": "default",
|
||||||
"script": "ct/companion.sh",
|
"script": "ct/bitfocus-companion.sh",
|
||||||
"resources": {
|
"resources": {
|
||||||
"cpu": 2,
|
"cpu": 2,
|
||||||
"ram": 512,
|
"ram": 512,
|
||||||
Reference in New Issue
Block a user