Magellan Linux

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

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

revision 2078 by niro, Fri May 10 11:02:36 2013 UTC revision 2079 by niro, Fri May 10 11:37:38 2013 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  {  {
# Line 23  help_boot_splash() Line 24  help_boot_splash()
24   mecho "      disable - disables bootsplash"   mecho "      disable - disables bootsplash"
25  }  }
26    
 helper_get_boot_splash_plymouth()  
 {  
  if grep "^export GRUB_CMDLINE_BOOTSPLASH=.*splash" ${MROOT}/etc/conf.d/grub  
  then  
  mecho "bootsplash currently enabled"  
  rvecho "1"  
  else  
  mecho "bootsplash currently disabled"  
  rvecho "0"  
  fi  
 }  
   
 helper_get_boot_splash_fbsplash()  
 {  
  local var  
  var=$(grep "^export GRUB_CMDLINE_BOOTSPLASH=" ${MROOT}/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  
 }  
   
 get_boot_splash()  
 {  
  if [ -x $(type -P plymouth-set-default-theme) ]  
  then  
  helper_get_boot_splash_plymouth $*  
  else  
  helper_get_boot_splash_fbsplash $*  
  fi  
 }  
   
 helper_set_boot_splash_plymouth()  
 {  
  local action="$1"  
  [[ -z ${action} ]] && help_boot_splash && return 1  
   
  case "${action}" in  
  enable)  
  sed -i "s:^\(export GRUB_CMDLINE_BOOTSPLASH=\).*:\1\"splash\":" ${MROOT}/etc/conf.d/grub  
  helper_boot_rebuild_bootconfig  
  mecho "bootsplash enabled"  
  ;;  
  disable)  
  sed -i "s:^\(export GRUB_CMDLINE_BOOTSPLASH=\).*:\1\"rd.plymouth=0\":" ${MROOT}/etc/conf.d/grub  
  helper_boot_rebuild_bootconfig  
  mecho "bootsplash disabled"  
  ;;  
  *) help_system_autologon && return 1 ;;  
  esac  
 }  
   
 helper_set_boot_splash_fbsplash()  
 {  
  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\":" ${MROOT}/etc/conf.d/grub  
  helper_boot_rebuild_bootconfig  
  mecho "bootsplash enabled"  
  ;;  
  disable)  
  sed -i "s:^\(export GRUB_CMDLINE_BOOTSPLASH=\).*:\1\"splash=verbose,theme=default\":" ${MROOT}/etc/conf.d/grub  
  helper_boot_rebuild_bootconfig  
  mecho "bootsplash disabled"  
  ;;  
  *) help_system_autologon && return 1 ;;  
  esac  
 }  
   
 set_boot_splash()  
 {  
  if [ -x $(type -P plymouthd) ]  
  then  
  helper_set_boot_splash_plymouth $*  
  else  
  helper_set_boot_splash_fbsplash $*  
  fi  
 }  
   
27  help_boot_theme()  help_boot_theme()
28  {  {
29   mecho "get boot.theme [action]"   mecho "get boot.theme [action]"
# Line 119  help_boot_theme() Line 36  help_boot_theme()
36   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."
37  }  }
38    
 helper_get_boot_theme_plymouth()  
 {  
  local action="$1"  
  local i  
   
  case "${action}" in  
  current) rvecho "$(plymouth-set-default-theme)" ;;  
  system)  
  for i in $(plymouth-set-default-theme --list)  
  do  
  rvecho "${i}"  
  done  
  ;;  
  *)  
  help_boot_theme  
  return 1  
  ;;  
  esac  
 }  
   
 helper_get_boot_theme_fbsplash()  
 {  
  local action="$1"  
  local themedir="${MROOT}/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)  
  list_files_in_directory -type d -mindepth 1 -maxdepth 1 ${themedir}  
  ;;  
  *)  
  help_boot_theme  
  return 1  
  ;;  
  esac  
 }  
   
 get_boot_theme()  
 {  
  if [ -x $(type -P plymouth-set-default-theme) ]  
  then  
  helper_get_boot_theme_plymouth $*  
  else  
  helper_get_boot_theme_fbsplash $*  
  fi  
 }  
   
 helper_set_boot_theme_plymouth()  
 {  
  local theme="$1"  
  local themedir="${MROOT}/usr/share/plymouth/themes"  
  [[ -z ${theme} ]] && help_boot_theme && return 1  
   
  if [[ -d ${themedir}/${theme} ]]  
  then  
  plymouth-set-default-theme ${theme}  
  mecho "Selected theme '${theme}'."  
  else  
  eecho "Theme '${theme}' not available on this system. Aborted!"  
  fi  
 }  
   
 helper_set_boot_theme_fbsplash()  
 {  
  local theme="$1"  
  local themedir="${MROOT}/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  
 }  
   
 set_boot_theme()  
 {  
  if [ -x $(plymouth-set-default-theme) ]  
  then  
  helper_set_boot_theme_plymouth $*  
  else  
  helper_set_boot_theme_fbsplash $*  
  fi  
 }  

Legend:
Removed from v.2078  
changed lines
  Added in v.2079