From 90c5ca2a1fd3c86d0abaf3558b22f4bf46b40bd3 Mon Sep 17 00:00:00 2001 From: shadzik Date: Fri, 5 May 2006 22:26:13 +0000 Subject: [PATCH] - readded for bootsplash-3.2 Changed files: bootsplash-bootanim.script -> 1.7 bootsplash.init -> 1.6 bootsplash.script -> 1.7 bootsplash.sysconfig -> 1.7 --- bootsplash-bootanim.script | 137 +++++++++++++++++++++++++++++++++++++ bootsplash.init | 61 +++++++++++++++++ bootsplash.script | 95 +++++++++++++++++++++++++ bootsplash.sysconfig | 31 +++++++++ 4 files changed, 324 insertions(+) create mode 100644 bootsplash-bootanim.script create mode 100644 bootsplash.init create mode 100644 bootsplash.script create mode 100644 bootsplash.sysconfig diff --git a/bootsplash-bootanim.script b/bootsplash-bootanim.script new file mode 100644 index 0000000..6eb0469 --- /dev/null +++ b/bootsplash-bootanim.script @@ -0,0 +1,137 @@ +#!/bin/bash +# +# bootanim - boot animation wrapper script for fbmngplay +# +# This program parses /etc/bootsplash/[THEME]/config/bootsplash-XxY.cfg +# to determine the correct animation position. +# +# This program is free software; you may redistribute it under the terms +# of the GNU General Public License. This program has absolutely no warranty. +# +# (C) 2002,2003 SuSE Linux AG. Written by Stefan Reinauer +# +# See http://www.bootsplash.org/ for more information. +# + +usage() +{ + echo "usage: $0 [start|stop|kill|next] -m [-r XxY] [-d dir] mng1 [mng2..]" + cat << EOF + + Available commands: + start starts given animation + stop fades out all running animations + kill immediately stops all animations + next continue to next animation. + + Options for use with start command: + -r XxY screen resolution to use if unable to autodetect. + -d dir directory containing the animation files + -m play multiple animations + mng1|mng2 animation filename(s). Specify -m if multiple. + +EOF + +} + +if [ "$UID" -ne "0" ]; then + echo "$0 must be started as user root!!!" + echo "Exiting..." + exit 1 +fi + +THEME="No theme selected" +[ -f /etc/sysconfig/bootsplash ] && . /etc/sysconfig/bootsplash + +if [ ! -d /etc/bootsplash/themes/$THEME ] +then + echo "$0: could not find theme $THEME in /etc/bootsplash/themes." + exit 0 +fi + +MODE=$(/bin/fbresolution 2>/dev/null) +DIRECTORY=/etc/bootsplash/themes/$THEME/animations +OPTIONS="-b -c 1" +FILES="" + +case "$1" in +start) + # echo "$0 start" + # We fall through here. + ;; +stop) + # echo "$0 stop" + /bin/killall -q -2 fbmngplay + exit 0 + ;; +kill) + # echo "$0 kill" + /bin/killall -q fbmngplay + exit 0 + ;; +next) + # echo "$0 next" + /bin/killall -q -USR1 fbmngplay + exit 0 + ;; +*) + usage; + echo " Error: illegal parameter."; + exit 1 + ;; +esac + +shift + +# We end up in bootanim start +while getopts mr:d: name "$@"; do + # echo "loop: $*" + case "$name" in + d) # directory + shift + if [ ! -d "$OPTARG" ]; then + echo "Not a valid directory." + exit 1 + fi + DIRECTORY=$OPTARG + shift + ;; + r) # resolution + shift + MODE=$OPTARG; + shift + ;; + m) # multiple files + shift + OPTIONS="$OPTIONS -s" + ;; + *) # Weird + shift + echo "Internal Error." + exit 1 + ;; + esac +done + +function box() { true; } # ignore box descriptions in the config file + +# Sourcing config file +if [ -f /etc/bootsplash/themes/$THEME/config/bootsplash-$MODE.cfg ]; then + . /etc/bootsplash/themes/$THEME/config/bootsplash-$MODE.cfg +else + echo "$0: No config file found for theme $THEME ($MODE)." + exit 1 +fi + +# echo "Dir: $DIRECTORY" +# echo "Files: $*" +# echo "Mode: $MODE" +# echo "Pos: $ax,$ay" +# echo "options: $OPTIONS" + +CMDLINE="/bin/fbmngplay -x $ax -y $ay $OPTIONS" +for i in $*; do + CMDLINE="$CMDLINE $DIRECTORY/$i" +done + +eval "$CMDLINE &" diff --git a/bootsplash.init b/bootsplash.init new file mode 100644 index 0000000..b80887d --- /dev/null +++ b/bootsplash.init @@ -0,0 +1,61 @@ +#!/bin/sh +# +# bootsplash bootsplashed console +# +# chkconfig: 345 99 99 +# +# description: Activate bootsplashed consoles +# +# $Id$ + + +# Source function library +. /etc/rc.d/init.d/functions + +# Set defaults +RES=`fbresolution` + +# Get service config - may override defaults +[ -f /etc/sysconfig/bootsplash ] && . /etc/sysconfig/bootsplash + +# See how we were called. +case "$1" in + start) + # Check if the service is already running? + if [ ! -f /var/lock/subsys/bootsplash ]; then + + for console in $BOOT_SPLASH_CONSOLES; do + msg_starting "bootsplash terminal $console" + daemon /bin/splash.bin -s -u $console -n "/etc/bootsplash/themes/$THEME/config/bootsplash-$RES.cfg" + done + RETVAL=$? + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/bootsplash + else + msg_already_running bootsplash + fi + ;; + stop) + if [ -f /var/lock/subsys/bootsplash ]; then + # Stop daemons. + msg_stopping bootsplash + #killproc bootsplash + rm -f /var/lock/subsys/bootsplash + else + msg_not_running bootsplash + fi + ;; + restart) + $0 stop + $0 start + exit $? + ;; + *) + # show "Usage: %s {start|stop|restart}" + msg_usage "$0 {start|stop|restart}" + exit 3 +esac + +exit $RETVAL + +# This must be last line ! +# vi:syntax=sh:tw=78:ts=8:sw=4 diff --git a/bootsplash.script b/bootsplash.script new file mode 100644 index 0000000..b8cfaf3 --- /dev/null +++ b/bootsplash.script @@ -0,0 +1,95 @@ +#!/bin/bash +# +# splash.sh - This shell script triggers bootsplash actions during +# system boot/shutdown. It can be run by the init scripts repeatedly +# specifying the currently executed system script. +# +# This script is used to play animations/sounds/show text/move the +# progress bar, etc. +# +# We call this function from /etc/rc.status:rc_splash() +# +# This program is free software; you may redistribute it under +# the terms of the GNU General Public License. This program has +# absolutely no warranty. +# +# written 2002-2003 Stefan Reinauer, +# +# this script expects the following environment variables for an operable +# progress bar: +# +# sscripts = number of start scripts to be executed for runlevel change +# kscripts = number of stop scripts to be executed for runlevel change +# progress = number of currently executed start/stop script +# RUNLEVEL = runlevel to be reached. +# +# To play animations, it's advised that you have an animations.cfg in your +# theme's config directory specifying the initscript name for an event and +# the command to be executed: +# +# fsck start:bootanim start bounce.mng +# master:bootanim stop +# +# See http://www.bootsplash.org/ for more information. +# +# Modified for PLD (arekm@pld-linux.org) + +[ -f /etc/sysconfig/bootsplash ] && . /etc/sysconfig/bootsplash + +_procsplash=$(cat /proc/splash 2> /dev/null) + +if [ -f /etc/bootsplash/themes/$THEME/config/animations.cfg ]; then + COMMAND="$(cat /etc/bootsplash/themes/$THEME/config/animations.cfg | grep "^$1"| cut -f2 -d\:)" + eval $COMMAND +fi + +# assertions +[ -e /proc/splash ] || exit 0 +[ -z "$progress" -a -z "$num" ] && exit 0 +[ -z "$(echo $_procsplash | grep on)" ] && exit 0 + +# We chose verbose in grub +cat /proc/cmdline | grep -v -q "splash=silent" && exit 0 + +if [ "$previous" == "3" -o "$previous" == "5" ] ; then + if [ "$runlevel" = "3" -o "$runlevel" == "5" ] ; then + exit 0 + fi +fi + +# acquire data +# +num=$(( $sscripts + 2 )) +_shutdown="no" +_silent="no" +cat /proc/splash | grep -q silent && _silent="yes" +[ "$runlevel" == "6" -o "$runlevel" == "0" ] && _shutdown="yes" +[ "$_shutdown" == "yes" ] && num=$(( $kscripts + 2 )) + +function box() { true; } # ignore box descriptions in the config file + +if [ -f "/etc/bootsplash/themes/$THEME/config/bootsplash-`/bin/fbresolution`.cfg" ]; then + . /etc/bootsplash/themes/$THEME/config/bootsplash-`/bin/fbresolution`.cfg +fi + +# Print text string. (Booting/Shutting down the system. Press +# F2 for verbose mode) +# + +if [ "$progress" == 1 -o "$1" == "splash start" ]; then + [ "$_shutdown" == "yes" ] && ( echo "silent" > /proc/splash ; chvt 1) + _boot=$BOOT_TXT + [ "$_shutdown" == "yes" ] && _boot=$SHUTDOWN_TXT + + if [ "$text_x" != "" -a "$text_y" != "" \ + -a "$text_color" != "" -a "$text_size" != "" -a "$_silent" == "yes" ]; + then + fbtruetype -x $text_x -y $text_y -t $text_color -s $text_size "$_boot" + fi +fi + +# Now paint the progressbar. This is done via the proc +# interface of the bootsplash. + +echo "show $(( 65534 * ( $progress + 1 ) / $num ))" > /proc/splash + diff --git a/bootsplash.sysconfig b/bootsplash.sysconfig new file mode 100644 index 0000000..09727af --- /dev/null +++ b/bootsplash.sysconfig @@ -0,0 +1,31 @@ +# $Id$ + +# REMEMBER: changing BOOT_SPLASH, BOOT_SPLASH_RESOLUTIONS, THEME should be +# followed by geninitrd + +# boot splash enabled? +#BOOT_SPLASH=yes +BOOT_SPLASH=yes + +# desired resolutions (each one increases size of initrd) +#BOOT_SPLASH_RESOLUTIONS="1024x768 800x600" +BOOT_SPLASH_RESOLUTIONS="1024x768" + +# set on which consoles should be a bootsplash +# set 0 for the first one, 1 for the second etc. +# you can also give a list +#BOOT_SPLASH_CONSOLES="1 2 3 4 5 6 7" +BOOT_SPLASH_CONSOLES= + +# bootsplash theme... You have to have installed one +#THEME=darkblue +THEME=pldblackbyshad + +# Text to show when booting... +#BOOT_TXT="Booting the system... press F2 for verbose mode" +BOOT_TXT="Booting the system... press F2 for verbose mode" + +# Text to show when shutting down... +#SHUTDOWN_TXT="Shutting down the system... press F2 for verbose mode" +SHUTDOWN_TXT="Shutting down the system... press F2 for verbose mode" + -- 2.44.0