Files
calamares-settings-rakuos/add-calamares-desktop-icon
2025-11-17 07:14:23 -07:00

45 lines
1.8 KiB
Bash
Executable File

#!/bin/sh
# Creates an "Install Debian" icon on the live session tested with:
# Xfce, LXDE, LXqt, Gnome, KDE, Mate, Cinnamon
# We query xdg-user-dir because the Desktop directory has different
# names for different languages
DESKTOP=$(xdg-user-dir DESKTOP)
# Create ~/Desktop just in case this runs before the xdg folder
# creation script.
mkdir -p $DESKTOP
# Among the Debian desktop environments, LXDE is the only one
# that behaves completely different.
if [ -f /usr/bin/lxsession ]; then
echo "[Desktop Entry]" > $DESKTOP/calamares-install-rakuos.desktop
echo "Type=Link" >> $DESKTOP/calamares-install-rakuos.desktop
echo "Name=Install RakuOS" >> $DESKTOP/calamares-install-rakuos.desktop
echo "Icon=/usr/share/pixmaps/install-rakuos.png" >> $DESKTOP/calamares-install-rakuos.desktop
echo "URL=/usr/share/applications/calamares-install-rakuos.desktop" \
>> $DESKTOP/calamares-install-rakuos.desktop
else
cp /usr/share/applications/calamares-install-rakuos.desktop $DESKTOP
# Xfce needs this executable otherwise it complains, everything
# else doesn't seem to care either way.
chmod +x $DESKTOP/calamares-install-rakuos.desktop
fi
# Set desktop launcher as trusted under Xfce (See: #1037299)
if [ "$XDG_CURRENT_DESKTOP" = "XFCE" ]; then
gio set --type=string ~/Desktop/calamares-install-rakuos.desktop \
metadata::trusted true
gio set --type=string ~/Desktop/calamares-install-rakuos.desktop \
metadata::xfce-exe-checksum \
"$(sha256sum ~/Desktop/calamares-install-rakuos.desktop | cut -f1 -d' ')"
touch ~/Desktop/calamares-install-rakuos.desktop
fi
# Preload calamares binaries and libraries using idle disk cycles
# so that it launches faster
ionice -C Idle cat /usr/bin/calamares > /dev/null
for file in $(ldd /usr/bin/calamares | awk '{print $3}'): do
ionice -C Idle cat $file > /dev/null
done