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

luci-app-socat: fix file conflicts #205

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions applications/luci-app-socat/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@

include $(TOPDIR)/rules.mk

PKG_VERSION:=20220816-1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like this hack anyway.

Simply comment out this line and your issue should be solved:
https://github.com/immortalwrt/packages/blob/e896f65ee49be10b5c748e65c73b0db86ca6fc8f/net/socat/Makefile#L88

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PKG_VERSION如果要兼容luci17到luci21,就只能这样hack。

之所以不改上游或者第一方的软件包,是因为我打算依赖官方的软件仓库,如果三方的软件包文件跟一方的软件包冲突,自然是改三方的,而且改了也没任何副作用。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果要让用户方便地使用多个软件仓库,自然是要解决这些文件冲突的。总之我们的仓库已经更新了没冲突的版本,如果你们不需要这个patch就关闭吧

PKG_RELEASE:=
LUCI_TITLE:=LuCI support for Socat
LUCI_DEPENDS:=+socat
LUCI_PKGARCH:=all
PKG_RELEASE:=3
PKG_DATE:=20200824

define Package/luci-app-socat/conffiles
/etc/config/socat_luci
endef

include ../../luci.mk

Expand Down
2 changes: 1 addition & 1 deletion applications/luci-app-socat/luasrc/controller/socat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module("luci.controller.socat", package.seeall)
local http = require "luci.http"

function index()
if not nixio.fs.access("/etc/config/socat") then return end
if not nixio.fs.access("/etc/config/socat_luci") then return end

entry({"admin", "network", "socat"}, cbi("socat/index"), _("Socat"), 100).acl_depends = { "luci-app-socat" }
entry({"admin", "network", "socat", "config"}, cbi("socat/config")).leaf = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
local d = require "luci.dispatcher"

m = Map("socat", translate("Socat Config"))
m = Map("socat_luci", translate("Socat Config"))
m.redirect = d.build_url("admin", "network", "socat")

s = m:section(NamedSection, arg[1], "config", "")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local d = require "luci.dispatcher"
local e = luci.model.uci.cursor()

m = Map("socat", translate("Socat"), translate("Socat is a versatile networking tool named after 'Socket CAT', which can be regarded as an N-fold enhanced version of NetCat"))
m = Map("socat_luci", translate("Socat"), translate("Socat is a versatile networking tool named after 'Socket CAT', which can be regarded as an N-fold enhanced version of NetCat"))

s = m:section(NamedSection, "global", "global")
s.anonymous = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ stop_service() {
}

start() {
enable=$(uci -q get $CONFIG.@global[0].enable)
enable=$(uci -q get socat_luci.@global[0].enable)
if [ "$enable" = "0" ];then
stop_service
else
mkdir -p $CONFIG_PATH
add_rule
config_load $CONFIG
config_load socat_luci
config_foreach run_service "config"
gen_include
fi
Expand Down
18 changes: 15 additions & 3 deletions applications/luci-app-socat/root/etc/uci-defaults/luci-app-socat
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
#!/bin/sh

if grep -q '^config config ' /etc/config/socat && ! grep -q '^config config ' /etc/config/socat_luci; then
echo >>/etc/config/socat_luci
cat /etc/config/socat >>/etc/config/socat_luci
fi

uci -q get socat_luci.global >/dev/null || uci -q batch <<-EOF >/dev/null
set socat_luci.global=global
set socat_luci.global.enable=1
commit socat_luci
EOF

uci -q batch <<-EOF >/dev/null
delete firewall.socat
set firewall.socat=include
set firewall.socat.type=script
set firewall.socat.path=/var/etc/socat.include
set firewall.socat.reload=1
commit firewall
EOF

uci -q batch <<-EOF >/dev/null
delete ucitrack.@socat[-1]
add ucitrack socat
set ucitrack.@socat[-1].init=socat
delete ucitrack.@socat_luci[-1]
add ucitrack socat_luci
set ucitrack.@socat_luci[-1].init=socat_luci
commit ucitrack
EOF

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"luci-app-socat": {
"description": "Grant UCI access for luci-app-socat",
"read": {
"uci": [ "socat" ]
"uci": [ "socat_luci" ]
},
"write": {
"uci": [ "socat" ]
"uci": [ "socat_luci" ]
}
}
}