自动登录中南大学校园网,保持校园网登录态。
主要配置有 USERNAME、PASSWORD、TYPE。
# USERNAME 为你的学号
# PASSWORD 为你的密码
# TYPE 为运营商类型:1=中国移动, 2=中国联通, 3=中国电信, 4=校园网
# INTERVAL 为自动检测间隔,单位为秒,默认为 10 秒
有如下四个版本:
- 克隆到本地并安装脚本和配置文件:
git clone https://github.com/barkure/CSU-Net-Portal.git && cd CSU-Net-Portal
sudo install -D -m 755 shell/linux/csu-autoauth.sh /usr/local/bin/csu-autoauth
sudo install -D -m 644 shell/linux/config.conf.example /usr/local/etc/csu-autoauth/config.conf- 修改配置:
sudo nano /usr/local/etc/csu-autoauth/config.conf- 添加到系统启动项:
sudo cp shell/linux/csu-autoauth.service /etc/systemd/system/csu-autoauth.service
sudo systemctl daemon-reload
sudo systemctl enable --now csu-autoauth.service- 脚本遵循 文件系统层次结构标准 (FHS):
- /usr/local/bin/csu-autoauth
- /usr/local/etc/csu-autoauth/config.conf
- /var/log/csu-autoauth/csu-autoauth.log
- /etc/systemd/system/csu-autoauth.service
- 运行状态:
sudo systemctl status csu-autoauth.service- 查看日志:
sudo journalctl -u csu-autoauth.service -f- 克隆到本地:
git clone https://github.com/barkure/CSU-Net-Portal.git && cd CSU-Net-Portal- 修改配置模板:
nano shell/macos/config.conf.example- 安装
launchd服务:
sh shell/macos/install-launchd.sh- 该脚本会自动创建:
- ~/.local/bin/csu-autoauth
- ~/.config/csu-autoauth/config.conf
- ~/Library/Logs/csu-autoauth/
- ~/Library/LaunchAgents/com.barkure.csu-autoauth.plist
- 卸载服务:
sh shell/macos/uninstall-launchd.sh- 脚本默认日志文件:
- ~/Library/Logs/csu-autoauth/csu-autoauth.log
- ~/Library/Logs/csu-autoauth/launchd.out.log
- ~/Library/Logs/csu-autoauth/launchd.err.log
- 克隆到本地:
git clone https://github.com/barkure/CSU-Net-Portal.git; cd .\CSU-Net-Portal- 修改配置模板:
notepad .\powershell\config.ps1.example- 安装并启用自启动:
powershell -ExecutionPolicy Bypass -File .\powershell\install-startup.ps1- 该脚本会自动创建:
- $HOME\csu-autoauth.ps1
- $HOME\.config\csu-autoauth\config.ps1
- 取消自启并即刻停止:
powershell -ExecutionPolicy Bypass -File .\powershell\uninstall-startup.ps1- 默认日志文件:
$env:LOCALAPPDATA\csu-autoauth\csu-autoauth.log
请在仓库的 Release 页面下载与你设备架构和 OpenWrt 版本匹配的安装包,再上传到路由器安装。
OpenWrt 目前使用新的包管理器 apk 替换了 opkg,请使用对应的包管理器进行安装:
- OpenWrt
25.12+使用apk:
scp -O ./csu-autoauth-*.apk root@<router-ip>:/tmp/csu-autoauth.apk
ssh root@<router-ip> apk add --allow-untrusted /tmp/csu-autoauth.apk- OpenWrt
24.10及更早版本使用opkg:
scp -O ./csu-autoauth-*.ipk root@<router-ip>:/tmp/csu-autoauth.ipk
ssh root@<router-ip> opkg install /tmp/csu-autoauth.ipk安装完成后,使用 UCI 配置账号密码:
uci set csu-autoauth.main.username='USERNAME'
uci set csu-autoauth.main.password='PASSWORD'
uci set csu-autoauth.main.type='TYPE'
uci set csu-autoauth.main.interval='10'
uci commit csu-autoauth
/etc/init.d/csu-autoauth restart如果仓库软件源可用,包管理器会自动拉取 curl;如果软件源不可用,需要先确保路由器能访问对应软件源,或提前准备好离线的依赖包一并安装。
OpenWrt 包版本维护约定:
- 程序逻辑变化 -> bump
PKG_VERSION, resetPKG_RELEASEto1 - 仅打包变化 -> bump
PKG_RELEASEonly - 仅文档变化 -> no version bump