# $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" } 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 } 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." } 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 }