From b0f92895e6c5ca54a6c8e9ed7ed6db2816d54d8a Mon Sep 17 00:00:00 2001 From: Ivan Shapovalov Date: Tue, 12 Feb 2013 16:39:09 +0400 Subject: Automatically escape dashes in interface names Custom interface names like "eth-phone" or "eth-lte" are not uncommon, and since they are used in pathes inside systemd units, dashes and unprintable characters shall be escaped per unit file rules. So replace "-" with "\x2d" in interface names. --- src/netctl | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/netctl b/src/netctl index 7cf0b59..2324ec9 100755 --- a/src/netctl +++ b/src/netctl @@ -89,6 +89,7 @@ unit_enable() { echo -e "\n[Unit]" >> "$unit" [[ -n $Description ]] && echo "Description=$Description" >> "$unit" : ${BindsToInterfaces=$Interface} + BindsToInterfaces=( "${BindsToInterfaces[@]//-/\\x2d}" ) printf 'BindsTo=sys-subsystem-net-devices-%s.device\n' \ "${BindsToInterfaces[@]}" >> "$unit" printf 'After=sys-subsystem-net-devices-%s.device\n' \ -- cgit v1.2.3-24-g4f1b