summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorIvan Shapovalov <intelfx100@gmail.com>2013-02-12 13:39:09 +0100
committerJouke Witteveen <j.witteveen@gmail.com>2013-02-14 22:28:43 +0100
commitb0f92895e6c5ca54a6c8e9ed7ed6db2816d54d8a (patch)
tree58507b211f8c370035b8b2e3e7e0dff32368c4cf /src
parentc5e26b20745037e1edda0288a4f08352c9097768 (diff)
downloadnetctl-b0f92895e6c5ca54a6c8e9ed7ed6db2816d54d8a.tar.gz
netctl-b0f92895e6c5ca54a6c8e9ed7ed6db2816d54d8a.tar.xz
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.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/netctl1
1 files changed, 1 insertions, 0 deletions
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' \