#!/bin/sh
# Creates an "Install Debian" icon on the live session tested with:
# Xfce, LXDE, LXqt, Gnome, KDE, Mate, Cinnamon


# 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/install-debian.desktop
    echo "Type=Link" >> ~/Desktop/install-debian.desktop
    echo "Name=Install Debian" >> ~/Desktop/install-debian.desktop
    echo "Icon=install-debian" >> ~/Desktop/install-debian.desktop
    echo "URL=/usr/share/applications/install-debian.desktop" \
          >> ~/Desktop/install-debian.desktop
else
    cp /usr/share/applications/install-debian.desktop ~/Desktop
    # Xfce needs this executable otherwise it complains, everything
    # else doesn't seem to care either way.
    chmod +x ~/Desktop/install-debian.desktop
fi
