distribution/packages/jelos/sources/scripts/show_splash

48 lines
1.3 KiB
Bash
Executable file

#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2019-present SumavisionQ5 (https://github.com/SumavisionQ5)
# Modifications by Shanti Gilbert (https://github.com/shantigilbert)
# Copyright (C) 2020-present Fewtarius
. /etc/profile
SPLASH_TYPE="$1"
hres="$(fbset 2>/dev/null | awk '/geometry/ { print $2 }')"
vres="$(fbset 2>/dev/null | awk '/geometry/ { print $3 }')"
if [ "${SPLASH_TYPE}" == "intro" ] || [ "${SPLASH_TYPE}" == "exit" ]
then
if [ ${vres} -gt ${hres} ]
then
SPLASH="/usr/config/splash/splashl.png"
else
SPLASH="/usr/config/splash/splash.png"
fi
else
exit 0
fi
[[ "${PLATFORM}" != "intro" ]] && VIDEO=0 || VIDEO=$(get_setting bootvideo.enabled)
if [[ -f "/storage/.config/system/configs/novideo" ]] && [[ ${VIDEO} != "1" ]]
then
if [ "${SPLASH_LOADER}" = "plymouth" ] || [ -z "${SPLASH_LOADER}" ]
then
ply-image "${SPLASH}" 2>/dev/null
elif [ "${SPLASH_LOADER}" = "imagemagick" ]
then
convert "${SPLASH}" -background black -gravity center bgra:/dev/fb0 > /dev/null 2>&1
fi
else
# Show intro video
SPLASH=${VIDEOSPLASH}
set_audio alsa
/usr/bin/mpv "${SPLASH}" > /dev/null 2>&1
touch "/storage/.config/system/configs/novideo"
fi
# Wait for the time specified in splash_delay setting in system.cfg
SPLASHTIME=$(get_setting splash.delay)
[ ! -z "${SPLASHTIME}" ] && sleep ${SPLASHTIME}