#!/usr/bin/bash
#
# Synchronize desktop starters
#
set -eu

source /etc/lmn/vm.conf
RSYNC_COMMAND=$(rsync -ai --delete --exclude=mimeinfo.cache \
	           --chown=root:root --chmod=F644,D755 "${DESKTOPSTARTERDIR}" \
		   /usr/local/share/applications/ | sed '/ \.\//d')
if [[ $? -eq 0 ]] && [[ -n "${RSYNC_COMMAND}" ]]; then
    echo "${RSYNC_COMMAND}"
    update-desktop-database /usr/local/share/applications
fi
