udhcpd: Fixes and new udev rule
authorJoel A Fernandes <joelagnel@ti.com>
Fri, 11 Nov 2011 14:51:47 +0000 (08:51 -0600)
committerKoen Kooi <koen@dominion.thruhere.net>
Fri, 11 Nov 2011 15:11:19 +0000 (16:11 +0100)
This moves the logic to configure and start dhcp to a udev rule which
is a better place than a systemd service

Also fixes a bug where stopping and starting network service would
cause dhcp to fail.

Signed-off-by: Joel A Fernandes <joelagnel@ti.com>
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
recipes-ti/beagleboard/gadget-init.bb
recipes-ti/beagleboard/gadget-init/g-ether-start-service.sh
recipes-ti/beagleboard/gadget-init/network-gadget-init.service
recipes-ti/beagleboard/gadget-init/udhcpd.rules [new file with mode: 0644]

index 8ddefaa24caca7688ccdaa3b10523a79e94a7352..0d4682ef618b342f9c50c136c78bc54be1df787d 100644 (file)
@@ -1,6 +1,6 @@
 DESCRIPTION = "Units to initialize usb gadgets"
 
-PR = "r10"
+PR = "r11"
 
 LICENSE = "MIT"
 LIC_FILES_CHKSUM = "file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58"
@@ -15,6 +15,7 @@ SRC_URI = "file://storage-gadget-init.service \
            file://99-hokey-pokey.rules \
            file://hokey-pokey.sh \
            file://bone-gmass-eject.rules \
+           file://udhcpd.rules \
            file://g-storage-reinsert.sh \
            file://g-ether-start-service.sh \
            file://g-ether-load.sh \
@@ -50,7 +51,8 @@ FILES_${PN}-storage = "${base_libdir}/systemd/system/storage-gadget-init.service
 FILES_${PN}-network = "${base_libdir}/systemd/system/network-gadget-init.service \
                        ${base_libdir}/systemd/system/basic.target.wants/network-gadget-init.service \
                        ${bindir}/g-ether-load.sh \
-                       ${bindir}/g-ether-start-service.sh"
+                       ${bindir}/g-ether-start-service.sh \
+                       ${sysconfdir}/udev/rules.d/udhcpd.rules"
 
 FILES_${PN}-udhcpd = "${base_libdir}/systemd/system/udhcpd.service \
                       ${base_libdir}/systemd/system/basic.target.wants/udhcpd.service \
index 2db16c26081d3830fabf33cf58bed826c53aff04..076a5fe8df8722852630d4a07a51206a52366e55 100755 (executable)
@@ -6,6 +6,5 @@ then
        then
                /bin/systemctl stop storage-gadget-init.service
                /bin/systemctl start network-gadget-init.service
-               /bin/systemctl start udhcpd.service
        fi
 fi
index 1e226272efa64cfb1728eaeac267107312db7ab5..0ee291472c5c50e62653a7711cb261b3959a0dbd 100644 (file)
@@ -4,8 +4,7 @@ Conflicts=storage-gadget-init.service
 
 [Service]
 RemainAfterExit=yes
-ExecStartPre=/usr/bin/g-ether-load.sh
-ExecStart=/sbin/ifconfig usb0 192.168.7.2 netmask 255.255.255.252
+ExecStart=/usr/bin/g-ether-load.sh
 ExecStop=/sbin/rmmod g_ether
 
 [Install]
diff --git a/recipes-ti/beagleboard/gadget-init/udhcpd.rules b/recipes-ti/beagleboard/gadget-init/udhcpd.rules
new file mode 100644 (file)
index 0000000..db65f9a
--- /dev/null
@@ -0,0 +1,2 @@
+SUBSYSTEM=="net",ACTION=="add",KERNEL=="usb0",RUN+="/sbin/ifconfig usb0 192.168.7.2 netmask 255.255.255.252",RUN+="/bin/systemctl start udhcpd.service"
+SUBSYSTEM=="net",ACTION=="remove",KERNEL=="usb0",RUN+="/bin/systemctl stop udhcpd.service"