mirror of
https://gitdl.cn/https://github.com/chakralinux/core.git
synced 2025-02-03 12:57:14 +08:00
100 lines
2.7 KiB
Plaintext
100 lines
2.7 KiB
Plaintext
run_hook ()
|
|
{
|
|
SPLASH_INIT_MESSAGE="Initializing the kernel"
|
|
SPLASH_MODE_REQ="off"
|
|
SPLASH_THEME="default"
|
|
SPLASH_TTY=16
|
|
SPLASH_TEXTBOX="no"
|
|
SPLASH_AUTOVERBOSE=0
|
|
|
|
. /etc/conf.d/splash
|
|
|
|
# Kernel parameters override config file
|
|
local ifs="$IFS"
|
|
IFS=','
|
|
set -- $splash
|
|
IFS="$ifs"
|
|
local arg effects
|
|
for arg in "$@"; do
|
|
case "$arg"
|
|
in off ) SPLASH_MODE_REQ="off"
|
|
;; silent ) SPLASH_MODE_REQ="silent"
|
|
;; verbose ) SPLASH_MODE_REQ="verbose"
|
|
;; theme:?* ) SPLASH_THEME="${arg#theme:}"
|
|
;; tty:?* ) SPLASH_TTY="${arg#tty:}"
|
|
;; insane ) SPLASH_SANITY="insane"
|
|
;; fadein | fadeout ) effects="$effects,$arg"
|
|
esac
|
|
done
|
|
if [ -n "$effects" ]; then
|
|
SPLASH_EFFECTS="${effects#,}"
|
|
fi
|
|
|
|
if [ "${SPLASH_MODE_REQ}" != "silent" ]; then
|
|
return
|
|
fi
|
|
|
|
if ! [ "$console" = tty1 -o "$SPLASH_SANITY" = insane ]; then
|
|
err "Fbsplash requires console=tty1 in kernel line!"
|
|
return 1
|
|
fi
|
|
|
|
# Start the daemon here if possible
|
|
# to show animations early and gain some bootup speed
|
|
if [ -x /sbin/fbsplashd.static ]; then
|
|
if [ -x /etc/splash/$SPLASH_THEME/scripts/rc_init-pre ]; then
|
|
err "Found /etc/splash/$SPLASH_THEME/scripts/rc_init-pre"
|
|
err "Not starting Fbsplash daemon - no theme hook support in initcpio."
|
|
else
|
|
local options=""
|
|
[ -n "$SPLASH_THEME" ] && options="$options --theme=$SPLASH_THEME"
|
|
[ -n "$SPLASH_EFFECTS" ] && options="$options --effects=$SPLASH_EFFECTS"
|
|
[ "$SPLASH_TEXTBOX" = yes ] && options="$options --textbox"
|
|
# Hold the cache and fifo within /dev
|
|
# so it will be moved to the new root
|
|
mkdir -p /lib/splash/cache &&
|
|
mv /lib/splash/cache /dev/.splash-cache &&
|
|
ln -s /dev/.splash-cache /lib/splash/cache &&
|
|
mkfifo /lib/splash/cache/.splash &&
|
|
# Wait for any fbcondecor fadein - may take very long on some broken systems
|
|
(
|
|
for i in $( seq 50 ); do
|
|
[ -z "$( pidof fbcondecor_helper )" ] && exit
|
|
sleep .1
|
|
done
|
|
err "timeout on waiting for fbcondecor_helper to die!"
|
|
exit 1
|
|
) &&
|
|
# Actually start the daemon
|
|
(
|
|
cd /dev/.splash-cache &&
|
|
BOOT_MSG="${SPLASH_INIT_MESSAGE}" \
|
|
/sbin/fbsplashd.static --type=bootup --pidfile=daemon.pid $options
|
|
)
|
|
if [ $? -eq 0 ]; then
|
|
(
|
|
echo set tty silent $SPLASH_TTY
|
|
echo set mode silent
|
|
echo repaint
|
|
echo set autoverbose $SPLASH_AUTOVERBOSE
|
|
) >/lib/splash/cache/.splash &
|
|
return
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
# Fallback to the fbcondecor helper
|
|
# if not already started by a fbcondecor kernel
|
|
(
|
|
# code copied from splash-functions.sh
|
|
fbcondecor_supported() {
|
|
[ -e /dev/fbsplash -o -e /dev/fbcondecor ]
|
|
}
|
|
|
|
if ! fbcondecor_supported; then
|
|
BOOT_MSG="${SPLASH_INIT_MESSAGE}" \
|
|
/sbin/fbcondecor_helper 2 init 0 0 $SPLASH_THEME
|
|
fi
|
|
)
|
|
}
|