Annotation of /mcore-src/trunk/mcore-tools/daemon/client/include/boot.client.class
Parent Directory | Revision Log
Revision 1918 -
(hide annotations)
(download)
Wed Nov 9 13:32:46 2011 UTC (12 years, 6 months ago) by niro
File size: 2580 byte(s)
Wed Nov 9 13:32:46 2011 UTC (12 years, 6 months ago) by niro
File size: 2580 byte(s)
-added boot and splash classes
1 | niro | 1918 | # $Id$ |
2 | |||
3 | provide basic-boot | ||
4 | |||
5 | helper_boot_rebuild_bootconfig() | ||
6 | { | ||
7 | local grubconf="/boot/grub/grub.cfg" | ||
8 | |||
9 | mount /boot &> /dev/null | ||
10 | grub-mkconfig -o ${grubconf} | ||
11 | umount /boot &> /dev/null | ||
12 | } | ||
13 | |||
14 | help_boot_splash() | ||
15 | { | ||
16 | mecho "get boot.splash" | ||
17 | mecho " Shows the state of bootsplash" | ||
18 | mecho | ||
19 | mecho "set boot.splash [action]" | ||
20 | mecho " Enables or disables a fancy splashscreen at boot time." | ||
21 | mecho " Available actions:" | ||
22 | mecho " enable - enables bootsplash" | ||
23 | mecho " disable - disables bootsplash" | ||
24 | } | ||
25 | |||
26 | get_boot_splash() | ||
27 | { | ||
28 | local var | ||
29 | var=$(grep "^export GRUB_CMDLINE_BOOTSPLASH=" /etc/conf.d/grub | sed "s:.*splash=\(.*\),.*:\1:") | ||
30 | |||
31 | case "${var}" in | ||
32 | silent|"") mecho "bootsplash currently enabled"; rvecho "1" ;; | ||
33 | verbose) mecho "bootsplash currently disabled"; rvecho "0" ;; | ||
34 | *) eecho "unkown state" ;; | ||
35 | esac | ||
36 | } | ||
37 | |||
38 | set_boot_splash() | ||
39 | { | ||
40 | local action="$1" | ||
41 | [[ -z ${action} ]] && help_boot_splash && return 1 | ||
42 | |||
43 | case "${action}" in | ||
44 | enable) | ||
45 | sed -i "s:^\(export GRUB_CMDLINE_BOOTSPLASH=\).*:\1\"splash=silent,theme=default\"" /etc/conf.d/grub.conf | ||
46 | helper_boot_rebuild_bootconfig | ||
47 | mecho "bootsplash enabled" | ||
48 | ;; | ||
49 | disable) | ||
50 | sed -i "s:^\(export GRUB_CMDLINE_BOOTSPLASH=\).*:\1\"splash=verbose,theme=default\"" /etc/conf.d/grub.conf | ||
51 | helper_boot_rebuild_bootconfig | ||
52 | mecho "bootsplash disabled" | ||
53 | ;; | ||
54 | *) help_system_autologon && return 1 ;; | ||
55 | esac | ||
56 | } | ||
57 | |||
58 | help_boot_theme() | ||
59 | { | ||
60 | mecho "get boot.theme [action]" | ||
61 | mecho " Shows current selected or system-wide available bootsplash themes." | ||
62 | mecho " Available actions:" | ||
63 | mecho " system - shows available themes on the system" | ||
64 | mecho " current - shows the currently used theme of bootsplash" | ||
65 | mecho | ||
66 | mecho "set boot.theme [theme]" | ||
67 | mecho " Selects the theme which will be used on system startup by bootsplash." | ||
68 | } | ||
69 | |||
70 | get_boot_theme() | ||
71 | { | ||
72 | local action="$1" | ||
73 | local themedir="/etc/splash/themes" | ||
74 | local theme | ||
75 | local i | ||
76 | |||
77 | case "${action}" in | ||
78 | current) | ||
79 | if [[ -L ${themedir}/default ]] | ||
80 | then | ||
81 | theme=$(readlink ${themedir}/default) | ||
82 | rvecho "${theme}" | ||
83 | else | ||
84 | rvecho "none" | ||
85 | fi | ||
86 | ;; | ||
87 | system) | ||
88 | for i in $(find /etc/splash/themes -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | sort) | ||
89 | do | ||
90 | theme="${theme}" | ||
91 | done | ||
92 | rvecho "${theme}" | ||
93 | ;; | ||
94 | *) | ||
95 | help_boot_theme | ||
96 | return 1 | ||
97 | ;; | ||
98 | esac | ||
99 | } | ||
100 | |||
101 | set_boot_theme() | ||
102 | { | ||
103 | local theme="$1" | ||
104 | local themedir="/etc/splash/themes" | ||
105 | [[ -z ${theme} ]] && help_boot_theme && return 1 | ||
106 | |||
107 | if [[ -d ${themedir}/${theme} ]] | ||
108 | then | ||
109 | ln -snf ${theme} ${themedir}/default | ||
110 | mecho "Selected theme '${theme}'." | ||
111 | else | ||
112 | eecho "Theme '${theme}' not available on this system. Aborted!" | ||
113 | fi | ||
114 | } |