#!/bin/sh

## (c) 2014 Frédéric Gaudet. Based on :
## live-config(7) - System Configuration Scripts
## Copyright (C) 2006-2013 Daniel Baumann <daniel@debian.org>
##
## Copyright (C) 2017 Paweł Pijanowski <pavroo@onet.eu>
##
## This program comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
## This is free software, and you are welcome to redistribute it
## under certain conditions; see COPYING for details.

Calamares_icon ()
{
    if [ -e /usr/share/applications/calamares.desktop ]; then
        if [ ! -e /home/${LIVE_USERNAME}/Desktop ]; then
            mkdir -p /home/${LIVE_USERNAME}/Desktop                
        fi
        cp /usr/share/applications/calamares.desktop /home/${LIVE_USERNAME}/Desktop/calamares.desktop
        chmod 755 /home/${LIVE_USERNAME}/Desktop/calamares.desktop
        chown ${LIVE_USERNAME}:${LIVE_USERNAME} "/home/${LIVE_USERNAME}/Desktop" -R        
    fi
    
    # Creating state file
    touch /var/lib/live/config/calamares-icon
}

Calamares_icon
