Xray-install icon indicating copy to clipboard operation
Xray-install copied to clipboard

可否增加openwrt的安裝?

Open xiagw opened this issue 4 years ago • 4 comments

cat /etc/os-release
NAME="OpenWrt"
VERSION="19.07.7"
ID="openwrt"
ID_LIKE="lede openwrt"
PRETTY_NAME="OpenWrt 19.07.7"
VERSION_ID="19.07.7"
HOME_URL="https://openwrt.org/"
BUG_URL="https://bugs.openwrt.org/"
SUPPORT_URL="https://forum.openwrt.org/"
BUILD_ID="r11306-c4a6851c72"
OPENWRT_BOARD="x86/64"
OPENWRT_ARCH="x86_64"
OPENWRT_TAINTS=""
OPENWRT_DEVICE_MANUFACTURER="OpenWrt"
OPENWRT_DEVICE_MANUFACTURER_URL="https://openwrt.org/"
OPENWRT_DEVICE_PRODUCT="Generic"
OPENWRT_DEVICE_REVISION="v0"
OPENWRT_RELEASE="OpenWrt 19.07.7 r11306-c4a6851c72"

xiagw avatar May 07 '21 12:05 xiagw

@xiagw 你可以剽窃 openwrt-21.02 中的 xray-core 软件包

1715173329 avatar May 07 '21 12:05 1715173329

手动安装,以下 service 脚本仅供参考

#!/bin/sh /etc/rc.common
# /etc/init.d/xray enable

START=91
STOP=89

USE_PROCD=1
LimitNOFILE=1048576
LimitNPROC=512

PID_DIR=/var/run
NAME=xray
PID_FILE=$PID_DIR/$NAME.pid


check_running() {
  if [ -r $PID_FILE ]; then
    read -r PID <$PID_FILE
    if [ -d "/proc/$PID" ]; then
      return 0
    else
      rm -f $PID_FILE
      return 1
    fi
  else
    return 2
  fi
}

start_service() {
  echo "Starting $NAME..."
  mkdir /var/log/$NAME >/dev/null 2>&1
  ulimit -n 99999
  procd_open_instance
  procd_set_param respawn
  procd_set_param env XRAY_LOCATION_ASSET=/usr/local/etc/$NAME
  procd_set_param command /usr/local/bin/$NAME -confdir /usr/local/etc/$NAME
  procd_set_param stdout 1
  procd_set_param stderr 1
  procd_set_param pidfile /var/run/$NAME.pid
  procd_close_instance
  check_running
}

stop_service() {
  if check_running; then
    kill -9 $PID
    rm -f $PID_FILE
    echo "Stopping $NAME success"
  else
    echo "$NAME is stopped"
    RET_VAL=1
  fi
}

reload_service() {
  echo "Restarting $NAME..."
  stop_service
  sleep 0.5
  start_service
}

Rirmach avatar May 07 '21 12:05 Rirmach

感谢,这个是 init.d 的脚本,这个可以作为 install-release.sh 的附件。 我的意思是说能否在 install-release.sh 里面增加一个 判断 openwrt , 就在 systemd 的那个判断 加上 判断 openwrt, 然后再附上上面的 init脚本,就能在 openwrt 里自动安装好,

xiagw avatar May 08 '21 02:05 xiagw

比较困难,openwrt没有使用systemctl。

我的意思是说能否在 install-release.sh 里面增加一个 判断 openwrt , 就在 systemd 的那个判断 加上 判断 openwrt, 然后再附上上面的 init脚本,就能在 openwrt 里自动安装好,

这样是行不通的,脚本定位是一个广泛适配的脚本,不能为了某个特定系统而采取特殊的安装方式

ghost avatar May 08 '21 16:05 ghost