Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

可否增加openwrt的安裝? #25

Open
xiagw opened this issue May 7, 2021 · 4 comments
Open

可否增加openwrt的安裝? #25

xiagw opened this issue May 7, 2021 · 4 comments

Comments

@xiagw
Copy link
Contributor

xiagw commented May 7, 2021

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"
@1715173329
Copy link
Member

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

@Rirmach
Copy link

Rirmach commented May 7, 2021

手动安装,以下 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
}

@xiagw
Copy link
Contributor Author

xiagw commented May 8, 2021

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

@ghost
Copy link

ghost commented May 8, 2021

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

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants