diff options
Diffstat (limited to 'mkfbsplash')
-rwxr-xr-x | mkfbsplash | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/mkfbsplash b/mkfbsplash new file mode 100755 index 000000000000..805db47bb84e --- /dev/null +++ b/mkfbsplash @@ -0,0 +1,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}" |