summaryrefslogtreecommitdiffstats
path: root/scripts/plymouth-set-default-plugin
blob: 42a0266c6319002f96c9ca434f0e03b1f9a1b32b (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
#!/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

if [ ! -e ${LIBDIR}/plymouth/$1.so ]; then
        echo "${LIBDIR}/plymouth/$1.so does not exist" > /dev/stderr
        exit 1
fi

(cd ${LIBDIR}/plymouth; ln -sf $1 graphical.so)