fix shellcheck
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
# shellcheck shell=ash
|
||||
|
||||
helpers_ucode() {
|
||||
ucode "${PODKOP_LIB:-/usr/lib/podkop-plus}/helpers.uc" "$@"
|
||||
}
|
||||
@@ -215,9 +217,12 @@ base64_decode() {
|
||||
echo "$decoded_url"
|
||||
}
|
||||
|
||||
# Generates a unique 16-character ID based on the current timestamp and a random number
|
||||
# Generates a unique 16-character ID based on the current timestamp, process ID, and system entropy
|
||||
gen_id() {
|
||||
printf '%s%s' "$(date +%s)" "$RANDOM" | md5sum | helpers_ucode md5sum-hex-prefix 16
|
||||
{
|
||||
printf '%s%s' "$(date +%s)" "$$"
|
||||
head -c 16 /dev/urandom 2>/dev/null || true
|
||||
} | md5sum | helpers_ucode md5sum-hex-prefix 16
|
||||
}
|
||||
|
||||
# Download URL to file
|
||||
|
||||
@@ -49,6 +49,10 @@ split_domain_or_subnet_file() {
|
||||
rules_nft_runtime_ucode split-domain-subnet-file "$filepath" "$domains_output" "$subnets_output"
|
||||
}
|
||||
|
||||
rule_list_value_to_commas_string() {
|
||||
printf '%s\n' "$1" | tr ' ' ','
|
||||
}
|
||||
|
||||
get_rule_condition_commas_string() {
|
||||
local section="$1"
|
||||
local key="$2"
|
||||
@@ -72,7 +76,7 @@ get_rule_condition_commas_string() {
|
||||
fi
|
||||
|
||||
if [ -n "$list_value" ]; then
|
||||
echo "${list_value// /,}"
|
||||
rule_list_value_to_commas_string "$list_value"
|
||||
return 0
|
||||
fi
|
||||
|
||||
@@ -87,7 +91,7 @@ get_rule_condition_commas_string() {
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "${list_value// /,}"
|
||||
rule_list_value_to_commas_string "$list_value"
|
||||
}
|
||||
|
||||
get_rule_condition_json_array() {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
# shellcheck shell=ash
|
||||
|
||||
close_inherited_service_lock_fd() {
|
||||
# OpenWrt init scripts may keep their service lock on fd 1000.
|
||||
# shellcheck disable=SC3023
|
||||
exec 1000>&- 2>/dev/null || true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user