Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2338 - (show annotations) (download)
Mon Jul 14 08:56:31 2014 UTC (9 years, 9 months ago) by niro
File size: 1803 byte(s)
-install user/groups if they not exist
1 #!/bin/sh
2
3 check() {
4 local _program
5 . $dracutfunctions
6
7 for _program in iwconfig wpa_supplicant localectl \
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 echo busybox systemd network
20 }
21
22 install() {
23 local __file
24
25 # add missing users
26 if ! egrep '^lp:' "$initdir@@SYSCONFDIR@@/passwd" > /dev/null
27 then
28 egrep '^lp:' @@SYSCONFDIR@@/passwd >> "$initdir@@SYSCONFDIR@@/passwd"
29 fi
30 # add MCORE_UNPRIV_USER
31 if ! egrep '^@@MCORE_UNPRIV_USER@@:' "$initdir@@SYSCONFDIR@@/passwd" > /dev/null
32 then
33 egrep '^@@MCORE_UNPRIV_USER@@:' @@SYSCONFDIR@@/passwd >> "$initdir@@SYSCONFDIR@@/passwd"
34 fi
35
36 # add missing groups
37 if ! egrep '^lp:' "$initdir@@SYSCONFDIR@@/group" > /dev/null
38 then
39 egrep '^lp:' @@SYSCONFDIR@@/group >> "$initdir@@SYSCONFDIR@@/group"
40 fi
41 if ! egrep '^@@MCORE_UNPRIV_GROUP@@:' "$initdir@@SYSCONFDIR@@/group" > /dev/null
42 then
43 egrep '^@@MCORE_UNPRIV_GROUP@@:' @@SYSCONFDIR@@/group >> "$initdir@@SYSCONFDIR@@/group"
44 fi
45
46 # other stuff required by mcored
47 dracut_install iwconfig wpa_supplicant chroot systemd-nspawn
48
49 # mcored config stuff
50 dracut_install hwinfo vncpasswd localectl
51
52 # mcored
53 # install things which are needed but not provided by our busybox
54 dracut_install find install sslsvd touch
55 inst @@SYSCONFDIR@@/mageversion
56 inst @@SSLDIR@@/certs/mcored.pem
57 inst @@SSLDIR@@/private/mcored.key
58 inst_dir @@MCORE_CHROOTDIR@@
59 inst @@CONFDDIR@@/mcored
60 inst @@SYSCONFDIR@@/mcoredpasswd
61 for __file in $(find @@SYSCONFDIR@@/mcore @@MCORE_LIBDIR@@ -type f)
62 do
63 inst ${__file}
64 done
65 inst_symlink @@SBINDIR@@/mcored
66 inst_symlink @@SBINDIR@@/mcorepasswd
67
68 inst_hook pre-pivot 90 "$moddir"/run-mcored.sh
69 }