#!/bin/sh -efu

plymouth_script() {
	local args=
	[ -z "$NOSPLASH" ] || return 0
	# Run plymouth here if it looks like KMS framebuffer
	[ "${vga%x*}" = "0" ] && return 0

	mkdir -m 0755 /dev/.systemd
	: > /dev/.systemd/plymouth

	if [ -d /run ]; then
		mkdir -m 0755 /run/plymouth
		args='--pid-file /run/plymouth/pid'
	fi

	/sbin/plymouthd $args
	/bin/plymouth --show-splash
}

plymouth_script
