Implement -D option to set configuration directory; fai.conf: don't set variables...
[grml-live.git] / etc / grml / fai / config / scripts / GRMLBASE / 38-udev
1 #!/bin/bash
2 # Filename:      ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/38-udev
3 # Purpose:       configure udev of live-system
4 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2 or any later version.
7 ################################################################################
8
9 set -u
10 set -e
11
12 [ -r /etc/grml/grml-live.conf ]  && . /etc/grml/grml-live.conf
13 [ -r /etc/grml/grml-live.local ] && . /etc/grml/grml-live.local
14
15 CONFFILE="$target/etc/udev/rules.d/70-persistent-net.rules"
16 STRING='This file was automatically generated by the /lib/udev/write_net_rules'
17
18 # We do not want to get a predefined entry for eth0 of the *build* system, like:
19 #   Unknown net device (/devices/virtio-pci/virtio0/net/eth0) (virtio_net)
20 #   SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="XX:XX:XX:XX:XX:XX", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"
21 # so therefore remove such an automatically generated file instead.
22 if ! [ -r "$CONFFILE" ] ; then
23    echo "$CONFFILE does not exist, nothing to do."
24 else
25    if grep -q "$STRING" "$CONFFILE" ; then
26       echo "Automatically generated /etc/udev/rules.d/70-persistent-net.rules found, removing it."
27       rm -f "$CONFFILE"
28    fi
29 fi
30
31 ## END OF FILE #################################################################
32 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2