找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
查看: 1137|回复: 3

给闪存容量太小的人准备的脚本

[复制链接]
发表于 2022-5-24 20:54 | 显示全部楼层 |阅读模式
本帖最后由 aniven 于 2022-5-24 20:58 编辑

对于老一点的路由器,闪存一般都不大,在 16M 以下,象 xray 及 frp 之类的插件体型巨大,可能不够空间安装或编译到固件中,可采用动态下载的方式运行插件,一般下载到 /tmp 目录中(实际上是内存中的区域,每次重启会丢失)。
以我的 16m k2p 为例,编译 OpenWrt 加了了 xray 就没什么空间了,xray 可执行文件没压缩前20M之居,frp 内网穿透就放不下了,以下是一个动态安装执行 frpc 的例子:

创建文件 /etc/init.d/frpc:
  1. #!/bin/sh /etc/rc.common

  2. START=99

  3. # 下载地址,注意路由器架构
  4. FRPC_URL=https://youfile.com/frp/mipsle/frpc.tar.gz

  5. # 下载并解压文件
  6. get_frpc() {
  7.     if [ ! -f "/tmp/frpc" ]; then
  8.         wget -nv --no-check-certificate $FRPC_URL -O /tmp/frpc.tar.gz
  9.         tar -xzf /tmp/frpc.tar.gz -C /tmp
  10.         rm -f /tmp/frpc.tar.gz
  11.     fi
  12. }

  13. start() {
  14.     sleep 60
  15.     get_frpc
  16.     /tmp/frpc -c /etc/frp/frpc.ini >/dev/null 2>&1 &
  17.     echo "FRP Client has started."
  18. }

  19. stop() {
  20.     kill -9 `ps | grep '/tmp/frpc' | grep -v 'grep' | awk '{print $1}'` >/dev/null 2>&1 &
  21.     echo "FRP Client has stopped."
  22. }
复制代码

创建 frpc 配置文件 /etc/frp/frpc.ini:
  1. [common]
  2. server_addr = 123.123.123.123
  3. server_port = 7000
  4. privilege_token = your_password

  5. [router]
  6. type = http
  7. local_ip = 127.0.0.1
  8. local_port = 80
  9. subdomain = openwrt
复制代码

最后开启自动运行:
  1. /etc/init.d/frpc enable
  2. /etc/init.d/frpd start
复制代码

我的恩山、我的无线 The best wifi forum is right here.
发表于 2022-5-24 21:28 | 显示全部楼层
换个大点的闪存更靠谱吧???
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2022-7-4 21:22 | 显示全部楼层
这个好,正需要
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2023-8-22 09:15 | 显示全部楼层
编译固件时要怎么做呢
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-3-28 21:01

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表