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

使用 UCI 的 init.d 脚本在 OpenWRT 21.02 无法运行 #30

Open
Gallium70 opened this issue Jun 2, 2023 · 1 comment
Open

使用 UCI 的 init.d 脚本在 OpenWRT 21.02 无法运行 #30

Gallium70 opened this issue Jun 2, 2023 · 1 comment

Comments

@Gallium70
Copy link

在 OpenWRT 21.02 版本上,文档中提供的 uci set goauthing.config.username='<YOUR-TUNET-ACCOUNT-NAME>' 运行报错,提示 uci: Invalid argument ;尝试手写配置文件后,goauthing@ init.d 脚本中所用的 config_get 函数也无法获取到相应的配置值。

经测试,一种可能正常工作的组合如下:

命令行:

touch /etc/config/goauthing
uci add goauthing goauthing
uci set goauthing.@goauthing[0].username='<YOUR-TUNET-ACCOUNT-NAME>'
uci set goauthing.@goauthing[0].password='<YOUR-TUNET-PASSWORD>'
uci commit

对应的 /etc/config/goauthing 配置文件格式:

config goauthing
        option username '<YOUR-TUNET-ACCOUNT-NAME>'
        option password '<YOUR-TUNET-PASSWORD>'

在 init.d 脚本中,需要修改获取配置的命令如下:

start_instance() {
  local config=$1
  local username password
  config_get username $config username
  config_get password $config password
  ...
}

logout() {
  local config=$1
  local username password
  config_get username $config username
  config_get password $config password
  ...
}
@ZenithalHourlyRate
Copy link
Collaborator

欢迎发一个 PR 修改文档与相应脚本。由于个人没使用过 openwrt,不知道是哪个版本开始语法发生了改变。

Cc @BaksiLi

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

2 participants