Files
site/WESP_REL/scripts/plymouth/install_wesp_theme.sh
T
2026-07-17 12:57:18 +03:00

62 lines
1.9 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# Установка темы Plymouth WESP (нужен root).
# Использование: install_wesp_theme.sh /path/to/built/theme
set -euo pipefail
SRC="${1:-}"
if [[ -z "${SRC}" || ! -d "${SRC}" ]]; then
echo "Usage: $0 /path/to/theme-dir" >&2
exit 2
fi
if [[ "$(id -u)" -ne 0 ]]; then
echo "Запустите от root (sudo)." >&2
exit 1
fi
THEME_ID="wesp"
DEST="/usr/share/plymouth/themes/${THEME_ID}"
PLYMOUTH_FILE="${DEST}/${THEME_ID}.plymouth"
if ! command -v plymouth >/dev/null 2>&1; then
echo "plymouth не найден. Установите: apt install plymouth plymouth-themes" >&2
exit 1
fi
if [[ ! -f "${SRC}/${THEME_ID}.plymouth" || ! -f "${SRC}/${THEME_ID}.script" ]]; then
echo "В ${SRC} нет ${THEME_ID}.plymouth / ${THEME_ID}.script" >&2
exit 1
fi
if [[ ! -d "${SRC}/animation" ]] || [[ -z "$(ls -A "${SRC}/animation" 2>/dev/null || true)" ]]; then
echo "Нет кадров в ${SRC}/animation — сначала сгенерируйте анимацию." >&2
exit 1
fi
install -d "${DEST}"
rsync -a --delete "${SRC}/" "${DEST}/"
if command -v update-alternatives >/dev/null 2>&1; then
update-alternatives --install \
/usr/share/plymouth/themes/default.plymouth default.plymouth \
"${PLYMOUTH_FILE}" 200
update-alternatives --set default.plymouth "${PLYMOUTH_FILE}"
elif command -v plymouth-set-default-theme >/dev/null 2>&1; then
plymouth-set-default-theme -R "${THEME_ID}"
else
ln -sf "${PLYMOUTH_FILE}" /etc/alternatives/default.plymouth 2>/dev/null || true
fi
if command -v plymouth-set-default-theme >/dev/null 2>&1; then
plymouth-set-default-theme "${THEME_ID}" 2>/dev/null || true
fi
if command -v update-initramfs >/dev/null 2>&1; then
echo "==> update-initramfs -u"
update-initramfs -u
else
echo "update-initramfs не найден — пересоберите initramfs вручную." >&2
fi
echo "Тема WESP установлена: ${DEST}"