diff --git a/Cards/Computer Science/Clash订阅.md b/Cards/Computer Science/Clash订阅.md deleted file mode 100644 index 0b1c6bf9..00000000 --- a/Cards/Computer Science/Clash订阅.md +++ /dev/null @@ -1,12 +0,0 @@ ---- -aliases: -atlas: "[[Atlas/Card|Card]]" -created: 2024-02-05 17:41:08 -modified: 2024-02-05 17:49:05 -tags: - - OpenWrt -title: Clash订阅 ---- -- [机场](https://ssr.wtf/) -- [规则集](https://github.com/Loyalsoldier/clash-rules) -- [订阅文件](https://op.pkugsm.cf/docs/%E8%96%AF%E6%9D%A1.yaml) \ No newline at end of file diff --git a/Cards/Computer Science/OpenWrt部署.md b/Cards/Computer Science/OpenWrt部署.md index 16e2ce17..62d4340b 100644 --- a/Cards/Computer Science/OpenWrt部署.md +++ b/Cards/Computer Science/OpenWrt部署.md @@ -2,7 +2,7 @@ aliases: atlas: "[[Atlas/Card|Card]]" created: 2023-07-27 14:59:53 -modified: 2024-02-05 19:15:53 +modified: 2024-02-05 20:51:59 tags: - OpenWrt Title: OpenWrt部署 @@ -46,7 +46,9 @@ Title: OpenWrt部署 ## OpenClash - [安装包下载](https://github.com/vernesong/OpenClash/releases) -- [[Clash订阅]] +- [机场](https://ssr.wtf/) +- [规则集](https://github.com/Loyalsoldier/clash-rules) +- [订阅文件](https://op.pkugsm.cf/docs/%E8%96%AF%E6%9D%A1.yaml) ### 插件设置 @@ -202,6 +204,8 @@ Title: OpenWrt部署 ## Frp 内网穿透 +在【系统-软件包】中安装 ipk 和 luci 界面 + ### 基本设置 - 服务器:pkugsm.cf @@ -237,8 +241,36 @@ Title: OpenWrt部署 ## uHTTPd -iStoreOS 中已默认开启,目前我用于存放 tvbox 的订阅 +iStoreOS 中已默认开启,目前我用于存放 tvbox 的订阅文件,文件的本地路径为 `/www/doc/TVBOX.txt` 订阅链接为 `192.168.1.100/doc/TVBOX.txt` +## Rclone + +在【系统-软件包】中安装 ipk 和 luci 界面 + +去[官网](https://rclone.org/downloads/) 下载 Windows 版本的进行配置,因为配置过程中有一步需要调用 GUI 网页来鉴权,直接在 OpenWrt 命令行中无法完成这一步,因此在 Windows 上操作后再将配置文件导入 OpenWrt 中,配置文件路径为 `/root/.config/rclone` + +### Windows 配置流程(以 OneDrive 为例) + +- 输入 `rclone config` 开始配置 +- 输入 `n` 创建一个新配置 +- 根据要挂载的内容输入编号 +- client_id 和 client_secret 留空 +- 输入 `1` 选择全球区 +- 输入 `n` 不编辑高级配置 +- 输入 `y` 进行自动配置 +- 输入 `1` 选择连接类型 +- 输入 `y` 确认生成 +- 输入 `q` 退出配置 +- 资源管理器打开 `C:\Users\Administrator\AppData\Roaming\rclone` 将配置文件上传到 OpenWrt + +### 挂载 OneDrive 并设置开机自动挂载 + +- 输入 `mkdir /mnt/OneDrive` 来创建用于挂载的文件夹 +- 输入 `rclone mount onedrive:/ /mnt/onedrive --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000` 完成挂载 +- 将 [[Rclone开机自动挂载]] 中的代码保存为 `rcloned` 并上传到 OpenWrt +- 在【系统-启动项-本地启动脚本】中将 `bash /etc/init.d/rcloned start` 这行代码添加进去 + +## ## 贴吧 diff --git a/Cards/Computer Science/Rclone开机自动挂载.md b/Cards/Computer Science/Rclone开机自动挂载.md new file mode 100644 index 00000000..7ec4e803 --- /dev/null +++ b/Cards/Computer Science/Rclone开机自动挂载.md @@ -0,0 +1,65 @@ +--- +aliases: +atlas: "[[Atlas/Card|Card]]" +created: 2024-02-05 20:44:57 +modified: 2024-02-05 20:48:14 +tags: + - OpenWrt +title: Rclone开机自动挂载 +--- + +```bash + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin + +REMOTE='OneDrive:/ ' +LOCAL='/mnt/OneDrive' +CONFIG='/root/.config/rclone/rclone.conf' +DEMO='rclone' + +[ -n "$REMOTE" ] || exit 1; +[ -x "$(which fusermount)" ] || exit 1; +[ -x "$(which $DEMO)" ] || exit 1; + +case "$1" in +start) +  ps -ef |grep -v grep |grep -q "$REMOTE" +  [ $? -eq '0' ] && { +    DEMOPID="$(ps -C $DEMO -o pid= |head -n1 |grep -o '[0-9]\{1,\}')" +    [ -n "$DEMOPID" ] && echo "$DEMO already in running.[$DEMOPID]"; +    exit 1; +  } +  fusermount -zuq $LOCAL >/dev/null 2>&1 +  mkdir -p $LOCAL +  rclone mount $REMOTE $LOCAL --config $CONFIG --copy-links --no-gzip-encoding --no-check-certificate --allow-other --allow-non-empty --umask 000 >/dev/null 2>&1 & +  sleep 3; +  DEMOPID="$(ps -C $DEMO -o pid=|head -n1 |grep -o '[0-9]\{1,\}')" +  [ -n "$DEMOPID" ] && { +    echo -ne "$DEMO start running.[$DEMOPID]\n$REMOTE --> $LOCAL\n\n" +    echo 'ok' >/root/ok +    exit 0; +  } || { +    echo "$DEMO start fail! " +    exit 1; +  } +  ;; +stop) +  DEMOPID="$(ps -C $DEMO -o pid= |head -n1 |grep -o '[0-9]\{1,\}')" +  [ -z "$DEMOPID" ] && echo "$DEMO not running." +  [ -n "$DEMOPID" ] && kill -9 $DEMOPID >/dev/null 2>&1 +  [ -n "$DEMOPID" ] && echo "$DEMO is stopped.[$DEMOPID]" +  fusermount -zuq $LOCAL >/dev/null 2>&1 +  ;; +init) +  fusermount -zuq $LOCAL +  rm -rf $LOCAL; +  mkdir -p $LOCAL; +  chmod a+x $0; +  update-rc.d -f $(basename $0) remove; +  update-rc.d -f $(basename $0) defaults; +  rclone config; +  ;; +esac + +exit 0 +``` \ No newline at end of file