Commit c422f31e authored by Maxime Accadia's avatar Maxime Accadia
Browse files

Utilisation de dpkg-divert

Au lieu de l'horrible hack.
parent a39768c5
Pipeline #77731 passed with stages
in 1 minute and 29 seconds
File mode changed from 100644 to 100755
#!/bin/bash
LEGACY_LOGOS="/usr/share/plymouth/ubuntu-logo.png /usr/share/plymouth/themes/spinner/watermark.png"
#!/bin/sh
case "${1}" in
remove)
for l in $LEGACY_LOGOS; do
if [ -f "$l.backup" ]; then
echo "Restoring logo backup $l.backup"
mv "$l.backup" "$l"
fi
done
dpkg-divert --remove --package design-linux-uga --rename --divert \
/usr/share/plymouth/themes/spinner/watermark.png.ubuntu /usr/share/plymouth/themes/spinner/watermark.png
dpkg-divert --remove --package design-linux-uga --rename --divert \
/usr/share/plymouth/ubuntu-logo.png.ubuntu /usr/share/plymouth/ubuntu-logo.png
if which update-initramfs >/dev/null 2>&1; then
update-initramfs -u
fi
if which dconf >/dev/null 2>&1
then
dconf update
fi
;;
purge)
;;
upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
if which update-initramfs >/dev/null 2>&1; then
update-initramfs -u
fi
;;
*)
echo "postrm called with unknown argument \`${1}'" >&2
exit 1
;;
esac
if which dconf >/dev/null 2>&1
then
dconf update
fi
#!/bin/sh
dpkg-divert --add --package design-linux-uga --rename --divert \
/usr/share/plymouth/themes/spinner/watermark.png.ubuntu /usr/share/plymouth/themes/spinner/watermark.png
dpkg-divert --add --package design-linux-uga --rename --divert \
/usr/share/plymouth/ubuntu-logo.png.ubuntu /usr/share/plymouth/ubuntu-logo.png
......@@ -11,14 +11,13 @@ mkdir -p "$FAKEROOT/usr/share/gnome-background-properties/"
mkdir -p "$FAKEROOT/usr/share/plymouth"
mkdir -p "$FAKEROOT/usr/share/pixmaps"
mkdir -p "$FAKEROOT/usr/share/icons"
mkdir -p "$FAKEROOT/usr/share/plymouth/themes/spinner"
mkdir -p "$FAKEROOT/DEBIAN"
cp debian/control "$FAKEROOT/DEBIAN"
cp -r debian/* "$FAKEROOT/DEBIAN"
sed -i "s/<version>/0.0/g" "$FAKEROOT/DEBIAN/control" # mets la version à 0.0 si il n'y en a pas
cp debian/postinst "$FAKEROOT/DEBIAN"
cp debian/postrm "$FAKEROOT/DEBIAN"
chmod 0755 "$FAKEROOT/DEBIAN/postinst"
chmod 0755 "$FAKEROOT/DEBIAN/postrm"
chmod 0755 "$FAKEROOT/DEBIAN/"*inst
chmod 0755 "$FAKEROOT/DEBIAN/"*rm
# fonds d'écrans
......@@ -35,8 +34,8 @@ make INSTALL_ROOT="$FAKEROOT" install
cd -
# plymouth
install -m 644 plymouth/logo "$FAKEROOT/usr/share/initramfs-tools/conf-hooks.d"
install -m 644 plymouth/logo.png "$FAKEROOT/usr/share/plymouth"
install -m 644 plymouth/logo.png "$FAKEROOT/usr/share/plymouth/ubuntu-logo.png"
install -m 644 plymouth/logo.png "$FAKEROOT/usr/share/plymouth/themes/spinner/watermark.png"
# icons
install -m 644 icons/folder-uga.svg "$FAKEROOT/usr/share/icons"
......
......@@ -2,16 +2,39 @@
## Ce que ça fait
* Remplace le logo Ubuntu lors du démarrage (nécessite plymouth et un thème compatible installé)
* Remplace le logo Ubuntu lors du démarrage (nécessite plymouth et un thème compatible installé).
## Comment ça marche
Les fichiers suivants sont remplacés :
* `/usr/share/plymouth/ubuntu-logo.png`
* `/usr/share/plymouth/themes/spinner/watermark.png`
On utilise `dpkg-divert` afin que ces fichiers ne soient pas réécrasés lors de la réinstallation / mise à jour des paquets dont ils proviennent. Voir https://www.debian.org/doc/debian-policy/ap-pkg-diversions.html.
## Utilisation
Installation :
```bash
# en root
dpkg-divert --add --rename --divert /usr/share/plymouth/themes/spinner/watermark.png.ubuntu /usr/share/plymouth/themes/spinner/watermark.png
dpkg-divert --add --rename --divert /usr/share/plymouth/ubuntu-logo.png.ubuntu /usr/share/plymouth/ubuntu-logo.png
install -m 644 logo.png /usr/share/plymouth/ubuntu-logo.png
install -m 644 logo.png /usr/share/plymouth/themes/spinner/watermark.png
update-initramfs -u
```
Désinstallation:
```bash
install -m 644 logo /usr/share/initramfs-tools/conf-hooks.d
install -m 644 logo.png /usr/share/plymouth
# en root
rm /usr/share/plymouth/ubuntu-logo.png
rm /usr/share/plymouth/themes/spinner/watermark.png
dpkg-divert --remove --rename --divert /usr/share/plymouth/themes/spinner/watermark.png.ubuntu /usr/share/plymouth/themes/spinner/watermark.png
dpkg-divert --remove --rename --divert /usr/share/plymouth/ubuntu-logo.png.ubuntu /usr/share/plymouth/ubuntu-logo.png
update-initramfs -u
```
## Problèmes connus
### Le logo ne s'affiche pas au démarrage
......
#!/bin/sh
# initramfs conf-hook
# Place this file in /usr/share/initramfs-tools/conf-hooks.d/
# Place your logo in `/usr/share/plymouth/logo.png` to replace the Ubuntu logo
# This is a hack : we use a conf-hook instead of normal hook because hooks
# run without order and this should run before the plymouth hook.
LOGO_PNG="/usr/share/plymouth/logo.png"
LEGACY_LOGOS="/usr/share/plymouth/ubuntu-logo.png /usr/share/plymouth/themes/spinner/watermark.png"
for l in $LEGACY_LOGOS; do
if [ -f "$l" ]; then
if ! [ -f "$l.backup" ]; then
mv "$l" "$l.backup"
cp "$LOGO_PNG" "$l"
fi
fi
done
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment