????

Your IP : 13.58.62.69


Current Path : /usr/local/ssl/libexec/plymouth/
Upload File :
Current File : //usr/local/ssl/libexec/plymouth/plymouth-populate-initrd

#!/bin/bash

[ -z "$DESTDIR" ] || exit 0

[ -z "$PLYMOUTH_LIBEXECDIR" ] && PLYMOUTH_LIBEXECDIR="/usr/libexec"
[ -z "$PLYMOUTH_DATADIR" ] && PLYMOUTH_DATADIR="/usr/share"
[ -z "$PLYMOUTH_PLUGIN_PATH" ] && PLYMOUTH_PLUGIN_PATH="$(plymouth --get-splash-plugin-path)"
[ -z "$PLYMOUTH_LOGO_FILE" ] && PLYMOUTH_LOGO_FILE="/usr/share/pixmaps/system-logo-white.png"
[ -z "$PLYMOUTH_THEME_NAME" ] && PLYMOUTH_THEME_NAME=$(plymouth-set-default-theme)
[ -z "$PLYMOUTH_CONFDIR" ] && PLYMOUTH_CONFDIR="/etc/plymouth/"
[ -z "$PLYMOUTH_POLICYDIR" ] && PLYMOUTH_POLICYDIR="/usr/share/plymouth/"

if [ -z "$PLYMOUTH_POPULATE_SOURCE_FUNCTIONS" ]; then

    if [ -f "${PLYMOUTH_LIBEXECDIR}/initrd-functions" ]; then
        PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="${PLYMOUTH_LIBEXECDIR}/initrd-functions"
    fi

    if [ -f "${PLYMOUTH_DATADIR}/dracut/dracut-functions" ]; then
        PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="${PLYMOUTH_DATADIR}/dracut/dracut-functions"
    fi
fi

if [ -n "$PLYMOUTH_POPULATE_SOURCE_FUNCTIONS" ]; then
    source $PLYMOUTH_POPULATE_SOURCE_FUNCTIONS
fi

if [ " $(type -t inst) " != " function " ]; then
    echo "Need 'inst' function, try setting PLYMOUTH_POPULATE_SOURCE_FUNCTIONS to a file that defines it" 1>&2
    exit 1
fi

if [ " $(type -t set_verbose) " != " function " ]; then
    function set_verbose { true; }
fi

function usage() {
    local output="/dev/stdout"
    local rc=0
    if [ "$1" == "error" ]; then
        output="/dev/stderr"
        rc=1
    fi

    echo "usage: plymouth [ --verbose | -v ] { --targetdir | -t } <initrd_directory>" > $output
    exit $rc
}

verbose=false
INITRDDIR=""
while [ $# -gt 0 ]; do
    case $1 in
        --verbose|-v)
            verbose=true
            ;;
        --targetdir|-t)
            shift
            INITRDDIR="$1"
            ;;
        --help|-h)
            usage normal
            ;;
        *)
            usage error
            break
            ;;
    esac
    shift
done
set_verbose $verbose || :

[ -z "$INITRDDIR" ] && usage error

mkdir -p ${INITRDDIR}${PLYMOUTH_DATADIR}/plymouth/themes
inst /sbin/plymouthd $INITRDDIR /bin/plymouthd
inst /bin/plymouth $INITRDDIR
inst ${PLYMOUTH_DATADIR}/plymouth/themes/text/text.plymouth $INITRDDIR
inst ${PLYMOUTH_PLUGIN_PATH}/text.so $INITRDDIR
inst ${PLYMOUTH_DATADIR}/plymouth/themes/details/details.plymouth $INITRDDIR
inst ${PLYMOUTH_PLUGIN_PATH}/details.so $INITRDDIR
inst ${PLYMOUTH_LOGO_FILE} $INITRDDIR
inst /etc/system-release $INITRDDIR
inst ${PLYMOUTH_POLICYDIR}/plymouthd.defaults $INITRDDIR
inst ${PLYMOUTH_CONFDIR}/plymouthd.conf $INITRDDIR

if [ -z "$PLYMOUTH_THEME_NAME" ]; then
    echo "No default plymouth plugin is set" > /dev/stderr
    exit 1
fi

PLYMOUTH_MODULE_NAME=$(grep "ModuleName *= *" ${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME}/${PLYMOUTH_THEME_NAME}.plymouth | sed 's/ModuleName *= *//')

if [ ! -f ${PLYMOUTH_PLUGIN_PATH}/${PLYMOUTH_MODULE_NAME}.so ]; then
    echo "The default plymouth plugin (${PLYMOUTH_MODULE_NAME}) doesn't exist" > /dev/stderr
    exit 1
fi

inst ${PLYMOUTH_PLUGIN_PATH}/${PLYMOUTH_MODULE_NAME}.so $INITRDDIR

inst ${PLYMOUTH_PLUGIN_PATH}/renderers/drm.so $INITRDDIR
inst ${PLYMOUTH_PLUGIN_PATH}/renderers/frame-buffer.so $INITRDDIR

if [ -d ${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME} ]; then
    for x in ${PLYMOUTH_DATADIR}/plymouth/themes/${PLYMOUTH_THEME_NAME}/* ; do
        [ ! -f "$x" ] && break
        inst $x $INITRDDIR
    done
fi

if [ -L ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth ]; then
    cp -a ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth $INITRDDIR${PLYMOUTH_DATADIR}/plymouth/themes
fi

# vim:ts=8:sw=4:sts=4:et