# $Id$ provide basic-boot helper_boot_rebuild_bootconfig() { local grubconf="/boot/grub/grub.cfg" mount /boot &> /dev/null grub-mkconfig -o ${grubconf} umount /boot &> /dev/null } help_boot_splash() { mecho "get boot.splash" mecho " Shows the state of bootsplash" mecho mecho "set boot.splash [action]" mecho " Enables or disables a fancy splashscreen at boot time." mecho " Available actions:" mecho " enable - enables bootsplash" mecho " disable - disables bootsplash" } 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 } help_boot_theme() { mecho "get boot.theme [action]" mecho " Shows current selected or system-wide available bootsplash themes." mecho " Available actions:" mecho " system - shows available themes on the system" mecho " current - shows the currently used theme of bootsplash" mecho mecho "set boot.theme [theme]" mecho " Selects the theme which will be used on system startup by bootsplash." } 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 }