[arch-projects] [netctl][PATCH] Automatically escape dashes in interface names
Jouke Witteveen
j.witteveen at gmail.com
Fri Feb 15 06:48:54 EST 2013
On Tue, Feb 12, 2013 at 1:39 PM, Ivan Shapovalov <intelfx100 at gmail.com> wrote:
> 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.
Thanks, I'll add it.
> ---
> src/netctl | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/src/netctl b/src/netctl
> index 7cf0b59..498b50d 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}" )
I did change this to a global substitution.
> printf 'BindsTo=sys-subsystem-net-devices-%s.device\n' \
> "${BindsToInterfaces[@]}" >> "$unit"
> printf 'After=sys-subsystem-net-devices-%s.device\n' \
> --
> 1.8.1.3
>
>
- Jouke
More information about the arch-projects
mailing list