Репозиторий Sisyphus
Последнее обновление: 27 ноября 2022 | Пакетов: 17929 | Посещений: 25410294
en ru br
Репозитории ALT
S:3.1.13-alt1
5.1: 2.0.5-alt1
4.1: 2.0.3-alt9
4.0: 2.0.3-alt6
www.altlinux.org/Changes

Группа :: Сети/Прочее
Пакет: netatalk

 Главная   Изменения   Спек   Патчи   Исходники   Загрузить   Gear   Bugs and FR  Repocop 

#! /bin/sh
# chkconfig: 345 91 35
# description: This package enables Linux to talk to Macintosh
# computers via the AppleTalk networking protocol and
# provides printer, file sharing, and AppleTalk routing
# services.
#
# AppleTalk daemons. Make sure not to start atalkd in the background:
# its data structures must have time to stablize before running the
# other processes.

WITHOUT_RC_COMPAT=1

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
SourceIfNotEmpty /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

ATALK_CONF=/etc/netatalk/netatalk.conf
# test for and read in netatalk configuration
[ -f ${ATALK_CONF} ] || exit 0
. ${ATALK_CONF}

ATALKD=/usr/sbin/atalkd
AFPD=/usr/sbin/afpd
PAPD=/usr/sbin/papd
CNID_METAD=/usr/sbin/cnid_metad
NBPREG=/usr/bin/nbprgstr
NBPUNREG=/usr/bin/nbpunrgstr
LOCKFILE=/var/lock/subsys/atalk

[ -x ${ATALKD} -a -x ${AFPD} -a -x ${PAPD} -a -x ${CNID_METAD} -a -x ${NBPREG} -a -x ${NBPUNREG} ] || exit 0

# Quickly probe for appletalk and warn if we can't find it
if [ ! -f /proc/net/appletalk ]; then
/sbin/modprobe appletalk || echo "[could not load appletalk module]"
fi

# Check for IP Encapsulation support
#/sbin/modprobe ipddp || echo "[could not load IP encapsulation]"

# initialize return values
RETVAL=1
RETVAL_ATALKD=0
RETVAL_PAPD=0
RETVAL_CNID_METAD=0
RETVAL_AFPD=0

# startup code for everything
atalk_startup() {
if [ x"${ATALKD_RUN}" != x"no" ]; then
start_daemon ${ATALKD}
RETVAL_ATALKD=$?

action "Registering ${ATALK_NAME}:Workstation${ATALK_ZONE}:" ${NBPREG} -p 4 \"${ATALK_NAME}:Workstation${ATALK_ZONE}\"
action "Registering ${ATALK_NAME}:netatalk${ATALK_ZONE}:" ${NBPREG} -p 4 \"${ATALK_NAME}:netatalk${ATALK_ZONE}\"

if [ x"${PAPD_RUN}" = x"yes" ]; then
start_daemon ${PAPD}
RETVAL_PAPD=$?
fi
fi

if [ x"${AFPD_RUN}" = x"yes" ] ; then
start_daemon ${AFPD} ${AFPD_UAMLIST} -g ${AFPD_GUEST} \
-c ${AFPD_MAX_CLIENTS} -n \"${ATALK_NAME}${ATALK_ZONE}\"
RETVAL_AFPD=$?
fi

if [ x"${CNID_METAD_RUN}" = x"yes" ] ; then
start_daemon ${CNID_METAD}
RETVAL_CNID_METAD=$?
fi

if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_AFPD -eq 0 -a $RETVAL_CNID_METAD -eq 0 ]; then
RETVAL=0
touch ${LOCKFILE} || RETVAL=1
fi
}

case "$1" in
'start')
echo -n 'Starting AppleTalk services: '
if [ x"${ATALK_BGROUND}" = x"yes" ]; then
echo -n "(backgrounded)"
atalk_startup >& /dev/null &
RETVAL=0
else
echo
atalk_startup
fi
echo
;;
'stop'|'condstop')
echo 'Shutting down AppleTalk services: '
if [ x"${ATALKD_RUN}" != x"no" ]; then
if [ x"${PAPD_RUN}" = x"yes" ]; then
stop_daemon ${PAPD}
RETVAL_PAPD=$?
fi

action "Unregistering ${ATALK_NAME}:Workstation${ATALK_ZONE}:" ${NBPUNREG} \"${ATALK_NAME}:Workstation${ATALK_ZONE}\"
action "Unregistering ${ATALK_NAME}:netatalk${ATALK_ZONE}:" ${NBPUNREG} \"${ATALK_NAME}:netatalk${ATALK_ZONE}\"

# kill atalkd last, since without it the plumbing goes away.
stop_daemon ${ATALKD}
RETVAL_ATALKD=$?
fi

# kill this separately as we also do AFP/tcp
if [ x"${AFPD_RUN}" = x"yes" ]; then
stop_daemon ${AFPD}
RETVAL_AFPD=$?
fi

if [ x"${CNID_METAD_RUN}" = x"yes" ]; then
stop_daemon ${CNID_METAD}
RETVAL_CNID_METAD=$?
fi

if [ $RETVAL_ATALKD -eq 0 -a $RETVAL_PAPD -eq 0 -a $RETVAL_AFPD -eq 0 -a $RETVAL_CNID_METAD -eq 0 ] ; then
RETVAL=0
rm -f ${LOCKFILE} || RETVAL=1
fi
echo ""
;;
'restart'|'reload'|'condrestart')
$0 stop
$0 start
RETVAL=$?
;;
'status')
status atalkd
RETVAL=$?
;;
*)
echo "Usage: atalk {start|stop|restart|status}"
exit 1
esac

exit $RETVAL
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin