Skip to contentSkip to conversation

Debian: handle move of ip(8) to /sbin in Jessie

PATCH In review Ian Campbell 2 participants 2 messages Sep 21, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Debian: handle move of ip(8) to /sbin in Jessie

Unfortunately udev treats non-absolute commands as relative to /lib/udev rather than consulting $PATH, so we have to figure out the path based on the suite.

Without this the force-mac-address workaround (needed on Arndale) doesn't work.

---
 ts-host-install | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
ts-host-install +3 -1
index f734a9c..cc91ccb 100755
@@ -235,10 +235,12 @@ sub setup_pxeboot_firstboot($) {
 	die "need Ether for $ho->{Name} ($wantphysif)"
 	    unless defined $ho->{Ether};
         system_checked(qw(mkdir -p --), "$initrd_overlay.d/etc/udev/rules.d");
+	# ip(8) moved to /sbin in Jessie
+	my $ipcmd = $ho->{Suite} =~ m/wheezy/ ? "/bin/ip" : "/sbin/ip";
         file_simple_write_contents
             ("$initrd_overlay.d/etc/udev/rules.d/70-persistent-net.rules",
              $ho->{Flags}{'force-mac-address'} ? <<END : <<END);
-SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNEL=="$wantphysif", RUN += "/bin/ip link set $wantphysif address $ho->{Ether}"
+SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", KERNEL=="$wantphysif", RUN += "$ipcmd link set $wantphysif address $ho->{Ether}"
 END
 SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="$ho->{Ether}", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="$wantphysif"
 END
Signature · 1 line
2.5.1
Acked-by on v1 1/1
#1 lore raw

Ian Campbell writes ("[PATCH OSSTEST] Debian: handle move of ip(8) to /sbin in Jessie"):

Quoted 3 lines

Unfortunately udev treats non-absolute commands as relative to /lib/udev rather than consulting $PATH, so we have to figure out the path based on the suite.

Bah.

Tempting to say `use env(1)' but of course that's in /usr.