correct processing of procd

This commit is contained in:
itdoginfo
2024-11-06 18:19:29 +03:00
parent 96ea424498
commit cc427cbd8a
6 changed files with 32 additions and 21 deletions

View File

@@ -93,8 +93,8 @@ opkg update && opkg install sing-box
Приоритет 1 Приоритет 1
- [x] Переделать на PROCD и выкинуть ucitrack. - [x] Переделать на PROCD и выкинуть ucitrack.
- [x] Нужен дебаг. Restart ucitrack в отдельный скрипт postinst, не отрабатывает. - [x] Нужен дебаг. Restart ucitrack в отдельный скрипт postinst, не отрабатывает.
- [ ] Закомментировать дефолтные значения у list. interface поставить в пустое. - [x] Закомментировать дефолтные значения у list. interface поставить в пустое.
- [ ] Скрипт установки: проверка установлен ли уже podkop. Если да, то просто предлагать обновится без установки тунелей и прокси. - [x] Скрипт установки: проверка установлен ли уже podkop. Если да, то просто предлагать обновится без установки тунелей и прокси.
Приоритет 2 Приоритет 2
- [ ] Списки доменов и подсетей с роутера - [ ] Списки доменов и подсетей с роутера

View File

@@ -4,7 +4,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-podkop PKG_NAME:=luci-app-podkop
PKG_VERSION:=0.2.2 PKG_VERSION:=0.2.3
PKG_RELEASE:=1 PKG_RELEASE:=1
LUCI_TITLE:=LuCI podkop app LUCI_TITLE:=LuCI podkop app

View File

@@ -0,0 +1,10 @@
#!/bin/sh
rm -f /var/luci-indexcache*
rm -f /tmp/luci-indexcache*
[ -x /etc/init.d/rpcd ] && /etc/init.d/rpcd reload
logger -t "podkop" "$timestamp uci-defaults script executed"
exit 0

View File

@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=podkop PKG_NAME:=podkop
PKG_VERSION:=0.2.2 PKG_VERSION:=0.2.3
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_MAINTAINER:=ITDog <podkop@itdog.info> PKG_MAINTAINER:=ITDog <podkop@itdog.info>

View File

@@ -1,5 +1,5 @@
config main 'main' config main 'main'
option mode 'proxy' option mode ''
option interface '' option interface ''
option proxy_string '' option proxy_string ''
option domain_list_enabled '1' option domain_list_enabled '1'

View File

@@ -7,7 +7,7 @@ script=$(readlink "$initscript")
NAME="$(basename ${script:-$initscript})" NAME="$(basename ${script:-$initscript})"
config_load "$NAME" config_load "$NAME"
EXTRA_COMMANDS="list_update add_route_interface version" EXTRA_COMMANDS="list_update add_route_interface"
EXTRA_HELP=" list_update Updating domain and subnet lists EXTRA_HELP=" list_update Updating domain and subnet lists
add_route_interface Adding route for interface add_route_interface Adding route for interface
sing_box_config_vless For test vless string" sing_box_config_vless For test vless string"
@@ -43,7 +43,7 @@ start_service() {
sing_box_config_vless "$proxy_string" "1603" sing_box_config_vless "$proxy_string" "1603"
else else
log "Unsupported proxy type: $proxy_string" log "Unsupported proxy type: $proxy_string"
exit 1 return
fi fi
add_route_tproxy podkop2 add_route_tproxy podkop2
sing_box_config_check sing_box_config_check
@@ -66,7 +66,7 @@ start_service() {
log "Proxy mode" log "Proxy mode"
if ! command -v sing-box >/dev/null 2>&1; then if ! command -v sing-box >/dev/null 2>&1; then
log "Sing-box isn't installed. Proxy mode works with sing-box" log "Sing-box isn't installed. Proxy mode works with sing-box"
exit 1 return
fi fi
# Main - proxy, Second - proxy # Main - proxy, Second - proxy
@@ -84,7 +84,7 @@ start_service() {
sing_box_config_outbound_vless "$proxy_string" "$outbound_main" main sing_box_config_outbound_vless "$proxy_string" "$outbound_main" main
else else
log "Unsupported proxy type: $proxy_string" log "Unsupported proxy type: $proxy_string"
exit 1 return
fi fi
config_get proxy_string second "proxy_string" config_get proxy_string second "proxy_string"
@@ -94,7 +94,7 @@ start_service() {
sing_box_config_outbound_vless "$proxy_string" "$outbound_second" second sing_box_config_outbound_vless "$proxy_string" "$outbound_second" second
else else
log "Unsupported proxy type: $proxy_string" log "Unsupported proxy type: $proxy_string"
exit 1 return
fi fi
jq --argjson outbounds "$(jq -s '{"outbounds": (.[0].outbounds + .[1].outbounds)}' "$outbound_main" "$outbound_second")" \ jq --argjson outbounds "$(jq -s '{"outbounds": (.[0].outbounds + .[1].outbounds)}' "$outbound_main" "$outbound_second")" \
@@ -117,7 +117,7 @@ start_service() {
sing_box_config_vless "$proxy_string" "1602" sing_box_config_vless "$proxy_string" "1602"
else else
log "Unsupported proxy type: $proxy_string" log "Unsupported proxy type: $proxy_string"
exit 1 return
fi fi
add_route_tproxy podkop add_route_tproxy podkop
fi fi
@@ -143,7 +143,7 @@ start_service() {
;; ;;
*) *)
log "Requires *vpn* or *proxy* value" log "Requires *vpn* or *proxy* value"
exit 1 return
;; ;;
esac esac
@@ -243,6 +243,7 @@ reload_service() {
} }
service_triggers() { service_triggers() {
log "service_triggers start"
procd_add_config_trigger "config.change" "$NAME" "$initscript" reload 'on_config_change' procd_add_config_trigger "config.change" "$NAME" "$initscript" reload 'on_config_change'
} }
@@ -370,7 +371,7 @@ dnsmasqfull() {
log "Dnsmasq-full is not installed. Future: link only" log "Dnsmasq-full is not installed. Future: link only"
log "Use script or:" log "Use script or:"
log "cd /tmp/ && /bin/opkg download dnsmasq-full && /bin/opkg remove dnsmasq && /bin/opkg install dnsmasq-full --cache /tmp/ && cp /etc/config/dhcp /etc/config/dhcp-old && mv /etc/config/dhcp-opkg /etc/config/dhcp" log "cd /tmp/ && /bin/opkg download dnsmasq-full && /bin/opkg remove dnsmasq && /bin/opkg install dnsmasq-full --cache /tmp/ && cp /etc/config/dhcp /etc/config/dhcp-old && mv /etc/config/dhcp-opkg /etc/config/dhcp"
exit 1 return
fi fi
} }
@@ -428,7 +429,7 @@ add_set() {
*) *)
log "Requires *vpn* or *proxy* value" log "Requires *vpn* or *proxy* value"
exit 1 return
;; ;;
esac esac
} }
@@ -445,13 +446,13 @@ add_route_interface() {
if ! ip link show "$interface" >/dev/null 2>&1; then if ! ip link show "$interface" >/dev/null 2>&1; then
log "Interface "$interface" undetected. exit" log "Interface "$interface" undetected. exit"
exit 1 return
fi fi
fi fi
if ! ip link show "$interface" >/dev/null 2>&1; then if ! ip link show "$interface" >/dev/null 2>&1; then
log "Interface "$interface" does not exist, not possible to create a route" log "Interface "$interface" does not exist, not possible to create a route"
exit 1 return
fi fi
if ip route show table $table | grep -q "^default dev"; then if ip route show table $table | grep -q "^default dev"; then
@@ -472,7 +473,7 @@ add_route_interface() {
done done
log "The maximum number of attempts has been exceeded. Failed to add a route." log "The maximum number of attempts has been exceeded. Failed to add a route."
exit 1 return
} }
add_route_tproxy() { add_route_tproxy() {
@@ -523,7 +524,7 @@ lists_domains_download() {
;; ;;
*) *)
log "Unidentified list of domains" log "Unidentified list of domains"
exit 1 return
;; ;;
esac esac
@@ -563,7 +564,7 @@ lists_services_download() {
;; ;;
*) *)
log "Unidentified list of domains" log "Unidentified list of domains"
exit 1 return
;; ;;
esac esac
@@ -717,7 +718,7 @@ dnsmasq_config_check() {
local config="$1" local config="$1"
if ! /usr/sbin/dnsmasq --conf-file=/tmp/dnsmasq.d/$config --test 2>&1 | grep -q "syntax check OK"; then if ! /usr/sbin/dnsmasq --conf-file=/tmp/dnsmasq.d/$config --test 2>&1 | grep -q "syntax check OK"; then
log "Dnsmasq config $config contains errors. Break" log "Dnsmasq config $config contains errors. Break"
exit 1 return
fi fi
} }
@@ -942,6 +943,6 @@ sing_box_config_outbound_vless() {
sing_box_config_check() { sing_box_config_check() {
if ! sing-box -c /etc/sing-box/config.json check >/dev/null 2>&1; then if ! sing-box -c /etc/sing-box/config.json check >/dev/null 2>&1; then
log "Sing-box configuration is invalid" log "Sing-box configuration is invalid"
exit 1 return
fi fi
} }