Commit c65d07bf authored by Lukas's avatar Lukas

Remove all fbsplash stuff

parent 08dfaa57
fbsplash-scripts
for Chakra GNU/Linux mkinitcpio and initscripts
Changelog
1.0 First version
1.1 Allow initcpio-only mode without daemon for maximum boot speed
1.2 Make the no-daemon mode a bit more smart and nice
2.0 Rewritten from scratch to ease maintenance
Replaced no-daemon mode by stat_busy message pushing option
Switch to verbose console on fsck errors
Avoid message pushing from background
Stop using the splash wrapper function from upstream
Feature List
* Initcpio hook for early splash screen
* Supports early daemon start in initcpio (themes w/o pre-init script)
* Supports splash stop/fadeout before X started from DAEMONS array
* Can push initscripts [BUSY] messages to the splash status line
* Generic initscripts [FAIL] service event 'fbsplash-dummy'
* Writes initscripts [FAIL] messages into the splash textbox
* Can switch to console on any [FAIL] message
# EOF #
#
# Chakra Packages for Chakra, part of chakra-project.org
#
# maintainer (i686): Phil Miller <philm[at]chakra-project[dog]org>
# maintainer (x86_64): Manuel Tortosa <manutortosa[at]chakra-project[dot]org>
# Maintainer: Kurt J. Bosch <kjb-temp-2009 at alpenjodel.de>
# include global config
source ../_buildscripts/${current_repo}-${_arch}-cfg.conf
pkgname=fbsplash-scripts-testing
pkgver=2.0
pkgrel=1
pkgdesc="Basic Fbsplash scripts for Chakra GNU/Linux"
arch=('any')
url="http://aur.archlinux.org/packages.php?ID=35428"
license=( 'GPL' )
depends=( 'bash>=4' 'fbsplash>=1.5.4.3-1' 'initscripts>=2010.06' 'mkinitcpio>=0.6.6' )
conflicts=( 'initscripts-extras-fbsplash' 'initscripts-splashy' 'fbsplash-scripts' 'initscripts-extras-fbsplash-testing')
backup=('etc/conf.d/splash')
install=fbsplash-scripts.install
source=(
Changelog
splash.conf
fbsplash-basic.sh
fbsplash.initcpio_install
fbsplash.initcpio_hook
fbcondecor.daemon
fbcondecor.conf
)
build() {
cd ${pkgdir}
# Install Changelog
install -D -m644 ${srcdir}/Changelog usr/share/doc/${pkgname}/Changelog
# Install fbsplash scripts and config file
install -D -m644 ${srcdir}/splash.conf etc/conf.d/splash &&
install -D -m644 ${srcdir}/fbsplash-basic.sh etc/rc.d/functions.d/fbsplash-basic.sh &&
install -D -m644 ${srcdir}/fbsplash.initcpio_install lib/initcpio/install/fbsplash &&
install -D -m644 ${srcdir}/fbsplash.initcpio_hook lib/initcpio/hooks/fbsplash || return 1
# Install fbcodecor script and config file
install -D -m644 ${srcdir}/fbcondecor.conf etc/conf.d/fbcondecor &&
install -D -m755 ${srcdir}/fbcondecor.daemon etc/rc.d/fbcondecor || return 1
}
md5sums=('f468fb85f337b179bf0aac63ddc5f56e'
'87256fc4c2441a30f544ad5eaf411691'
'e9f66236ac4c13e54f8d42dd994eaefc'
'b34b1a8d85f52bae2e36c046e23a9fb3'
'390dacdfb3be761728ff2a1cdafd178b'
'715926469d05eecd345c052e6248ca32'
'b3db9d4fd902b62ac9e38589677e2d16')
# /etc/conf.d/fbcondecor
#
## Virtual terminals to load with fbcondecor backgrounds
SPLASH_TTYS="1 2 3 4 5 6"
#!/bin/bash
# /etc/rc.d/fbcondecor
# Set FbConDecor backgrounds
#
. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/fbcondecor
. /sbin/splash-functions.sh
splash_setup force
retval=0
[ -z "${SPLASH_TTYS%% }" ] && retval=1
case "$1"
in start )
if [ "${SPLASH_MODE_REQ}" != "off" ]; then
stat_busy "Setting FBconDecor console images"
for tty in ${SPLASH_TTYS}; do
# avoid blinking on boot
[[ "$( fbcondecor_ctl --tty=${tty} -c getstate )" == *\ on ]] && continue
fbcondecor_set_theme ${SPLASH_THEME} ${tty} || retval=1
done
if [ $retval = 0 ]; then
stat_done
else
stat_fail
fi
fi
;; stop )
stat_busy "Disabling FBconDecor console images"
for tty in ${SPLASH_TTYS}; do
# avoid errors on restart
[[ "$( fbcondecor_ctl --tty=${tty} -c getstate )" == *\ off ]] && continue
fbcondecor_ctl --tty=${tty} -c off || retval=1
done
if [ $retval = 0 ]; then
stat_done
else
stat_fail
fi
;; restart )
$0 stop
sleep .1
echo # don't swallow our status line
$0 start
;; * )
echo "usage: $0 {start|stop|restart}"
esac
exit 0
# EOF #
# /etc/rc.d/functions.d/fbsplash-basic.sh #
# Basic Fbsplash script for Chakra GNU/Linux initscripts #
# #
# Author: Kurt J. Bosch <kjb-temp-2009 at alpenjodel.de> #
# Based on the work of Greg Helton <gt at fallendusk.org> #
# Thomas Baechler <thomas at archlinux.org> #
# and others #
# #
# Distributed under the terms of the GNU General Public License (GPL) #
[[ $PREVLEVEL && $RUNLEVEL ]] || return 0
# Do nothing if improved scripts are installed
[ -r /etc/rc.d/functions.d/fbsplash-extras.sh ] && return
# Only do this where needed
# Since we use BASH, all important functions and variables are exported
case ${0#/etc/rc.} in sysinit | multi | shutdown )
export SPLASH_PUSH_MESSAGES="no"
export SPLASH_VERBOSE_ON_ERRORS="no"
. /sbin/splash-functions.sh # /etc/conf.d/splash is also sourced by this
unset options opt i # eliminate splash_setup non local vars ## FIX ME ##
declare -ix SPLASH_STEPS=4 # sysinit steps
declare -ix SPLASH_STEPS_DONE=0
esac
# Verbose mode is handled by fbcondecor kernel patch and daemon script
[[ $SPLASH_MODE_REQ = silent ]] || return 0
# Override - Don't try to use /usr/bin/basename
splash_comm_send() {
[[ $( /bin/pidof -o %PPID $spl_daemon ) ]] && echo "$@" >$spl_fifo &
}
case $0 in /etc/rc.sysinit )
# Prevent splash destruction
CONSOLEFONT=""
# Take over the cache and fifo from initcpio
if [[ -p /dev/.splash-cache/${spl_fifo##*/} ]]; then
/bin/mount --bind /dev/.splash-cache $spl_cachedir || return
splash_comm_send set message "$SPLASH_BOOT_MESSAGE"
# Mount a tmpfs
else
( splash_cache_prep ) || return
fi
add_hook sysinit_udevsettled splash_sysinit_udevsettled
add_hook sysinit_postfsck splash_sysinit_postfsck
add_hook sysinit_postfsckloop splash_sysinit_postfsck
add_hook sysinit_premount splash_sysinit_premount
add_hook sysinit_end splash_sysinit_end
splash_sysinit_udevsettled() {
splash_begin
splash_progress_init
splash_progress
}
splash_sysinit_premount() {
splash_progress
}
splash_sysinit_postfsck() { # fsck failure emergency exit
[ ${fsckret} -gt 1 -a ${fsckret} -ne 32 ] && chvt 1
}
splash_sysinit_end() {
splash_progress
}
;; /etc/rc.multi )
add_hook multi_start splash_multi_start
add_hook multi_end splash_multi_end
splash_multi_start() {
SPLASH_STEPS_DONE=$SPLASH_STEPS
splash_progress_init
}
start_daemon() {
[[ $1 = $SPLASH_XSERVICE ]] && SPLASH_EXIT_TYPE=staysilent splash_stop
/etc/rc.d/$1 start
splash_progress
}
start_daemon_bkgd() {
[[ $1 = $SPLASH_XSERVICE ]] && SPLASH_EXIT_TYPE=staysilent splash_stop
stat_bkgd "Starting $1"
(SPLASH_PUSH_MESSAGES="no" /etc/rc.d/$1 start) &>/dev/null &
}
splash_multi_end() {
if [[ $PREVLEVEL = N ]]; then
if ! in_array "$SPLASH_XSERVICE" "${DAEMONS[@]}"; then
if [[ $RUNLEVEL = 5 ]]; then
SPLASH_EXIT_TYPE=staysilent splash_stop
else
splash_stop
[[ $( $spl_bindir/fgconsole ) = $SPLASH_TTY ]] && chvt 1
fi
fi
# Now do setfont
set_consolefont
# Umount the tmpfs
splash_cache_cleanup
fi
}
;; /etc/rc.shutdown )
( splash_cache_prep ) || return
# Not using XSERVICE here to avoid missing errors - X should chvt back to SPLASH_TTY
add_hook shutdown_start splash_shutdown_start
add_hook shutdown_prekillall splash_shutdown_prekillall
add_hook shutdown_postkillall splash_shutdown_postkillall
add_hook shutdown_poweroff splash_shutdown_poweroff
splash_shutdown_start() {
splash_begin
}
## http://bugs.archlinux.org/task/10536 ## FIX ME ##
splash_shutdown_prekillall() { /bin/sleep .1; }
splash_shutdown_postkillall() {
if [[ $( $spl_bindir/fgconsole ) = $SPLASH_TTY ]]; then
stat_busy "Restarting Fbsplash daemon"
PROGRESS=$(( 65535*2/3 )) splash_start
if [[ -e $spl_cachedir/stop_failed-fbsplash-dummy ]]; then
splash_comm_send update_svc fbsplash-dummy svc_stop_failed
fi
stat_done
fi
}
##
splash_shutdown_poweroff() {
SPLASH_EXIT_TYPE=staysilent splash_stop
}
esac
splash_progress_init() {
for daemon in "${DAEMONS[@]}"; do
case $daemon in $SPLASH_XSERVICE | @$SPLASH_XSERVICE ) break
;; \!* |@* ) continue
esac
SPLASH_STEPS+=1
done
}
splash_progress() {
splash_comm_send progress $(( 65535*++SPLASH_STEPS_DONE/SPLASH_STEPS ))
splash_comm_send paint
}
# Start the splash daemon - using upstream function
splash_set_event_dev() { :; } # override - Never grab the keyboard
splash_begin() {
if ! [[ $( /bin/pidof -o %PPID $spl_daemon ) ]]; then
stat_busy "Starting Fbsplash daemon"
if [ -x /etc/splash/$SPLASH_THEME/scripts/rc_init-pre ]; then
/etc/splash/$SPLASH_THEME/scripts/rc_init-pre ${0#/etc/rc.d} $RUNLEVEL
fi &&
splash_start &&
stat_done || stat_fail
fi
}
# Stop the splash daemon - if any
splash_stop() {
if [[ $( /bin/pidof -o %PPID $spl_daemon ) ]]; then
SPLASH_PUSH_MESSAGES="no" stat_busy "Stopping Fbsplash daemon"
splash_comm_send progress 65535; splash_comm_send paint; /bin/sleep .1
splash_comm_send exit $SPLASH_EXIT_TYPE
# Wait for painting/fadeout
local -i i=0
while [[ i++ -lt 100 && $( /bin/pidof -o %PPID $spl_daemon ) ]]; do
/bin/sleep .1
done
stat_done
fi
}
stat_busy() {
printf "${C_OTHER}${PREFIX_REG} ${C_MAIN}${1}${C_CLEAR} "
printf "${SAVE_POSITION}"
deltext
printf " ${C_OTHER}[${C_BUSY}BUSY${C_OTHER}]${C_CLEAR} "
SPLASH_BUSY_MSG=$1
if [[ $SPLASH_PUSH_MESSAGES = yes ]]; then
splash_comm_send set message "${1}"
splash_comm_send paint
fi
}
stat_fail() {
deltext
printf " ${C_OTHER}[${C_FAIL}FAIL${C_OTHER}]${C_CLEAR} \n"
local event=stop_failed; [[ $PREVLEVEL = N ]] && event=start_failed
# Provide a general failure status event and write to msglog textbox
splash_comm_send update_svc fbsplash-dummy svc_${event}
splash_comm_send log "Error $SPLASH_BUSY_MSG"
splash_comm_send paint
# Save for daemon restart ## FIX ME ##
if /bin/mountpoint -q $spl_cachedir; then
: >|$spl_cachedir/${event}-fbsplash-dummy
fi
# Upstream way of error handling
if [[ $SPLASH_VERBOSE_ON_ERRORS = yes ]]; then
chvt 1
fi
}
# EOF #
post_install() {
cat <<EOT
----------------------------------------------------------------------------
> Configuration: /etc/conf.d/splash
> WIKI page: http://wiki.archlinux.org/index.php/Fbsplash
----------------------------------------------------------------------------
EOT
}
# EOF
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
)
}
install() {
(
. /etc/conf.d/splash
/bin/umount -l /lib/splash/cache 2>/dev/null
add_binary /sbin/fbcondecor_helper
# Add some stuff maybe required by the helper
for dir in /lib/splash/proc /lib/splash/sys
do
add_dir $dir
done
# Add the daemon for early start
if [[ $SPLASH_DAEMON = early ]]; then
add_binary /sbin/fbsplashd.static
fi
# Add a clean config file avoiding errors when running the hook
file=$( /usr/bin/mktemp )
for var in SPLASH_INIT_MESSAGE SPLASH_MODE_REQ SPLASH_THEME SPLASH_TTY \
SPLASH_AUTOVERBOSE SPLASH_EFFECTS SPLASH_TEXTBOX
do
eval value=\"\$$var\"
[ -n "$value" ] && echo $var="'$value'"
done >|$file
add_file $file /etc/conf.d/splash
# List file paths contained in given Fbsplash theme cfg file
_get_cfg_files() {
< "$1" /bin/sed -re '
# convert all whitespace into single blanks
s,[[:space:]]+, ,g ; t L1
:L1
# drop comments, grouping directives and blank lines
/^ *([#<]|$)/ d
# get a filepath or drop
s,.*[ =]([^ ]*/[^ ]+).*,\1, ; t ; d
' | /usr/bin/sort -u
}
# Check if cfg file name or path
_match_cfg() {
[[ "$1" =~ (^|/)[0-9]+x[0-9]+\.cfg$ ]]
}
# Add non-cfg files in given dir
_add_non_cfg_files() {
local file dir="$1"
for file in $( /bin/ls "$dir" ); do
if [ -f "$dir/$file" ]; then
_match_cfg "$file" || add_file "$dir/$file"
fi
done
}
# Add global non-cfg files
_add_non_cfg_files /etc/splash
# Add themes
dirs=""
for theme in ${SPLASH_THEMES[*]}; do # string list and array allowed
[ ${theme:0:1} = / ] || theme=/etc/splash/$theme
if [ -f $theme ]; then
if ! _match_cfg $theme; then
err "Not a valid theme cfg file name: $theme"
continue
fi
add_file $theme || continue
dir=$( dirname $theme )
# Add non-cfg files in theme dir
_add_non_cfg_files $dir
# Add files refered in cfg file by paths
for file in $( _get_cfg_files $theme ); do
if [ ${file:0:1} = / ]; then
add_file $file
continue
fi
# Path may be relative to theme-dir or to /etc/splash
[ -e $dir/$file -o ! -f /etc/splash/$file ] && add_file $dir/$file
[ -e /etc/splash/$file -o ! -f $dir/$file ] && add_file /etc/splash/$file
done
elif [ -d $theme ]; then
dir=$theme
add_full_dir $dir
else
err "Theme not found: $theme"
continue
fi
if [[ " "$dirs" " != *" "$dir" "* ]]; then
dirs+=" "$dir
fi
done
for dir in $dirs; do
# Add the rc_init-pre script if we have one
# Currently this just prevents early daemon start for the theme
if [[ $SPLASH_DAEMON = early && -x $dir/scripts/rc_init-pre ]]; then
add_file $dir/scripts/rc_init-pre || continue
echo "WARNING: rc_init-pre script found - no early daemon with '${dir##*/}'!" >&2
fi
done
)
SCRIPT="fbsplash"
}
help() {
cat<<HELPEOF
This hook adds the FBconDecor helper and Fbsplash themes and maybe the
Fbsplash daemon as specified in /etc/conf.d/splash. Put it after udev
for early daemon start or when using a FBconDecor kernel.
HELPEOF
}
#EOF
# /etc/conf.d/splash
#
#### initcpio/daemon-initialization options ################################
## Themes to include into initcpio
## For a smaller initcpio you may try theme cfg files instead of directories.
SPLASH_THEMES=(
chakra-phoix
)
## Override the initial silent splash screen status message defaults
## The variable '$progress' can be used for boot/shutdown. Please use single
## ticks (') around these settings unless you know what you're doing!
## * initcpio - (no effect if fbcondecor kernel)
SPLASH_INIT_MESSAGE='Initializing the kernel'
## * bootup
SPLASH_BOOT_MESSAGE='Booting'
## * reboot
SPLASH_REBOOT_MESSAGE='Rebooting'
## * shutdown
SPLASH_SHUTDOWN_MESSAGE='Shutting down'
## Include the splash daemon in initcpio to show animations
## Themes with 'scripts/rc_init-pre' like 'arch-banner-icons' not supported.
SPLASH_DAEMON="early"
## Make the splash daemon use fade effects
## Note: The initcpio helper does only use the kernel parameter!
# SPLASH_EFFECTS="fadein,fadeout"
## Uggly hack to get that in from the kernel line :p
SPLASH_EFFECTS=$(e=();IFS=',';for w in $splash;do [[ $w == fade* ]]&&e+=($w);done;echo "${e[*]}")
## Enable the textbox when starting the daemon
## Useful if the theme provides a message log or other textbox.
## The scripts write any initscripts [FAIL] messages to the log.
## The textbox can be toggled by pressing F3-key.
SPLASH_TEXTBOX="yes"
## Splash daemon timeout (seconds)