old dash compat

This commit is contained in:
bol-van
2024-05-04 16:01:09 +03:00
parent a9f27896d3
commit f2dcc57711
9 changed files with 20 additions and 20 deletions

View File

@@ -60,7 +60,7 @@ find_str_in_list()
}
end_with_newline()
{
local c=$(tail -c 1)
local c="$(tail -c 1)"
[ "$c" = "" ]
}
@@ -140,7 +140,7 @@ linux_min_version()
}
linux_get_subsys()
{
local INIT=$(sed 's/\x0/\n/g' /proc/1/cmdline | head -n 1)
local INIT="$(sed 's/\x0/\n/g' /proc/1/cmdline | head -n 1)"
[ -L "$INIT" ] && INIT=$(readlink "$INIT")
INIT=$(basename "$INIT")
@@ -213,7 +213,7 @@ fsleep_setup()
elif busybox usleep 1 2>/dev/null; then
FSLEEP=2
else
local errtext=$(read -t 0.001 2>&1)
local errtext="$(read -t 0.001 2>&1)"
if [ -z "$errtext" ]; then
FSLEEP=3
# newer openwrt has ucode with system function that supports timeout in ms

View File

@@ -86,7 +86,7 @@ check_system()
UNAME=$(uname)
if [ "$UNAME" = "Linux" ]; then
# do not use 'exe' because it requires root
local INIT=$(sed 's/\x0/\n/g' /proc/1/cmdline | head -n 1)
local INIT="$(sed 's/\x0/\n/g' /proc/1/cmdline | head -n 1)"
[ -L "$INIT" ] && INIT=$(readlink "$INIT")
INIT=$(basename "$INIT")
# some distros include systemctl without systemd
@@ -316,7 +316,7 @@ check_package_exists_openwrt()
check_package_openwrt()
{
[ -n "$(opkg list-installed $1)" ] && return 0
local what=$(opkg whatprovides $1 | tail -n +2 | head -n 1)
local what="$(opkg whatprovides $1 | tail -n +2 | head -n 1)"
[ -n "$what" ] || return 1
[ -n "$(opkg list-installed $what)" ]
}
@@ -361,7 +361,7 @@ openwrt_fw_section_del()
{
# $1 - fw include postfix
local id=$(openwrt_fw_section_find $1)
local id="$(openwrt_fw_section_find $1)"
[ -n "$id" ] && {
uci delete firewall.@include[$id] && uci commit firewall
rm -f "$OPENWRT_FW_INCLUDE$1"
@@ -377,7 +377,7 @@ openwrt_fw_section_add()
}
openwrt_fw_section_configure()
{
local id=$(openwrt_fw_section_add $1)
local id="$(openwrt_fw_section_add $1)"
[ -z "$id" ] ||
! uci set firewall.@include[$id].path="$OPENWRT_FW_INCLUDE" ||
! uci set firewall.@include[$id].reload="1" ||

View File

@@ -50,4 +50,4 @@ first_packets_for_mode()
n=6
fi
echo $n
}
}

View File

@@ -24,7 +24,7 @@ get_virt()
check_virt()
{
echo \* checking virtualization
local vm=$(get_virt)
local vm="$(get_virt)"
if [ -n "$vm" ]; then
if [ "$vm" = "none" ]; then
echo running on bare metal