#!/usr/bin/env bash
echo "Does not build: libupnp-dev missing the upnp/LinkedList.h, libupnp6-dev has it."
exit 1

apt install -y djmount

DEST=${1:-/etc/skel}
DJMOUNT_DIR=${DEST}/dlna
mkdir -p ${DJMOUNT_DIR}

mkdir -p ${DEST}/.config/autostart
bash -c "cat > ${DEST}/.config/autostart/djmount.desktop" <<EOF
[Desktop Entry]
Encoding=UTF-8
Version=0.71
Type=Application
Name=djmount
Comment=UPNP/DLNA mount 
Exec=sh -c "/usr/bin/djmount ${DJMOUNT_DIR}"
StartupNotify=false
Terminal=false
Hidden=false
EOF
chmod +x ${DEST}/.config/autostart/djmount.desktop

bash -c "cat > /usr/share/applications/djmount.desktop" <<'EOF'
[Desktop Entry]
Encoding=UTF-8
Version=0.71
Type=Application
Name=djmount
Comment=UPNP/DLNA 
Exec=sh -c "/usr/bin/djmount ${HOME}"
StartupNotify=false
Terminal=false
Hidden=false
EOF
#chmod +x /usr/share/applications/djmount.desktop

mkdir -p ${DEST}/.local/share/applications
bash -c "cat > ${DEST}/.local/share/applications/djmount.desktop"  <<EOF
[Desktop Entry]
Encoding=UTF-8
Version=0.71
Type=Application
Name=djmount
Comment=UPNP/DLNA 
Exec=sh -c "/usr/bin/djmount ${DJMOUNT_DIR}"
StartupNotify=false
Terminal=false
Hidden=false
EOF
chmod +x ${DEST}/.local/share/applications/djmount.desktop

