Magellan Linux

Contents of /mcore-src/trunk/mcore-tools/daemon/client/include/boot.client.class

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2020 - (show annotations) (download)
Mon Aug 13 11:15:18 2012 UTC (11 years, 8 months ago) by niro
File size: 2509 byte(s)
-make use of new list_files_in_directory() function
1 # $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
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
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 list_files_in_directory -type d -mindepth 1 -maxdepth 1 ${MROOT}/etc/splash/themes
89 ;;
90 *)
91 help_boot_theme
92 return 1
93 ;;
94 esac
95 }
96
97 set_boot_theme()
98 {
99 local theme="$1"
100 local themedir="/etc/splash/themes"
101 [[ -z ${theme} ]] && help_boot_theme && return 1
102
103 if [[ -d ${themedir}/${theme} ]]
104 then
105 ln -snf ${theme} ${themedir}/default
106 mecho "Selected theme '${theme}'."
107 else
108 eecho "Theme '${theme}' not available on this system. Aborted!"
109 fi
110 }