plymouth/scripts/plymouth-set-default-plugin
Ray Strode 9e37acbd13 Add --reset argument to set-default-plugin
It just chooses the last installed plugin as the default
or no plugin if there is none available
2008-06-11 12:10:22 -04:00

36 lines
1 KiB
Bash
Executable file

#!/bin/bash
set -e
[ -z "$LIBEXECDIR" ] && LIBEXECDIR="/usr/libexec"
[ -z "$DATADIR" ] && DATADIR="/usr/share"
[ -z "$LIB" ] && $(eu-readelf -h /usr/bin/plymouth | grep Class | grep -q ELF64) && LIB="lib64" || LIB="lib"
[ -z "$LIBDIR" ] && LIBDIR="/usr/$LIB"
[ -z "$BINDIR" ] && BINDIR="/usr/bin"
if [ $# -lt 1 ]; then
basename $(readlink ${LIBDIR}/plymouth/graphical.so) .so
exit $?
fi
if [ `id -u` -ne 0 ]; then
echo "This program must be run as root" > /dev/stderr
exit 1
fi
PLUGIN_NAME=$1
if [ $1 = '--reset' ]; then
PLUGIN_NAME=$(basename $(ls -1 -t ${LIBDIR}/plymouth/*.so 2> /dev/null | grep -v graphical.so | head -n 1) .so)
if [ $PLUGIN_NAME = .so ]; then
rm -f ${LIBDIR}/plymouth/graphical.so
exit 0
fi
fi
if [ ! -e ${LIBDIR}/plymouth/${PLUGIN_NAME}.so ]; then
echo "${LIBDIR}/plymouth/${PLUGIN_NAME}.so does not exist" > /dev/stderr
exit 1
fi
(cd ${LIBDIR}/plymouth; ln -sf ${PLUGIN_NAME}.so graphical.so)