[ -z "$PLYMOUTH_LIBEXECDIR" ] && PLYMOUTH_LIBEXECDIR="@PLYMOUTH_LIBEXECDIR@"
[ -z "$PLYMOUTH_DATADIR" ] && PLYMOUTH_DATADIR="@PLYMOUTH_DATADIR@"
+[ -z "$PLYMOUTH_CONFDIR" ] && PLYMOUTH_CONFDIR="@PLYMOUTH_CONF_DIR@"
+[ -z "$PLYMOUTH_POLICYDIR" ] && PLYMOUTH_POLICYDIR="@PLYMOUTH_POLICY_DIR@"
if [ -z "$PLYMOUTH_PLUGIN_PATH" ]; then
if [ -z "$LIB" ]; then
PLYMOUTH_PLUGIN_PATH="$(plymouth --get-splash-plugin-path)"
done
}
+function read_theme_name_from_file ()
+{
+ echo $(grep -v '^#' $1 2> /dev/null |
+ awk '
+ BEGIN {
+ RS="[[][[:blank:]]*[^[:space:]]+[:blank:]*[]\n]";
+ FS="[=[:space:]]+";
+ OFS="";
+ ORS=""
+ }
+ $1 ~/Theme/ { print $2 }
+ ')
+}
+
function get_default_theme ()
{
- THEME_NAME=$(basename $(readlink ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth) .plymouth)
- if [ "$THEME_NAME" = ".plymouth" ]; then
- $0 --reset
- THEME_NAME=$(basename $(readlink ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth) .plymouth)
+ THEME_NAME=$(read_theme_name_from_file ${PLYMOUTH_CONFDIR}/plymouthd.conf)
+ if [ -z "$THEME_NAME" ]; then
+ THEME_NAME=$(read_theme_name_from_file ${PLYMOUTH_POLICYDIR}/plymouthd.defaults)
fi
- [ "$THEME_NAME" = ".so" ] || echo $THEME_NAME && exit 1
+ [ -z "$THEME_NAME" ] || echo $THEME_NAME && exit 1
}
DO_RESET=0
fi
if [ $DO_RESET -ne 0 ]; then
- THEME_NAME=$(basename $(ls -1 -t ${PLYMOUTH_DATADIR}/plymouth/themes/*/*.plymouth 2> /dev/null | tail -n 1) .plymouth)
- if [ $THEME_NAME = .plymouth ]; then
- rm -f ${PLYMOUTH_DATADIR}/plymouth/themes/default.plymouth
- exit 0
- fi
+ [ -f ${PLYMOUTH_CONFDIR}/plymouthd.conf ] || exit 0
+ sed -i -e '/^Theme[[:blank:]]*=.*/d' ${PLYMOUTH_CONFDIR}/plymouthd.conf
+ exit $?
fi
if [ ! -e ${PLYMOUTH_DATADIR}/plymouth/themes/${THEME_NAME}/${THEME_NAME}.plymouth ]; then
exit 1
fi
-(cd ${PLYMOUTH_DATADIR}/plymouth/themes;
- ln -sf ${THEME_NAME}/${THEME_NAME}.plymouth default.plymouth && \
- ([ $DO_INITRD_REBUILD -ne 0 ] && \
- ${PLYMOUTH_LIBEXECDIR}/plymouth/plymouth-update-initrd) || :)
+[ -d ${PLYMOUTH_CONFDIR} ] || mkdir -p ${PLYMOUTH_CONFDIR}
+fgrep -q '[Daemon]' ${PLYMOUTH_CONFDIR}/plymouthd.conf 2> /null || echo '[Daemon]' >> ${PLYMOUTH_CONFDIR}/plymouthd.conf
+sed -i -e '/^Theme[[:blank:]]*=.*/d' ${PLYMOUTH_CONFDIR}/plymouthd.conf
+sed -i -e "s/\([[]Daemon[]]\)\n*/\1\nTheme=${THEME_NAME}/" ${PLYMOUTH_CONFDIR}/plymouthd.conf
+
+[ $DO_INITRD_REBUILD -ne 0 ] && (${PLYMOUTH_LIBEXECDIR}/plymouth/plymouth-update-initrd)