ACC SHELL

Path : /etc/sysconfig/network/scripts/
File Upload :
Current File : //etc/sysconfig/network/scripts/ifup-skel

#! /bin/bash
#
# Copyright (c) 2002-2006 SuSE Linux AG Nuernberg, Germany.
# Copyright (c) 2007-2008 SUSE LINUX Products GmbH, Germany.
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc., 59 Temple
# Place, Suite 330, Boston, MA 02111-1307 USA
#
# Authors: Michal Svec <msvec@suse.cz>
#          Christian Zoz <zoz@suse.de>
#          Marius Tomaschewski <mt@suse.de>
#
# $Id$
#

unset POSIXLY_CORRECT ; set +o posix # we're using non-posix bash features

usage () {
	echo $@
	echo ""
	echo "This is a skeleton for additional if{up,down,status}-* scripts."
	echo " !!! PLEASE MODIFY/REMOVE THESE LINES IN YOUR FINAL SCRIPT !!!"
	echo ""
	#	^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
	echo "Usage: if{up,down,status}-..... [<config>] <interface> [-o <options>]"
	echo ""
	echo "Options are:"
	echo "    [on]boot : we are currently booting (or shutting down)"
	echo "    hotplug  : we are handling a hotplug event"
	echo "    auto     : alias for onboot"
	echo "    debug    : be verbose"
	echo ""
	echo "All other or wrong options are silently ignored."
	echo ""
	exit $R_USAGE
}

######################################################################
# change the working direcory and source some common files
#
R_INTERNAL=1      # internal error, e.g. no config or missing scripts
cd /etc/sysconfig/network || exit $R_INTERNAL
test -f ./config && . ./config
test -f scripts/functions && . scripts/functions || exit $R_INTERNAL

######################################################################
# check arguments and how we are called (in case of links)
#
SCRIPTNAME=${0##*/}
debug $*
ACTION=${SCRIPTNAME#if}
ACTION=${ACTION%%-*}
case "${ACTION}" in
	up|status|down|check) ;;
	*) usage
esac
case "$1" in ""|-h|*help*) usage; esac
CONFIG=$1
shift
if [ -n "$1" -a "$1" != "-o" ] ; then
	INTERFACE=$1
else
	INTERFACE=$CONFIG
fi
shift
test "$1" = "-o" && shift
OPTIONS="$@"
MODE=manual
while [ $# -gt 0 ]; do
	case $1 in
		boot|onboot) MODE=auto ;;
		hotplug)     MODE=auto ;;
		auto)        MODE=auto ;;
		quiet)       be_quiet_has_gone ;;
		debug)       DEBUG=yes ;;
		*)           debug unknown option $1 ;;
	esac
	shift
done

######################################################################
# get the interface and check if it is available or up
#
# if ! is_iface_available  $INTERFACE ; then
# 	logerror "interface ${INTERFACE} is not available"
# 	exit $R_NODEV
# fi
# if ! is_iface_up $INTERFACE ; then
# 	logerror "interface ${INTERFACE} is not up"
# 	exit $R_NOTRUNNING
# fi

######################################################################
# check presence of configuration file and source it
#
if [ -f ifcfg-$CONFIG ] ; then
	. ifcfg-$CONFIG
else
	message "could not find configuration file ifcfg-$CONFIG"
fi

######################################################################
# Check needed tools
#


######################################################################
# now do what has to be done
#
RETVAL=$R_SUCCESS
case $ACTION in
	up)
		: do ifup job
	;;
	down)
		: do ifdown job
	;;
	status)
		: do status job
	;;
	check)
		: do check job
	;;
esac

exit $RETVAL

ACC SHELL 2018