Debian Codegraph @

add-calamares-desktop-icon

raw
1 #!/bin/sh
2 # Creates an "Install Debian" icon on the live session tested with:
3 # Xfce, LXDE, LXqt, Gnome, KDE, Mate, Cinnamon
4
5 # We query xdg-user-dir because the Desktop directory has different
6 # names for different languages
7 DESKTOP=$(xdg-user-dir DESKTOP)
8
9 # Create ~/Desktop just in case this runs before the xdg folder
10 # creation script.
11 mkdir -p $DESKTOP
12
13 # Among the Debian desktop environments, LXDE is the only one
14 # that behaves completely different.
15 if [ -f /usr/bin/lxsession ]; then
16 echo "[Desktop Entry]" > $DESKTOP/calamares-install-debian.desktop
17 echo "Type=Link" >> $DESKTOP/calamares-install-debian.desktop
18 echo "Name=Install Debian" >> $DESKTOP/calamares-install-debian.desktop
19 echo "Icon=install-debian" >> $DESKTOP/calamares-install-debian.desktop
20 echo "URL=/usr/share/applications/calamares-install-debian.desktop" \
21 >> $DESKTOP/calamares-install-debian.desktop
22 else
23 cp /usr/share/applications/calamares-install-debian.desktop $DESKTOP
24 # Xfce needs this executable otherwise it complains, everything
25 # else doesn't seem to care either way.
26 chmod +x $DESKTOP/calamares-install-debian.desktop
27 fi
28
29 # Set desktop launcher as trusted under Xfce (See: #1037299)
30 if [ "$XDG_CURRENT_DESKTOP" = "XFCE" ]; then
31 gio set --type=string ~/Desktop/calamares-install-debian.desktop \
32 metadata::trusted true
33 gio set --type=string ~/Desktop/calamares-install-debian.desktop \
34 metadata::xfce-exe-checksum \
35 "$(sha256sum ~/Desktop/calamares-install-debian.desktop | cut -f1 -d' ')"
36 touch ~/Desktop/calamares-install-debian.desktop
37 fi
38
39 # Preload calamares binaries and libraries using idle disk cycles
40 # so that it launches faster
41 ionice -C Idle cat /usr/bin/calamares > /dev/null
42 for file in $(ldd /usr/bin/calamares | awk '{print $3}'): do
43 ionice -C Idle cat $file > /dev/null
44 done