Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/modules/grub2/boot.client.class.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

mcore-src/trunk/mcore-tools/daemon/client/include/boot.client.class revision 1918 by niro, Wed Nov 9 13:32:46 2011 UTC mcore-src/trunk/mcore-tools/src/modules/grub2/boot.client.class.in revision 2181 by niro, Fri Jan 10 14:21:50 2014 UTC
# Line 1  Line 1 
1  # $Id$  # $Id$
2    
3  provide basic-boot  provide basic-boot
4    require basic-splash
5    
6  helper_boot_rebuild_bootconfig()  helper_boot_rebuild_bootconfig()
7  {  {
8   local grubconf="/boot/grub/grub.cfg"   local grubconf="/boot/grub/grub.cfg"
9     local chrooted
10    
11     if [[ -n ${MROOT} ]] && [[ ${MROOT} != / ]]
12     then
13     chrooted="system_chroot"
14     fi
15    
16   mount /boot &> /dev/null   mount /boot &> /dev/null
17   grub-mkconfig -o ${grubconf}   ${chrooted} grub-mkconfig -o ${grubconf}
18   umount /boot &> /dev/null   umount /boot &> /dev/null
19  }  }
20    
# Line 23  help_boot_splash() Line 30  help_boot_splash()
30   mecho "      disable - disables bootsplash"   mecho "      disable - disables bootsplash"
31  }  }
32    
 get_boot_splash()  
 {  
  local var  
  var=$(grep "^export GRUB_CMDLINE_BOOTSPLASH=" /etc/conf.d/grub | sed "s:.*splash=\(.*\),.*:\1:")  
   
  case "${var}" in  
  silent|"") mecho "bootsplash currently enabled"; rvecho "1" ;;  
  verbose) mecho "bootsplash currently disabled"; rvecho "0" ;;  
  *) eecho "unkown state" ;;  
  esac  
 }  
   
 set_boot_splash()  
 {  
  local action="$1"  
  [[ -z ${action} ]] && help_boot_splash && return 1  
   
  case "${action}" in  
  enable)  
  sed -i "s:^\(export GRUB_CMDLINE_BOOTSPLASH=\).*:\1\"splash=silent,theme=default\"" /etc/conf.d/grub.conf  
  helper_boot_rebuild_bootconfig  
  mecho "bootsplash enabled"  
  ;;  
  disable)  
  sed -i "s:^\(export GRUB_CMDLINE_BOOTSPLASH=\).*:\1\"splash=verbose,theme=default\"" /etc/conf.d/grub.conf  
  helper_boot_rebuild_bootconfig  
  mecho "bootsplash disabled"  
  ;;  
  *) help_system_autologon && return 1 ;;  
  esac  
 }  
   
33  help_boot_theme()  help_boot_theme()
34  {  {
35   mecho "get boot.theme [action]"   mecho "get boot.theme [action]"
# Line 67  help_boot_theme() Line 42  help_boot_theme()
42   mecho " Selects the theme which will be used on system startup by bootsplash."   mecho " Selects the theme which will be used on system startup by bootsplash."
43  }  }
44    
 get_boot_theme()  
 {  
  local action="$1"  
  local themedir="/etc/splash/themes"  
  local theme  
  local i  
   
  case "${action}" in  
  current)  
  if [[ -L ${themedir}/default ]]  
  then  
  theme=$(readlink ${themedir}/default)  
  rvecho "${theme}"  
  else  
  rvecho "none"  
  fi  
  ;;  
  system)  
  for i in $(find /etc/splash/themes -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | sort)  
  do  
  theme="${theme}"  
  done  
  rvecho "${theme}"  
  ;;  
  *)  
  help_boot_theme  
  return 1  
  ;;  
  esac  
 }  
   
 set_boot_theme()  
 {  
  local theme="$1"  
  local themedir="/etc/splash/themes"  
  [[ -z ${theme} ]] && help_boot_theme && return 1  
   
  if [[ -d ${themedir}/${theme} ]]  
  then  
  ln -snf ${theme} ${themedir}/default  
  mecho "Selected theme '${theme}'."  
  else  
  eecho "Theme '${theme}' not available on this system. Aborted!"  
  fi  
 }  

Legend:
Removed from v.1918  
changed lines
  Added in v.2181