#!/bin/bash MCORE_LIBDIR="@@MCORE_LIBDIR@@" source @@SYSCONFDIR@@/mcore/mcore.conf source ${MCORE_LIBDIR}/include/common.global.class AUTOSTARTCONFDIR="${MCORE_CONFIG_PATH}/fluxbox/autostart" die() { echo "ERROR: $@"; exit 1; } # very basic getops for argv in $* do case $1 in --add|--del|--print) method="${1//--}" ;; --name) shift; name="$1" ;; --exec) shift; exec="$1" ;; --comment) shift; comment="$1" ;; esac shift done [[ -n ${method} ]] || die "No method given" case "${method}" in add) [[ -n ${name} ]] || die "No name given" [[ -n ${exec} ]] || die "No exec given" CONFIG="${MROOT}/${AUTOSTARTCONFDIR}/${name}" clearconfig addconfig "[startup] {${exec}}" ;; del) if [[ -n ${name} ]] then if [[ -f ${MROOT}/${AUTOSTARTCONFDIR}/${name} ]] then rm ${MROOT}/${AUTOSTARTCONFDIR}/"${name}" fi else # delete all items find ${MROOT}/${AUTOSTARTCONFDIR} -type f | xargs --no-run-if-empty rm fi ;; print) list_files_in_directory ${MROOT}/${AUTOSTARTCONFDIR} ;; esac