mirror of
https://github.com/v2rayA/v2rayA.git
synced 2026-11-20 23:02:25 +03:00
38 lines
1.1 KiB
Plaintext
Executable File
38 lines
1.1 KiB
Plaintext
Executable File
#!/sbin/openrc-run
|
|
# Copyright 2022 Gentoo Authors
|
|
# Distributed under the terms of the GNU General Public License v2
|
|
|
|
USER="${RC_SVCNAME##*.}"
|
|
HOME="$(eval echo ~${USER})"
|
|
name="v2rayA for ${USER}"
|
|
description="Web client for its own Xray-based core; lite mode, without transparent proxy"
|
|
command="/usr/bin/v2raya"
|
|
command_user="${USER}"
|
|
command_args="--lite --log-file ${HOME}/.config/v2raya/v2raya.log ${V2RAYA_OPTS}"
|
|
error_log="${HOME}/.config/v2raya/error.log"
|
|
supervisor="supervise-daemon"
|
|
retry="TERM/30/KILL/5"
|
|
|
|
depend() {
|
|
need net
|
|
use dns
|
|
after net
|
|
}
|
|
|
|
start_pre() {
|
|
if [ "$USER" = "v2raya-user" ]; then
|
|
eerror "You are not supposed to run this script directly."
|
|
eerror "Create a symlink for this script:"
|
|
eerror " ln -s ${RC_SVCNAME} /etc/init.d/${RC_SVCNAME}.<user>"
|
|
return 1
|
|
|
|
elif [ "$USER" = "root" ]; then
|
|
eerror "Root user doesn't need to run v2rayA daemon by link."
|
|
eerror "Instead just run /etc/init.d/v2raya directly."
|
|
return 1
|
|
fi
|
|
# checkpath makes one level; a fresh account has no ~/.config yet
|
|
checkpath -d -o "${USER}" "${HOME}/.config"
|
|
checkpath -d -m 0700 -o "${USER}" "${HOME}/.config/v2raya"
|
|
}
|