Magellan Linux

Annotation of /mcore-src/trunk/mcore-tools/dracut/module-setup.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2042 - (hide annotations) (download) (as text)
Wed Apr 17 14:20:02 2013 UTC (11 years ago) by niro
File MIME type: application/x-sh
File size: 2744 byte(s)
-added dracut module
1 niro 2042 #!/bin/sh
2    
3     check() {
4     local _program
5     . $dracutfunctions
6    
7     for _program in ifconfig ip mysql route udhcpc xml; do
8     if ! type -P $_program >/dev/null; then
9     derror "Could not find program \"$_program\" required by alx."
10     return 1
11     fi
12     done
13    
14     return 255
15     }
16    
17     depends() {
18     return 0
19     }
20    
21     installkernel() {
22     net_module_filter() {
23     local _net_drivers='eth_type_trans|register_virtio_device'
24     local _unwanted_drivers='/(isdn|uwb)/'
25     local _ret
26     # subfunctions inherit following FDs
27     local _merge=8 _side2=9
28     function nmf1() {
29     local _fname _fcont
30     while read _fname; do
31     [[ $_fname =~ $_unwanted_drivers ]] && continue
32     case "$_fname" in
33     *.ko) _fcont="$(< $_fname)" ;;
34     *.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
35     *.ko.xz) _fcont="$(xz -dc $_fname)" ;;
36     esac
37     [[ $_fcont =~ $_net_drivers
38     && ! $_fcont =~ iw_handler_get_spy ]] \
39     && echo "$_fname"
40     done
41     }
42     function rotor() {
43     local _f1 _f2
44     while read _f1; do
45     echo "$_f1"
46     if read _f2; then
47     echo "$_f2" 1>&${_side2}
48     fi
49     done | nmf1 1>&${_merge}
50     }
51     # Use two parallel streams to filter alternating modules.
52     set +x
53     eval "( ( rotor ) ${_side2}>&1 | nmf1 ) ${_merge}>&1"
54     _ret=$?
55     [[ $debug ]] && set -x
56     return $_ret
57     }
58    
59     { find_kernel_modules_by_path drivers/net; find_kernel_modules_by_path drivers/s390/net; } \
60     | net_module_filter | instmods
61    
62     instmods =drivers/net/phy
63     instmods ecb arc4
64     # bridge modules
65     instmods bridge stp llc
66     instmods ipv6
67     # bonding
68     instmods bonding
69     # vlan
70     instmods 8021q
71     }
72    
73     install() {
74     local __file
75    
76     # add lp usr/group
77     egrep '^lp:' /etc/passwd >> "$initdir/etc/passwd"
78     # group file is fully included atm
79     #egrep '^lp:' /etc/group >> "$initdir/etc/group"
80    
81     # networking stuff
82     dracut_install ifconfig ip route udhcpc iwconfig wpa_supplicant
83     inst /usr/share/udhcpc/default.script
84    
85     # alxconfig stuff
86     dracut_install hwinfo mysql vncpasswd xml
87    
88     # mcored
89     # install all busybox modules
90     dracut_install busybox
91     for __file in $(cat /usr/share/busybox/busybox.links)
92     do
93     inst_symlink ${__file}
94     done
95     # install things which are needed but not provided by our busybox
96     dracut_install find install sslsvd touch
97     inst /etc/mageversion
98     inst /etc/conf.d/network
99     inst /etc/ssl/certs/mcored.pem
100     inst /etc/ssl/private/mcored.key
101     inst_dir /var/lib/mcored
102     inst /etc/conf.d/mcored
103     inst /etc/mcore/config.rc
104     inst /etc/mcoredpasswd
105     for __file in $(find /usr/lib/mcored/include -type f)
106     do
107     inst ${__file}
108     done
109     inst /usr/lib/mcored/mcored
110     inst /usr/lib/mcored/mcore-generate-certificate
111     inst /usr/lib/mcored/mcorepasswd
112     inst /usr/lib/mcored/start-daemon.sh
113     inst_symlink /usr/sbin/mcored
114     inst_symlink /usr/bin/mcorepasswd
115    
116     inst_hook pre-pivot 90 "$moddir"/run-mcored.sh
117     }