Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


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