Shelfmark: add chromium service file
This commit is contained in:
parent
654ffc5a2c
commit
979057a888
@ -35,6 +35,7 @@ function update_script() {
|
||||
if check_for_gh_release "shelfmark" "calibrain/shelfmark"; then
|
||||
msg_info "Stopping Service"
|
||||
systemctl stop shelfmark
|
||||
[[ -f /etc/systemd/system/chromium.service ]] && systemctl stop chromium
|
||||
msg_ok "Stopped Service"
|
||||
|
||||
cp /opt/shelfmark/start.sh /opt/start.sh.bak
|
||||
@ -51,7 +52,7 @@ function update_script() {
|
||||
$STD uv venv -c ./venv
|
||||
$STD source ./venv/bin/activate
|
||||
$STD uv pip install -r ./requirements-base.txt
|
||||
if [[ $(sed -n '/_BYPASS=/s/[^=]*=//p' /etc/shelfmark/.env) == "true" ]] && [[ $(sed -n '/BYPASSER=/s/[^=]*=//p' /etc/shelfmark/.env) == "false" ]]; then
|
||||
if [[ $(sed -n '/_BYPASS=/s/[^=]*=//p' /etc/shelfmark/.env) == "true" ]] && [[ $(sed -n '/BYPASSER=/s/[^=]*=//p' /etc/shelfmark/.env == "false") ]]; then
|
||||
$STD uv pip install -r ./requirements-shelfmark.txt
|
||||
fi
|
||||
mv /opt/start.sh.bak /opt/shelfmark/start.sh
|
||||
@ -59,6 +60,7 @@ function update_script() {
|
||||
|
||||
msg_info "Starting Service"
|
||||
systemctl start shelfmark
|
||||
[[ -f /etc/systemd/system/chromium.service ]] && systemctl start chromium
|
||||
msg_ok "Started Service"
|
||||
msg_ok "Updated successfully!"
|
||||
fi
|
||||
|
||||
@ -122,6 +122,7 @@ elif [[ "$DEPLOYMENT_TYPE" == "3" ]]; then
|
||||
elif [[ "$DEPLOYMENT_TYPE" == "4" ]]; then
|
||||
sed -i '/_BYPASS=/s/true/false' /etc/shelfmark/.env
|
||||
else
|
||||
DEPLOYMENT_TYPE="1"
|
||||
msg_info "Installing internal bypasser dependencies"
|
||||
$STD apt install -y --no-install-recommends \
|
||||
xvfb \
|
||||
@ -141,6 +142,7 @@ RELEASE_VERSION=$(cat "$HOME/.shelfmark")
|
||||
|
||||
msg_info "Building Shelfmark frontend"
|
||||
cd /opt/shelfmark/src/frontend
|
||||
echo "$RELEASE_VERSION" >>/etc/shelfmark/.env
|
||||
$STD npm ci
|
||||
$STD npm run build
|
||||
mv /opt/shelfmark/src/frontend/dist /opt/shelfmark/frontend-dist
|
||||
@ -153,10 +155,9 @@ $STD source ./venv/bin/activate
|
||||
$STD uv pip install -r ./requirements-base.txt
|
||||
[[ "$DEPLOYMENT_TYPE" == "1" ]] && $STD uv pip install -r ./requirements-shelfmark.txt
|
||||
mkdir -p {/var/log/shelfmark,/tmp/shelfmark}
|
||||
echo "$RELEASE_VERSION" >>/etc/shelfmark/.env
|
||||
msg_ok "Configured Shelfmark"
|
||||
|
||||
msg_info "Creating Service and start script"
|
||||
msg_info "Creating Services and start script"
|
||||
cat <<EOF >/etc/systemd/system/shelfmark.service
|
||||
[Unit]
|
||||
Description=Shelfmark server
|
||||
@ -174,6 +175,23 @@ RestartSec=10
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
if [[ "$DEPLOYMENT_TYPE" == "1" ]]; then
|
||||
cat <<EOF >/etc/systemd/system/chromium.service
|
||||
[Unit]
|
||||
Description=karakeep Headless Browser
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=root
|
||||
ExecStart=/usr/bin/chromium --headless --no-sandbox --disable-gpu --disable-dev-shm-usage --remote-debugging-address=127.0.0.1 --remote-debugging-port=9222 --hide-scrollbars
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
systemctl enable -q --now chromium
|
||||
fi
|
||||
|
||||
cat <<EOF >/opt/shelfmark/start.sh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user