Magellan Linux

Contents of /mcore-src/trunk/mcore-tools/dracut/mcored/module-setup.sh.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2239 - (show annotations) (download)
Sat Jan 11 00:33:19 2014 UTC (10 years, 4 months ago) by niro
Original Path: mcore-src/trunk/mcore-tools/dracut/module-setup.sh.in
File size: 2965 byte(s)
-use variable pathes
1 #!/bin/sh
2
3 check() {
4 local _program
5 . $dracutfunctions
6
7 for _program in ifconfig ip route udhcpc iwconfig wpa_supplicant \
8 chroot systemd-nspawn vncpasswd hostname mcored; do
9 if ! type -P $_program >/dev/null; then
10 derror "Could not find program \"$_program\" required by mcored."
11 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:' @@SYSCONFDIR@@/passwd >> "$initdir@@SYSCONFDIR@@/passwd"
79 # group file is fully included atm
80 #egrep '^lp:' @@SYSCONFDIR@@/group >> "$initdir@@SYSCONFDIR@@/group"
81
82 # networking stuff
83 dracut_install ifconfig ip route udhcpc iwconfig wpa_supplicant chroot systemd-nspawn
84 inst @@DATADIR@@/udhcpc/default.script
85 inst_simple "$moddir/net-lib.sh" /lib/net-lib.sh
86
87 # mcored config stuff
88 dracut_install hwinfo vncpasswd
89
90 # mcored
91 # install all busybox modules
92 dracut_install busybox
93 for __file in $(cat @@DATADIR@@/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 @@SYSCONFDIR@@/mageversion
100 inst @@CONFDDIR@@/network
101 inst @@SSLDIR@@/certs/mcored.pem
102 inst @@SSLDIR@@/private/mcored.key
103 inst_dir @@MCORE_CHROOTDIR@@
104 inst @@CONFDDIR@@/mcored
105 inst @@SYSCONFDIR@@/mcore/mcore.conf
106 inst @@SYSCONFDIR@@/mcoredpasswd
107 for __file in $(find @@MCORE_LIBDIR@@/include -type f)
108 do
109 inst ${__file}
110 done
111 inst @@MCORE_LIBDIR@@/mcored
112 inst @@MCORE_LIBDIR@@/mcore-generate-certificate
113 inst @@MCORE_LIBDIR@@/mcorepasswd
114 inst @@MCORE_LIBDIR@@/VERSION
115 inst_symlink @@SBINDIR@@/mcored
116 inst_symlink @@SBINDIR@@/mcorepasswd
117
118 inst_hook pre-pivot 90 "$moddir"/run-mcored.sh
119 }