File: hotplug.postinst

package info (click to toggle)
hotplug 0.0.20040329-22
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 448 kB
  • ctags: 22
  • sloc: sh: 671; makefile: 183
file content (109 lines) | stat: -rw-r--r-- 3,546 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/sh -e

. /usr/share/debconf/confmodule

create_config_file() {
  test -f /etc/hotplug/usb.option && . /etc/hotplug/usb.option
  rm -f /etc/hotplug/usb.option /etc/hotplug/usb.option.dpkg-old
  test -f /etc/default/hotplug.usb && . /etc/default/hotplug.usb

  : > /etc/hotplug/.run/net.enable

  db_get hotplug/x11_usbmice_hack
  X11_USBMICE_HACK="$RET"
  db_get hotplug/static_module_list
  STATIC_MODULE_LIST=$(echo "$RET" | sed -e 's/, / /g' -e 's/,$//')
  db_get hotplug/net_agent_policy
  NET_AGENT_POLICY="$RET"
  db_get hotplug/ignore_pci_class_display
  IGNORE_PCI_CLASS_DISPLAY="$RET"

  # move /etc/hotplug/usb.usermap.local if it still exists
  test -f /etc/hotplug/usb.usermap.local && \
      mv /etc/hotplug/usb.usermap.local /etc/hotplug/usb/local.usermap

  # this file is not being used anymore
  test -f /etc/default/hotplug.usb && rm /etc/default/hotplug.usb

  if [ -f /etc/default/hotplug ]; then
    sed -e 's|^#.*/usr/share/doc/hotplug/README.*|# See also /usr/share/doc/hotplug/README.Debian|' \
	-e 's/^#.*END OF FILE.*//' \
          -e 's@^STATIC_MODULE_LIST=.*@STATIC_MODULE_LIST="'"$STATIC_MODULE_LIST"'"@' \
	  -e 's/^X11_USBMICE_HACK=.*/X11_USBMICE_HACK='"$X11_USBMICE_HACK"'/' \
	  -e '/^USE_NET_LIFACE=.*/d' \
	  -e 's/^NET_AGENT_POLICY=.*/NET_AGENT_POLICY='$NET_AGENT_POLICY'/' \
	  -e 's/^IGNORE_PCI_CLASS_DISPLAY=.*/IGNORE_PCI_CLASS_DISPLAY='$IGNORE_PCI_CLASS_DISPLAY'/' \
	  < /etc/default/hotplug > /etc/default/hotplug.dpkg-tmp
    if ! grep -q '^NET_AGENT_POLICY=' /etc/default/hotplug; then
	echo "NET_AGENT_POLICY=$NET_AGENT_POLICY" >> /etc/default/hotplug.dpkg-tmp
    fi
    if ! grep -q '^IGNORE_PCI_CLASS_DISPLAY=' /etc/default/hotplug; then
	echo "IGNORE_PCI_CLASS_DISPLAY=$IGNORE_PCI_CLASS_DISPLAY" >> /etc/default/hotplug.dpkg-tmp
    fi
    if ! grep -q -E '^([# ]+)?QUIET=' /etc/default/hotplug; then
	echo "#QUIET=yes" >> /etc/default/hotplug.dpkg-tmp
    fi
    if cmp -s /etc/default/hotplug.dpkg-tmp /etc/default/hotplug; then
	rm -f /etc/default/hotplug.dpkg-tmp
    else
	mv -f /etc/default/hotplug /etc/default/hotplug.dpkg-old
	mv -f /etc/default/hotplug.dpkg-tmp /etc/default/hotplug
    fi
  else
      cat <<USBOPTION > /etc/default/hotplug
# hotplug configuraton file
# See also /usr/share/doc/hotplug/README.Debian
# This file is automatically generated by hotplug package
#
# STATIC_MODULE_LIST="..."
#  - which modules are preloaded? 
# deprecated. if you need to load at start time, use /etc/modules instead
# it will be removed in future
STATIC_MODULE_LIST="$STATIC_MODULE_LIST"
#
# X11_USBMICE_HACK
#  - use USB mouse with X11?
# deprecated. if you need to load at start time, use /etc/modules instead
# it will be removed in future
X11_USBMICE_HACK=$X11_USBMICE_HACK
#
# NET_AGENT_POLICY
# - how to manage network interfaces with ifupdown? 'all', 'auto' or 'hotplug'
NET_AGENT_POLICY=$NET_AGENT_POLICY
#
# IGNORE_PCI_CLASS_DISPLAY
# - ignore PCI_CLASS_DISPLAY?
IGNORE_PCI_CLASS_DISPLAY=$IGNORE_PCI_CLASS_DISPLAY
#
# You can use HOTPLUG_RC_<subsystem>=no to disable hotplugging for it, e.g:
#HOTPLUG_RC_pci=no
#HOTPLUG_RC_net=no
#
# Set this variable to make the init script *very* quiet.
#QUIET=yes
USBOPTION
  fi
}

case "$1" in
    configure)
	create_config_file
        if [ ! -e /usr/local/lib/firmware/ ]; then
	  mkdir -p /usr/local/lib/firmware/ 2> /dev/null || true
	fi
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument '$1'" >&2
        exit 1
    ;;
esac

db_stop

#DEBHELPER#

exit 0