-
-
Save jack338c/9a2a805e0ed6cb4efdba71d3f62605f0 to your computer and use it in GitHub Desktop.
openwrt-clash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh /etc/rc.common | |
| # | |
| # This is free software, licensed under the GNU General Public License v3. | |
| # See /LICENSE for more information. | |
| # | |
| START=95 | |
| USE_PROCD=1 | |
| PROG=/usr/bin/clash | |
| HOME=/etc/local/clash | |
| start_service() { | |
| procd_open_instance clash | |
| procd_set_param respawn ${respawn_threshold:-0} ${respawn_timeout:-10} ${respawn_retry:-0} | |
| procd_set_param stdout 1 # forward stdout of the command to logd | |
| procd_set_param stderr 1 # same for stderr | |
| procd_set_param user nobody | |
| procd_set_param command "$PROG" | |
| procd_append_param command -d "$HOME" | |
| procd_close_instance | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| set -e | |
| bindir=/tmp/clash | |
| binfile=$bindir/clash | |
| if [ ! -d $bindir ]; then | |
| mkdir -p $bindir | |
| fi | |
| if [ ! -f $bindir/Country.mmdb ]; then | |
| wget https://cdn.jsdelivr.net/gh/Loyalsoldier/geoip@release/Country.mmdb -O $bindir/Country.mmdb | |
| fi | |
| if [ ! -f $binfile ]; then | |
| wget https://github.com/MetaCubeX/Clash.Meta/releases/download/v1.14.4/clash.meta-linux-mipsle-softfloat-v1.14.4.gz -O - | gunzip -c > $binfile | |
| chmod +x $binfile | |
| fi | |
| exec $binfile "$@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| chmod +x /etc/init.d/clash | |
| chmod +x /usr/bin/clash | |
| # 创建并初始化配置目录 | |
| mkdir -p /etc/local/clash | |
| chown nobody /etc/local/clash | |
| ln -s /tmp/clash/Country.mmdb /etc/local/clash/Country.mmdb | |
| # 将 config.yaml 放入 /etc/local/clash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment