Align to code standards

This commit is contained in:
Matthew Stern
2026-01-25 18:46:57 -05:00
committed by Michel Roegl-Brunner
parent ad48c14cf3
commit d25f48f5be
3 changed files with 53 additions and 25 deletions

View File

@@ -1,8 +1,8 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2026 community-scripts ORG
# Author: Matthew Stern
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
# Author: Matthew Stern (sternma)
# License: MIT | https://github.com/community-scripts/ProxmoxVED/raw/main/LICENSE
# Source: https://github.com/dmunozv04/iSponsorBlockTV
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
@@ -15,7 +15,6 @@ update_os
INSTALL_DIR="/opt/isponsorblocktv"
DATA_DIR="/var/lib/isponsorblocktv"
SERVICE_USER="isponsorblocktv"
msg_info "Installing Dependencies"
$STD apt-get install -y \
@@ -24,23 +23,17 @@ $STD apt-get install -y \
python3-pip
msg_ok "Installed Dependencies"
msg_info "Downloading iSponsorBlockTV"
fetch_and_deploy_gh_release "isponsorblocktv" "dmunozv04/iSponsorBlockTV" "tarball" "latest" "$INSTALL_DIR"
msg_ok "Downloaded iSponsorBlockTV"
fetch_and_deploy_gh_release "isponsorblocktv" "dmunozv04/iSponsorBlockTV"
msg_info "Setting up iSponsorBlockTV"
python3 -m venv "$INSTALL_DIR/venv"
$STD python3 -m venv "$INSTALL_DIR/venv"
$STD "$INSTALL_DIR/venv/bin/pip" install --upgrade pip
$STD "$INSTALL_DIR/venv/bin/pip" install "$INSTALL_DIR"
msg_ok "Set up iSponsorBlockTV"
msg_info "Creating service user and data directory"
if ! id "$SERVICE_USER" &>/dev/null; then
useradd --system --home "$DATA_DIR" --create-home "$SERVICE_USER"
fi
install -d -o "$SERVICE_USER" -g "$SERVICE_USER" "$DATA_DIR"
chown -R "$SERVICE_USER":"$SERVICE_USER" "$INSTALL_DIR"
msg_ok "Created service user and data directory"
msg_info "Creating data directory"
install -d "$DATA_DIR"
msg_ok "Created data directory"
msg_info "Creating Service"
cat <<EOT >/etc/systemd/system/isponsorblocktv.service
@@ -51,8 +44,8 @@ Wants=network-online.target
[Service]
Type=simple
User=$SERVICE_USER
Group=$SERVICE_USER
User=root
Group=root
WorkingDirectory=$INSTALL_DIR
Environment=iSPBTV_data_dir=$DATA_DIR
ExecStart=$INSTALL_DIR/venv/bin/iSponsorBlockTV
@@ -93,7 +86,9 @@ cat <<'EOT' >/etc/profile.d/isponsorblocktv.sh
export iSPBTV_data_dir="/var/lib/isponsorblocktv"
EOT
if ! grep -q '^iSPBTV_data_dir=' /etc/environment 2>/dev/null; then
echo 'iSPBTV_data_dir=/var/lib/isponsorblocktv' >>/etc/environment
cat <<'EOT' >>/etc/environment
iSPBTV_data_dir=/var/lib/isponsorblocktv
EOT
fi
msg_ok "Set default data dir for shells"