Files
calamares-settings-vesperos/add-calamares-desktop-icon
2026-03-11 06:45:58 -07:00

51 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
# Creates an "Install VesperOS" 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 VesperOS desktop environments, LXDE is the only one
# that behaves completely different.
if [ -f /usr/bin/lxsession ]; then
echo "[Desktop Entry]" > $DESKTOP/calamares-install-vesperos.desktop
echo "Type=Link" >> $DESKTOP/calamares-install-vesperos.desktop
echo "Name=Install VesperOS" >> $DESKTOP/calamares-install-vesperos.desktop
echo "Icon=install-vesperos" >> $DESKTOP/calamares-install-vesperos.desktop
echo "URL=/usr/share/applications/calamares-install-vesperos.desktop" \
>> $DESKTOP/calamares-install-vesperos.desktop
else
cp /usr/share/applications/calamares-install-vesperos.desktop $DESKTOP
# Xfce needs this executable otherwise it complains, everything
# else doesn't seem to care either way.
chmod +x $DESKTOP/calamares-install-vesperos.desktop
fi
# Set desktop launcher as trusted under each DE (See: #1037299)
case "$XDG_CURRENT_DESKTOP" in
XFCE)
gio set --type=string $DESKTOP/calamares-install-vesperos.desktop \
metadata::trusted true
gio set --type=string $DESKTOP/calamares-install-vesperos.desktop \
metadata::xfce-exe-checksum \
"$(sha256sum $DESKTOP/calamares-install-vesperos.desktop | cut -f1 -d' ')"
touch $DESKTOP/calamares-install-vesperos.desktop
;;
*GNOME*)
gio set --type=string $DESKTOP/calamares-install-vesperos.desktop \
metadata::trusted true
;;
esac
# 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