You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
calculate-plymouth/scripts/plymouth-update-initrd

86 lines
3.0 KiB

#!/bin/bash
[ -z "$DESTDIR" ] || exit 0
set -e
[ -z "$LIBEXECDIR" ] && LIBEXECDIR="/usr/libexec"
[ -z "$DATADIR" ] && DATADIR="/usr/share"
[ -z "$INITRD" ] && INITRD="/boot/initrd-$(/bin/uname -r).img"
[ -z "$SYSTEMMAP" ] && SYSTEM_MAP="/boot/System.map-$(/bin/uname -r)"
[ -z "$LIB" ] && [ $(head -n1 $SYSTEM_MAP | awk '{print $1}' | wc -c) -lt 16 ] && LIB="lib" || LIB="lib64"
[ -z "$LIBDIR" ] && LIBDIR="/usr/$LIB"
[ -z "$BINDIR" ] && BINDIR="/usr/bin"
[ -z "$GRUB_MENU_TITLE" ] && GRUB_MENU_TITLE="Graphical Bootup"
if [ -z "$NEW_INITRD" ]; then
NEW_INITRD="$(dirname $INITRD)/$(basename $INITRD .img)-plymouth.img"
fi
function get_lib_deps()
{
while [ $# -gt 0 ]; do
/usr/bin/ldd $1 | sed -n 's/.*=> \?\([^ ]*\) (.*$/\1/p'
shift
done | sort -u
}
TMPDIR="$(mktemp -d $PWD/initrd.XXXXXXXXXX)"
(cd $TMPDIR
zcat $INITRD | cpio --quiet -Hnewc -i --make-directories
sed -i -e 's@^#!\(.*\)@#!/bin/plymouthd \1\n@' init
sed -i -e 's@setquiet@&\n/bin/plymouth --show-splash\n/bin/plymouth --ask-for-password\n@' init
(cd $LIBDIR
DEPS=$(get_lib_deps ${LIBEXECDIR}/plymouth/plymouth ${LIBDIR}/plymouth/fedora-fade-in.so ${LIBDIR}/plymouth/text.so ${LIBDIR}/plymouth/details.so)
for dep in $DEPS; do
install -D -m755 $dep ${TMPDIR}$(dirname $dep)
done
)
/sbin/ldconfig -n $LIB
/sbin/ldconfig -n .${LIBDIR}
install -m755 ${LIBEXECDIR}/plymouth/plymouthd bin
install -m755 ${BINDIR}/plymouth bin
mkdir -p ${TMPDIR}$DATADIR/plymouth
install -m644 ${DATADIR}/pixmaps/fedora-logo.png ${TMPDIR}${DATADIR}/plymouth
install -m644 ${DATADIR}/plymouth/star.png ${TMPDIR}${DATADIR}/plymouth
install -m644 ${DATADIR}/plymouth/lock.png ${TMPDIR}${DATADIR}/plymouth
install -m644 ${DATADIR}/plymouth/entry.png ${TMPDIR}${DATADIR}/plymouth
install -m644 ${DATADIR}/plymouth/bullet.png ${TMPDIR}${DATADIR}/plymouth
mkdir -p ${TMPDIR}${LIBDIR}/plymouth
install -m755 ${LIBDIR}/plymouth/fedora-fade-in.so ${TMPDIR}${LIBDIR}/plymouth
install -m755 ${LIBDIR}/plymouth/text.so ${TMPDIR}${LIBDIR}/plymouth
install -m755 ${LIBDIR}/plymouth/details.so ${TMPDIR}${LIBDIR}/plymouth
rm -f $NEW_INITRD
find | cpio --quiet -Hnewc -o | gzip -9 > $NEW_INITRD
[ $? -eq 0 ] && echo "Wrote $NEW_INITRD"
)
rm -rf "$TMPDIR"
CURRENT_KERNEL=$(/sbin/grubby --default-kernel)
# XXX: Hack to clean out old entry since grubby doesn't deal with dupes too well
if fgrep -q "title $GRUB_MENU_TITLE" /etc/grub.conf; then
TMPFILE="$(mktemp /etc/grub.conf.XXXXXXXXXX)"
if [ -L /etc/grub.conf ]; then
GRUB_CONF="$(readlink /etc/grub.conf)"
else
GRUB_CONF="/etc/grub.conf"
fi
(cd /etc; awk '$1 != "'"$GRUB_MENU_TITLE"'" { printf $0 RT }' RS="title " FS="\n" $GRUB_CONF > $TMPFILE \
&& mv $TMPFILE $GRUB_CONF || rm -f $TMPFILE)
fi
/sbin/grubby --title="$GRUB_MENU_TITLE" \
--add-kernel="$CURRENT_KERNEL" \
--copy-default \
--args="vga=0x318 rhgb quiet" \
--initrd="$NEW_INITRD"