Commit 4a47cafe authored by Alessandro Rubini's avatar Alessandro Rubini

/etc/init.d/lldpd.sh: fix another bashism

[Thanks a lot to Enkhbold Ochirsuren of GSI who traced back a strange
behaviour to the "printf" incompatibility].

This removes "printf -v <outputvar> <format> ..." which is only
available in bash.

These needless incompatible extensions to standard commands are a
source of endless headaches. New features must spit an error when
unavailable (i.e., bash people should add vprintf, not break printf,
imho)

In this case, my previous "fix" to this file was incomplete, because
I fixed a bashism but didn't see this other one.

Also, this changes the shebang to call sh (which is already done by rcS:
only the interactive execution now uses sh instead of bash).
Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 049e8b55
Pipeline #4619 failed with stage
in 8 seconds
#!/bin/bash
#!/bin/sh
#
# Controls lldpd.
#
......@@ -70,7 +70,7 @@ start() {
echo "configure system interface pattern '!eth*'" >> $LLDPD_CONFIG
fi
for i_port in $(seq 1 18); do # scan all the physical ports
printf -v i_port_zero "%02d" $i_port
i_port_zero=$(printf "%02d" $i_port)
vlan=$(eval "echo \$CONFIG_VLANS_PORT"$i_port_zero"_LLDP_TX_VID")
if [ ! -z "$vlan" ]; then
prio=$(eval "echo \$CONFIG_VLANS_PORT"$i_port_zero"_LLDP_TX_PRIO")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment