chore: fix shell scripts lint errors

This commit is contained in:
jo 2022-11-24 21:14:59 +01:00 committed by JuniorJPDJ
commit d47fef0806
23 changed files with 359 additions and 228 deletions

View file

@ -1,4 +1,5 @@
#!/bin/sh
# shellcheck disable=SC2034
# PROVIDE: funkwhale_beat
# REQUIRE: LOGIN postgresql nginx redis
@ -8,28 +9,31 @@
# funkwhale_beat (bool): Set it to "YES" to enable Funkwhale task beat.
# Default is "NO".
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
# shellcheck disable=SC1091
. /etc/rc.subr
desc="Funkwhale beat"
name=funkwhale_beat
rcvar=funkwhale_beat_enable
name="funkwhale_beat"
rcvar="funkwhale_beat_enable"
load_rc_config $name
load_rc_config "$name"
: ${funkwhale_beat_enable:=NO}
: "${funkwhale_beat_enable:=NO}"
funkwhale_beat_chdir="/usr/local/www/funkwhale/api"
funkwhale_beat_user=funkwhale
funkwhale_beat_env=$(cat /usr/local/www/funkwhale/config/.env | grep -v ^# | xargs)
funkwhale_beat_user="funkwhale"
funkwhale_beat_env="$(grep -v '^#' /usr/local/www/funkwhale/config/.env | xargs)"
pidfile="/var/run/funkwhale/${name##funkwhale_}.pid"
command_interpreter="/usr/local/www/funkwhale/virtualenv/bin/python3"
command="/usr/local/www/funkwhale/virtualenv/bin/celery"
command_args="-A funkwhale_api.taskapp beat -l INFO \
--pidfile=${pidfile} \
command_args="\
--app funkwhale_api.taskapp \
beat \
--loglevel INFO \
--pidfile $pidfile \
>> /var/log/funkwhale/${name##funkwhale_}.log 2>&1 &"
run_rc_command "$1"

View file

@ -1,4 +1,5 @@
#!/bin/sh
# shellcheck disable=SC2034
# PROVIDE: funkwhale_server
# REQUIRE: LOGIN postgresql nginx redis
@ -10,23 +11,28 @@
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
# shellcheck disable=SC1091
. /etc/rc.subr
desc="Funkwhale server"
name=funkwhale_server
rcvar=funkwhale_server_enable
name="funkwhale_server"
rcvar="funkwhale_server_enable"
load_rc_config $name
load_rc_config "$name"
: ${funkwhale_server_enable:=NO}
: "${funkwhale_server_enable:=NO}"
funkwhale_server_chdir="/usr/local/www/funkwhale/api"
funkwhale_server_user=funkwhale
funkwhale_server_env=$(cat /usr/local/www/funkwhale/config/.env | grep -v ^# | xargs)
funkwhale_server_user="funkwhale"
funkwhale_server_env="$(grep -v '^#' /usr/local/www/funkwhale/config/.env | xargs)"
command_interpreter="/usr/local/www/funkwhale/virtualenv/bin/python3"
command="/usr/local/www/funkwhale/virtualenv/bin/gunicorn"
command_args="config.asgi:application -w 4 -k uvicorn.workers.UvicornWorker -b 127.0.0.1:5000 \
command_args="\
config.asgi:application \
--workers 4 \
--worker-class uvicorn.workers.UvicornWorker \
--bind 127.0.0.1:5000 \
>> /var/log/funkwhale/${name##funkwhale_}.log 2>&1 &"
run_rc_command "$1"

View file

@ -1,4 +1,5 @@
#!/bin/sh
# shellcheck disable=SC2034
# PROVIDE: funkwhale_worker
# REQUIRE: LOGIN postgresql nginx redis
@ -10,25 +11,29 @@
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
# shellcheck disable=SC1091
. /etc/rc.subr
desc="Funkwhale worker"
name=funkwhale_worker
rcvar=funkwhale_worker_enable
name="funkwhale_worker"
rcvar="funkwhale_worker_enable"
load_rc_config $name
load_rc_config "$name"
: ${funkwhale_worker_enable:=NO}
: "${funkwhale_worker_enable:=NO}"
funkwhale_worker_chdir="/usr/local/www/funkwhale/api"
funkwhale_worker_user=funkwhale
funkwhale_worker_env=$(cat /usr/local/www/funkwhale/config/.env | grep -v ^# | xargs)
funkwhale_worker_user="funkwhale"
funkwhale_worker_env=$(grep -v '^#' /usr/local/www/funkwhale/config/.env | xargs)
pidfile="/var/run/funkwhale/${name##funkwhale_}.pid"
command_interpreter="/usr/local/www/funkwhale/virtualenv/bin/python3"
command="/usr/local/www/funkwhale/virtualenv/bin/celery"
command_args="-A funkwhale_api.taskapp worker -l INFO \
--pidfile=${pidfile} \
command_args="\
--app funkwhale_api.taskapp \
worker \
--loglevel INFO \
--pidfile $pidfile \
>> /var/log/funkwhale/${name##funkwhale_}.log 2>&1 &"
run_rc_command "$1"

View file

@ -1,27 +1,41 @@
#!/sbin/openrc-run
NAME=funkwhalebeat
PIDFILE=/var/run/$NAME.pid
USER=funkwhale
WORKDIR=/srv/funkwhale/api
Celery=/srv/funkwhale/virtualenv/bin/celery
BEAT_ARGS="-A funkwhale_api.taskapp beat -l INFO"
# shellcheck shell=bash
NAME="funkwhalebeat"
PIDFILE="/var/run/$NAME.pid"
USER="funkwhale"
WORKDIR="/srv/funkwhale/api"
Celery="/srv/funkwhale/virtualenv/bin/celery"
BEAT_ARGS="--app funkwhale_api.taskapp beat --loglevel INFO"
depend() {
need net
need net
}
start() {
ebegin "Starting Funkwhale Beat"
cd /srv/funkwhale/api
set -a && source /srv/funkwhale/config/.env && set +a
echo ' start beat'
start-stop-daemon --start --user $USER --make-pidfile --pidfile $PIDFILE -d $WORKDIR --exec $Celery -- $BEAT_ARGS >> /var/log/funk/worker.log 2>&1&
echo 'Started Beat'
echo
eend $?
ebegin "Starting Funkwhale Beat"
cd /srv/funkwhale/api || exit 1
# shellcheck disable=SC1091
set -a && source /srv/funkwhale/config/.env && set +a
echo "Starting Funkwhale Beat"
# shellcheck disable=SC2086
start-stop-daemon --start \
--user "$USER" \
--make-pidfile \
--pidfile "$PIDFILE" \
--chdir "$WORKDIR" \
--exec "$Celery" \
-- $BEAT_ARGS \
>> /var/log/funk/worker.log 2>&1 &
echo "Funkwhale Beat started"
echo
eend $?
}
stop() {
ebegin "Stopping Funkwhale Beat"
start-stop-daemon --stop --pidfile $PIDFILE
eend $?
ebegin "Stopping Funkwhale Beat"
start-stop-daemon --stop --pidfile "$PIDFILE"
eend $?
}

View file

@ -1,29 +1,41 @@
#!/sbin/openrc-run
# shellcheck shell=bash
NAME=funkwhaleserver
PIDFILE=/var/run/$NAME.pid
USER=funkwhale
DAEMON_ARGS="config.asgi:application -w 4 -k uvicorn.workers.UvicornWorker -b 127.0.0.1:5000 "
Gunicorn=/srv/funkwhale/virtualenv/bin/gunicorn
WORKDIR=/srv/funkwhale/api
NAME="funkwhaleserver"
PIDFILE="/var/run/$NAME.pid"
USER="funkwhale"
DAEMON_ARGS="config.asgi:application --workers 4 --worker-class uvicorn.workers.UvicornWorker --bind 127.0.0.1:5000"
Gunicorn="/srv/funkwhale/virtualenv/bin/gunicorn"
WORKDIR="/srv/funkwhale/api"
depend() {
need net redis postgresql nginx funkwhale_beat funkwhale_worker
need net redis postgresql nginx funkwhale_beat funkwhale_worker
}
start() {
ebegin "Starting Funkwhale Server"
cd /srv/funkwhale/api
set -a && source /srv/funkwhale/config/.env && set +a
echo 'Starting Funkwhale Server'
start-stop-daemon --start --user $USER --make-pidfile --pidfile $PIDFILE -d $WORKDIR --exec $Gunicorn -- $DAEMON_ARGS >> /var/log/funk/server.log 2>&1&
echo 'Funkwhale Server started'
echo
eend $?
ebegin "Starting Funkwhale Server"
cd /srv/funkwhale/api || exit 1
# shellcheck disable=SC1091
set -a && source /srv/funkwhale/config/.env && set +a
echo "Starting Funkwhale Server"
# shellcheck disable=SC2086
start-stop-daemon --start \
--user "$USER" \
--make-pidfile \
--pidfile "$PIDFILE" \
--chdir "$WORKDIR" \
--exec "$Gunicorn" \
-- $DAEMON_ARGS \
>> /var/log/funk/server.log 2>&1 &
echo "Funkwhale Server started"
echo
eend $?
}
stop() {
ebegin "Stopping Funkwhale"
start-stop-daemon --stop --pidfile $PIDFILE
eend $?
ebegin "Stopping Funkwhale"
start-stop-daemon --stop --pidfile "$PIDFILE"
eend $?
}

View file

@ -1,28 +1,41 @@
#!/sbin/openrc-run
NAME=funkwhaleworker
PIDFILE=/var/run/$NAME.pid
USER=funkwhale
WORKDIR=/srv/funkwhale/api
Celery=/srv/funkwhale/virtualenv/bin/celery
WORKER_ARGS=" -A funkwhale_api.taskapp worker -l INFO"
# shellcheck shell=bash
NAME="funkwhaleworker"
PIDFILE="/var/run/$NAME.pid"
USER="funkwhale"
WORKDIR="/srv/funkwhale/api"
Celery="/srv/funkwhale/virtualenv/bin/celery"
WORKER_ARGS="--app funkwhale_api.taskapp worker --loglevel INFO"
depend() {
need net
need net
}
start() {
ebegin "Starting Funkwhale Worker"
cd /srv/funkwhale/api
set -a && source /srv/funkwhale/config/.env && set +a
echo ' start beat'
start-stop-daemon --start --user $USER --make-pidfile --pidfile $PIDFILE -d $WORKDIR --exec $Celery -- $WORKER_ARGS >> /var/log/funk/worker.log 2>&1&
echo 'Started Worker'
echo
eend $?
ebegin "Starting Funkwhale Worker"
cd /srv/funkwhale/api || exit 1
# shellcheck disable=SC1091
set -a && source /srv/funkwhale/config/.env && set +a
echo "Starting Funkwhale Worker"
# shellcheck disable=SC2086
start-stop-daemon --start \
--user "$USER" \
--make-pidfile \
--pidfile "$PIDFILE" \
--chdir "$WORKDIR" \
--exec "$Celery" \
-- $WORKER_ARGS \
>> /var/log/funk/worker.log 2>&1 &
echo "Funkwhale Worker started"
echo
eend $?
}
stop() {
ebegin "Stopping Funkwhale Worker"
start-stop-daemon --stop --pidfile $PIDFILE
eend $?
ebegin "Stopping Funkwhale Worker"
start-stop-daemon --stop --pidfile "$PIDFILE"
eend $?
}