mirror of
https://github.com/itdoginfo/podkop.git
synced 2025-12-07 12:06:56 +03:00
refactor: Add file existence checks and improve startup reliability
This commit is contained in:
@@ -1,8 +1,25 @@
|
|||||||
#!/bin/ash
|
#!/bin/ash
|
||||||
|
|
||||||
[ -r /lib/functions.sh ] && . /lib/functions.sh
|
check_required_file() {
|
||||||
[ -r /lib/config/uci.sh ] && . /lib/config/uci.sh
|
local file="$1"
|
||||||
|
|
||||||
|
if [ ! -r "$file" ]; then
|
||||||
|
echo "Error: required file '$file' is missing or not readable" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
PODKOP_LIB="/usr/lib/podkop"
|
PODKOP_LIB="/usr/lib/podkop"
|
||||||
|
check_required_file /lib/functions.sh
|
||||||
|
check_required_file /lib/config/uci.sh
|
||||||
|
check_required_file "$PODKOP_LIB/constants.sh"
|
||||||
|
check_required_file "$PODKOP_LIB/nft.sh"
|
||||||
|
check_required_file "$PODKOP_LIB/helpers.sh"
|
||||||
|
check_required_file "$PODKOP_LIB/sing_box_config_manager.sh"
|
||||||
|
check_required_file "$PODKOP_LIB/sing_box_config_facade.sh"
|
||||||
|
check_required_file "$PODKOP_LIB/logging.sh"
|
||||||
|
. /lib/config/uci.sh
|
||||||
|
. /lib/functions.sh
|
||||||
. "$PODKOP_LIB/constants.sh"
|
. "$PODKOP_LIB/constants.sh"
|
||||||
. "$PODKOP_LIB/nft.sh"
|
. "$PODKOP_LIB/nft.sh"
|
||||||
. "$PODKOP_LIB/helpers.sh"
|
. "$PODKOP_LIB/helpers.sh"
|
||||||
|
|||||||
Reference in New Issue
Block a user