detect systemctl in install release script

pull/73/head
v2ray 9 years ago
parent 666e98da85
commit 0bdf277de5

@ -59,12 +59,15 @@ if [ ! -f "/etc/v2ray/config.json" ]; then
echo "UUID:${UUID}" echo "UUID:${UUID}"
fi fi
if [ -d "/lib/systemd/system" ]; then SYSTEMCTL_CMD=$(command -v systemctl)
SERVICE_CMD=$(command -v service)
if [ -n "${SYSTEMCTL_CMD}" ]; then
if [ ! -f "/lib/systemd/system/v2ray.service" ]; then if [ ! -f "/lib/systemd/system/v2ray.service" ]; then
cp "/tmp/v2ray/v2ray-${VER}-linux-${VDIS}/systemd/v2ray.service" "/lib/systemd/system/" cp "/tmp/v2ray/v2ray-${VER}-linux-${VDIS}/systemd/v2ray.service" "/lib/systemd/system/"
systemctl enable v2ray systemctl enable v2ray
fi fi
elif [ -d "/etc/init.d" ]; then # Configure SysV if necessary. elif [ -n "${SERVICE_CMD}" ]; then # Configure SysV if necessary.
if [ ! -f "/etc/init.d/v2ray" ]; then if [ ! -f "/etc/init.d/v2ray" ]; then
cp "/tmp/v2ray/v2ray-${VER}-linux-${VDIS}/systemv/v2ray" "/etc/init.d/v2ray" cp "/tmp/v2ray/v2ray-${VER}-linux-${VDIS}/systemv/v2ray" "/etc/init.d/v2ray"
chmod +x "/etc/init.d/v2ray" chmod +x "/etc/init.d/v2ray"

Loading…
Cancel
Save