1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-25 09:34:11 +00:00
freebsd-ports/www/amphetadesk/files/wrapper.sh
Mario Sergio Fujikawa Ferreira ca7d54cfa7 o Take over maintainership on previous maintainers request
o Uphold hier(7)
o Add rc.d(8) rc.subr(8) script
o Fix several warnings
o Change default rss channels to BSD based ones:
  - http://www.freebsd.org/
  - http://www.freshports.org/
  - http://www.oreillynet.com/pub/au/73
  - http://bsdnews.com/
o Fetch an updated full channel list from the Internet if none
  previously exist
o Add fork(2)/exec(3) browser support with signal(3) SIGCHLD handling
o AmphetaDesk now allows per user configurations. Due to that, it
  now requires a user with a home directory so that. One can use
  the rc.d script to choose a user to launch AmphetaDesk from startup
  or just to run it normally from any user other than root
o Bump PORTREVISION

Approved by:	Kenneth Stailey <kstailey@yahoo.com> (previous maintainer)
2005-10-11 22:10:24 +00:00

62 lines
1.2 KiB
Bash

#!/bin/sh
#
# $FreeBSD$
#
# Under a BSDL license. Copyright 2005. Mario S F Ferreira <lioux@FreeBSD.org>
PREFIX="%%PREFIX%%/bin"
PROGRAM="${0}"
DIRNAME="${HOME}/.amphetadesk"
PERL="%%PERL%%"
DATADIR="%%DATADIR%%"
PROGRAM_PIDFILE="${PIDFILE:-${DIRNAME}/${PROGRAM##*/}.pid}"
if [ `id -un` = root ]; then
echo "PROBLEM. Running AmphetaDesk as root is not recommended."
exit 1
fi
if [ -z "${HOME}" -o ! -d "${HOME}" ]
then
echo "PROBLEM. User does not have a valid home directory [${HOME}]"
exit 1
fi
if [ ! -d "${DIRNAME}/data/lists" ]
then
mkdir -p "${DIRNAME}/data/lists"
fi
if [ ! -d "${DIRNAME}/data/lists" ]
then
echo "PROBLEM. Cannot create directory ${DIRNAME}."
echo "Make sure you have the proper permissions to create it and try again."
exit 1
else
ln -sf "${PREFIX}/${PROGRAM##*/}-real" "${DIRNAME}/${PROGRAM##*/}"
fi
#if [ -d "${DATADIR}/lists" ]; then
# cp -n "${DATADIR}/lists/"* "${DIRNAME}/data/lists"
#fi
echo " ${*} " | grep " \-createdironly " ||
{
echo "Running under ${DIRNAME}"
cd "${DIRNAME}" &&
{
{
env \
DIRNAME="${DIRNAME}" \
${PERL} "./${PROGRAM##*/}" "${@}" ;
} &
} &&
echo $! > "${PROGRAM_PIDFILE}" &&
exit 0 ||
{
echo "PROBLEM starting the application."
exit 1
}
}