From 56bd759df1d0c750a065b8c845e93d5dfa6b549d Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Sat, 8 Aug 2015 13:49:04 -0700 Subject: proj/gentoo: Initial commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson X-Thanks: Alec Warner - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring - wrote much python to improve cvs2svn X-Thanks: Rich Freeman - validation scripts X-Thanks: Patrick Lauer - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed --- net-misc/nstx/files/nstxcd.init | 104 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 net-misc/nstx/files/nstxcd.init (limited to 'net-misc/nstx/files/nstxcd.init') diff --git a/net-misc/nstx/files/nstxcd.init b/net-misc/nstx/files/nstxcd.init new file mode 100644 index 000000000000..7315c72f4b93 --- /dev/null +++ b/net-misc/nstx/files/nstxcd.init @@ -0,0 +1,104 @@ +#!/sbin/runscript +# Copyright 1999-2006 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# (Written by Phillip Berndt ) +# (Modified by Steven Brudenell ) +# $Id$ + +depend() { + local iface + + for iface in ${NEED_INTERFACES} ; do + need net.${iface} + done + + # If the user set TUNTAP_INTERFACE, they probably have a net script + # configuring that interface. nstxcd is responsible for actually creating + # the stupid thing, so we need to run before the config. + if [ ! -z ${TUNTAP_INTERFACE} ] ; then + if [ -x /etc/init.d/net.${TUNTAP_INTERFACE} ] ; then + before net.${TUNTAP_INTERFACE} + fi + fi +} + +loadtun() { + if [ ! -e /dev/net/tun ] + then + ebegin "Loading TUN/TAP kernel module" + modprobe -q tun + eend $? + fi + + if [ ! -e /dev/net/tun ] + then + eend 1 "Failed to load TUN driver! (did you compile your kernel with TUN/TAP support?)" + return 1 + fi + + return 0 +} + +checkconfig() { + if [ -z "${DOMAIN}" ] ; then + eerror "DOMAIN must be set" + return 1 + fi + + [ -z "${TUNTAP_INTERFACE}" ] || NSTXCD_OPTS="${NSTXCD_OPTS} -I ${TUNTAP_INTERFACE}" + [ -z "${TUNTAP_DEVICE}" ] || NSTXCD_OPTS="${NSTXCD_OPTS} -d ${TUNTAP_DEVICE}" + + case "${MODE}" in + TUN) + NSTXCD_OPTS="${NSTXCD_OPTS} -t" + ;; + TAP) + NSTXCD_OPTS="${NSTXCD_OPTS} -T" + ;; + *) + eerror "MODE must be either TUN or TAP" + return 1 + ;; + esac + + if [ -z "${DNS_SERVER}" ] ; then + DNS_SERVER=`awk '/^nameserver/{ print $2; exit; }' /etc/resolv.conf` + + if [ -z "${DNS_SERVER}" ] ; then + eerror "DNS_SERVER not set, and couldn't determine a nameserver from /etc/resolv.conf" + return 1 + fi + export DNS_SERVER + fi + + return 0 +} + +start() { + checkconfig || return 1 + + loadtun || return 1 + + ebegin "Starting nstxcd" + + start-stop-daemon \ + --start \ + --background \ + --make-pidfile \ + --exec /usr/sbin/nstxcd \ + --pidfile "/var/run/nstxcd.pid" \ + -- ${NSTXCD_OPTS} ${DOMAIN} ${DNS_SERVER} + + eend $? +} + +stop() { + ebegin "Stopping nstxcd" + + start-stop-daemon \ + --stop \ + --exec /usr/sbin/nstxcd \ + --pidfile "/var/run/nstxcd.pid" + + eend $? +} -- cgit v1.2.3-65-gdbad