Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2111 - (show annotations) (download) (as text)
Thu Jan 2 16:25:48 2014 UTC (10 years, 3 months ago) by niro
File MIME type: application/x-sh
File size: 2813 byte(s)
-do not install non-existing start-daemon.sh
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 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:' /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 dracut_install ifconfig ip route udhcpc iwconfig wpa_supplicant chroot systemd-nspawn
84 inst /usr/share/udhcpc/default.script
85
86 # mcored config stuff
87 dracut_install hwinfo vncpasswd
88
89 # mcored
90 # install all busybox modules
91 dracut_install busybox
92 for __file in $(cat /usr/share/busybox/busybox.links)
93 do
94 inst_symlink ${__file}
95 done
96 # install things which are needed but not provided by our busybox
97 dracut_install find install sslsvd touch
98 inst /etc/mageversion
99 inst /etc/conf.d/network
100 inst /etc/ssl/certs/mcored.pem
101 inst /etc/ssl/private/mcored.key
102 inst_dir /var/lib/mcored
103 inst /etc/conf.d/mcored
104 inst /etc/mcore/config.rc
105 inst /etc/mcoredpasswd
106 for __file in $(find /usr/lib/mcored/include -type f)
107 do
108 inst ${__file}
109 done
110 inst /usr/lib/mcored/mcored
111 inst /usr/lib/mcored/mcore-generate-certificate
112 inst /usr/lib/mcored/mcorepasswd
113 inst /usr/lib/mcored/VERSION
114 inst_symlink /usr/sbin/mcored
115 inst_symlink /usr/bin/mcorepasswd
116
117 inst_hook pre-pivot 90 "$moddir"/run-mcored.sh
118 }