# Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Id: $ DESCRIPTION="Manage \${EPREFIX}/Library/LaunchAgents to ~/Library/LaunchAgents symlinks" MAINTAINER="armando@goodship.net" SVN_DATE='$Date: $' VERSION=$(svn_date_to_version "${SVN_DATE}" ) EPLADIR=${EPREFIX}/Library/LaunchAgents LADIR=${HOME}/Library/LaunchAgents # enable describe_enable() { echo "symlink an installed launchd plist file to ${LADIR}" } describe_enable_parameters() { echo "" } describe_enable_options() { echo "name : name of launchd plist file to symlink" } do_enable() { NAME=${1/.plist} FILENAME=org.gentoo.${NAME}.plist [ -z "${1}" ] && die -q "no parameter specified" [ ! -f ${EPLADIR}/${FILENAME} ] && die -q "'$NAME' does not exist; cannot enable" mkdir -pv ${LADIR} ln -s ${EPLADIR}/${FILENAME} ${LADIR}/ launchctl load ${LADIR}/${FILENAME} } # disable describe_disable() { echo "un-symlink an installed launchd plist file from ${LADIR}" } describe_disable_parameters() { echo "" } describe_disable_options() { echo "name : name of launchd plist file to un-symlink" } do_disable() { NAME=${1/.plist} FILENAME=org.gentoo.${NAME}.plist [ -z "${1}" ] && die -q "no parameter specified" [ ! -L ${LADIR}/${FILENAME} ] && die -q "'${NAME}' is not enabled" launchctl unload ${LADIR}/${FILENAME} rm -f ${LADIR}/${FILENAME} } # list do_list() { [ ! -d ${EPLADIR} ] && echo "" && exit 0 for i in `ls -1 --color=never ${EPLADIR}/*.plist 2>/dev/null`; do name=`basename ${i/.plist}` echo -n ${name/org.gentoo.} echo -ne "\t" [ -f ${LADIR}/${name}.plist ] && echo "enabled" || echo "disabled" done }