mirror of
https://github.com/gentoo-mirror/guru.git
synced 2026-07-22 05:23:01 -04:00
www-apps/code-server-bin: add OpenRC init script
Closes: https://bugs.gentoo.org/907847 Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
This commit is contained in:
13
www-apps/code-server-bin/files/code-server-bin.conf
Normal file
13
www-apps/code-server-bin/files/code-server-bin.conf
Normal file
@@ -0,0 +1,13 @@
|
||||
# /etc/conf.d/code-server-bin: config file for /etc/init.d/code-server-bin.<user>
|
||||
# This can also be used as multiplexed configuration, i.e. openrc-run
|
||||
# looks for both /etc/conf.d/code-server-bin and /etc/conf.d/code-server-bin.<user>.
|
||||
|
||||
# Options to pass to code-server-bin.
|
||||
# NOTE: if you want to run multiple instances, be make sure to change
|
||||
# the port for each one (it is preferred to use the configuration file).
|
||||
#command_args="--port 8080"
|
||||
|
||||
# Specify the network service that corresponds to the "bind-addr" setting
|
||||
# in your configuration file. For example, if you bind to 127.0.0.1,
|
||||
# this should be set to "loopback" which provides the loopback interface.
|
||||
rc_need="loopback"
|
||||
47
www-apps/code-server-bin/files/code-server-bin.rc
Normal file
47
www-apps/code-server-bin/files/code-server-bin.rc
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 2023 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2 or later
|
||||
|
||||
NAME=${RC_SVCNAME%%.*}
|
||||
USER=${RC_SVCNAME##*.}
|
||||
PIDFILE_DIR=/run/${NAME}/${USER}
|
||||
|
||||
description="Start code server in the background"
|
||||
command="/usr/bin/${NAME}"
|
||||
command_user="${USER}"
|
||||
pidfile="${PIDFILE_DIR}/${NAME}.pid"
|
||||
command_background=true
|
||||
|
||||
depend() {
|
||||
use logger dns
|
||||
}
|
||||
|
||||
checkconfig() {
|
||||
if [ "${RC_VERSION:-0}" = "0" ]; then
|
||||
eerror "This script cannot be used for baselayout-1."
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "${USER}" = "${RC_SVCNAME}" ]; then
|
||||
eerror "You have to create an init script for each user:"
|
||||
eerror "ln -s emacs /etc/init.d/emacs.<user>"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if ! id -u "${USER}" >/dev/null; then
|
||||
eerror "${USER}: No such user"
|
||||
return 1
|
||||
fi
|
||||
|
||||
checkpath -d --owner 0 --mode 0755 "${PIDFILE_DIR%/*}"
|
||||
checkpath -d --owner "${USER}" --mode 0755 "${PIDFILE_DIR}"
|
||||
}
|
||||
|
||||
start() {
|
||||
local home
|
||||
checkconfig || return 1
|
||||
|
||||
eval home="~${USER}"
|
||||
|
||||
default_start
|
||||
}
|
||||
Reference in New Issue
Block a user