blob: 805db47bb84e4410f24ce59e23e1ef5af679f44f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
#! /usr/bin/bash
#
# This file is part of mkinitcpio-fbsplash.
#
# mkinitcpio-fbsplash is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# mkinitcpio-fbsplash is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with mkinitcpio-fbsplash. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
IMAGE=
FB_DEV="/dev/fb0"
OUT_FILE="/etc/splash.fb"
SCRIPT_NAME="$(basename $0)"
DESC="${SCRIPT_NAME} - Generates a framebuffer boot splash from an image file."
USAGE="Usage:
${SCRIPT_NAME} <image_file> [options]"
OPTIONS="Options:
--dev, -d <framebuffer_device> Specifies the framebuffer device to be used.
Deftaults to ${FB_DEV}.
--file, -f, -o <output_file> Specifies the output file to be written to.
Defaults to ${OUT_FILE}."
while (($#)); do
case $1 in
"--dev"|"-d") FB_DEV="$2"
shift
;;
"--file"|"-f"|"-o") OUT_FILE="$2"
shift
;;
"--help"|"-h") echo -e "${DESC}\n"
echo -e "${USAGE}\n"
echo "${OPTIONS}"
exit 0
;;
*) if [ -z "${IMAGE}" ]; then
IMAGE="$1"
else
echo "Unknown parameter: $1" >&2
echo "${USAGE}" >&2
exit 1
fi
esac
shift
done
if [ -z "${IMAGE}" ]; then
echo "${USAGE}" >&2
exit 2
elif [ ! -f "${IMAGE}" ]; then
echo "Selected image does not exist." >&2
exit 3
fi
if [ ${EUID} -ne 0 ]; then
echo "You need to be root to run this script" >&2
exit 4
fi
TEMP=$(mktemp)
clear
/usr/bin/fbv -c -i -d 1 "${IMAGE}"
/usr/bin/cp "${FB_DEV}" "${TEMP}"
/usr/bin/mv -i "${TEMP}" "${OUT_FILE}"
/usr/bin/rm -f "${TEMP}"
|