summaryrefslogtreecommitdiffstats
path: root/abs/core/fbsplash/fbsplash.initcpio_install
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/fbsplash/fbsplash.initcpio_install')
-rw-r--r--abs/core/fbsplash/fbsplash.initcpio_install176
1 files changed, 83 insertions, 93 deletions
diff --git a/abs/core/fbsplash/fbsplash.initcpio_install b/abs/core/fbsplash/fbsplash.initcpio_install
index 4485f91..841405b 100644
--- a/abs/core/fbsplash/fbsplash.initcpio_install
+++ b/abs/core/fbsplash/fbsplash.initcpio_install
@@ -1,104 +1,95 @@
-install() {
- (
- . /etc/conf.d/splash
+build() {
+ # Add config file, splash-functions and the helper
+ add_file /etc/conf.d/splash
+ add_file /sbin/splash-functions.sh
+ add_binary /sbin/fbcondecor_helper
- if /bin/mountpoint -q /lib/splash/cache; then
- /bin/umount /lib/splash/cache
- fi
-
- # Add the helper
- add_binary /sbin/fbcondecor_helper
-
- # Add the daemon for early start
- if [[ $SPLASH_DAEMON = early ]]; then
- add_binary /sbin/fbsplashd.static
- fi
+ # Get in configuration, parameters and functions
+ . /etc/conf.d/splash
+ . /sbin/splash-functions.sh
- # 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
+ # Unmount any stale cache tmpfs
+ splash_cache_cleanup
- # 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
- }
+ SPLASH_PROFILE=off
- # Check if cfg file name or path
- _match_cfg() {
- [[ "$1" =~ (^|/)[0-9]+x[0-9]+\.cfg$ ]]
- }
+ if [[ $SPLASH_DAEMON = early ]]; then
+ # Add stuff needed to run splash_start function (except optional evdev module)
+ add_dir $spl_tmpdir
+ add_binary $spl_daemon
+ if [[ -e /etc/rc.d/functions.d/fbsplash-extras.sh ]]; then
+ . /etc/rc.d/functions.d/fbsplash-extras.sh
+ # Add files from a prepared cache (faking sysinit)
+ splash_cache_prep_initcpio && add_full_dir $spl_cachedir
+ fi
+ fi
- # 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
- }
+ # List file paths contained in given Fbsplash theme cfg files
+ # (Only file paths containing at least one slash will be found by this.)
+ fbsplash_list_paths() {
+ (( $# )) || return 0
+ /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
+ }
- # Add global non-cfg files
- _add_non_cfg_files /etc/splash
+ # Check if arg is a theme cfg file path
+ fbsplash_is_cfg() {
+ [[ $1 =~ ^/etc/splash/[^/]+/[0-9]+x[0-9]+\.cfg$ ]]
+ }
- # 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
+ # Add all files referenced by path in given theme cfg files
+ # args: <theme-root-dir> <cfg-file>...
+ fbsplash_add_files_from_cfgs() {
+ local file theme_dir=$1; shift
+ while read file; do
+ if [[ $file == /* ]]; then
+ add_file $file
+ else # Path may be relative to /etc/splash or theme-dir
+ local found=0
+ for file in /etc/splash/$file "$theme_dir"/$file; do
+ [[ -f $file ]] && { add_file $file; found=1; }
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
+ (( found )) || error "Theme '${theme_dir##*/}': File not found: '$file'"
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
- )
+ done < <( fbsplash_list_paths "$@" )
+ }
+
+ # Add common files (may be referenced in cfg by plain file name)
+ local file
+ for file in /etc/splash/*; do
+ [[ -f $file ]] && add_file "$file"
+ done
+
+ # Add themes
+ local file theme
+ for theme in $SPLASH_THEMES; do
+ if [[ -d /etc/splash/$theme && $theme != */* ]]; then
+ add_full_dir /etc/splash/$theme
+ local files=()
+ for file in /etc/splash/$theme/*.cfg; do
+ [[ -f $file ]] && fbsplash_is_cfg "$file" && files+=( $file )
+ done
+ fbsplash_add_files_from_cfgs /etc/splash/$theme "${files[@]}"
+ elif [[ -f /etc/splash/$theme ]] && fbsplash_is_cfg /etc/splash/$theme; then
+ file=/etc/splash/$theme; theme=${theme%/*}
+ add_file $file
+ fbsplash_add_files_from_cfgs /etc/splash/$theme $file
+ # Add all non-cfg files from theme dir (may be referenced by plain file name)
+ for file in /etc/splash/$theme/*; do
+ [[ -f $file ]] && ! fbsplash_is_cfg "$file" && add_file "$file"
+ done
+ else
+ error "Theme invalid or not found: '$theme'"
+ fi
+ done
SCRIPT="fbsplash"
}
@@ -106,8 +97,7 @@ install() {
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.
+ Fbsplash daemon as specified in /etc/conf.d/splash.
HELPEOF
}