Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to stable-rc-0.18 grimoire by Eric Sandall (f24d9219cfb1694322c0b7e0d23173a5bdfa7506)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Eric Sandall <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to stable-rc-0.18 grimoire by Eric Sandall (f24d9219cfb1694322c0b7e0d23173a5bdfa7506)
  • Date: Thu, 7 Feb 2008 12:39:12 -0600

GIT changes to stable-rc-0.18 grimoire by Eric Sandall
<sandalle AT sourcemage.org>:

ChangeLog | 3
net/ifupdown/BUILD | 2
net/ifupdown/DEPENDS | 7 -
net/ifupdown/DETAILS | 16 --
net/ifupdown/HISTORY | 3
net/ifupdown/INSTALL | 23 ---
net/ifupdown/PREPARE | 18 --
net/ifupdown/init.d/mountnetwork | 43 ------
net/ifupdown/init.d/mountnetwork.conf | 4
net/ifupdown/init.d/network | 44 ------
net/net-tools/DEPENDS | 5
net/net-tools/DETAILS | 2
net/net-tools/HISTORY | 11 -
net/net-tools/INSTALL | 10 +
net/net-tools/PREPARE | 27 ---
net/net-tools/UP_TRIGGERS | 3
net/net-tools/ifdown | 101 ++++++++++++++
net/net-tools/ifdown.8.gz |binary
net/net-tools/ifup | 227
+++++++++++++++++++++++++++++++++
net/net-tools/ifup.8.gz |binary
net/net-tools/init.d/dhcpcd.conf | 10 +
net/net-tools/init.d/mountnetwork | 43 ++++++
net/net-tools/init.d/mountnetwork.conf | 4
net/net-tools/init.d/network | 77 +++++++++++
24 files changed, 476 insertions(+), 207 deletions(-)

New commits:
commit f24d9219cfb1694322c0b7e0d23173a5bdfa7506
Author: Eric Sandall <sandalle AT sourcemage.org>
Commit: Eric Sandall <sandalle AT sourcemage.org>

Revert "I squished all this together because it is one atomic
transaction."

This reverts commit 63afd9ef5eff6fc4950294659119e3c21a73833b.

Conflicts:

ChangeLog

We don't want the new networking code in stable until it has soaked a bit
more

commit 8088a47996921cc90c1caca91e2e7652a8573597
Author: Eric Sandall <sandalle AT sourcemage.org>
Commit: Eric Sandall <sandalle AT sourcemage.org>

Revert "net-tools: removed unneeded netconf dep"

This reverts commit 17c7e40d86be6e4ff40949de76f4347f1feb0790.

We don't want the new networking code in stable yet. Let it soak a bit
more.

diff --git a/ChangeLog b/ChangeLog
index ff090bf..232b529 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,9 +7,6 @@
2008-02-02 Andraž "ruskie" Levstik <ruskie AT mages.ath.cx>
* ruby-raa/FUNCTIONS: minor fixups for rake

-2008-02-01 David Kowis <dkowis AT shlrm.org>
- * net/ifupdown: new spell, Much better networking config
-
2008-02-01 Alexander Tsamutali <astsmtl AT gmail.com>
* shell-term-fm/hotwire: new spell, an object-oriented hypershell

diff --git a/net/ifupdown/BUILD b/net/ifupdown/BUILD
deleted file mode 100755
index f5135ea..0000000
--- a/net/ifupdown/BUILD
+++ /dev/null
@@ -1,2 +0,0 @@
-make executables ifup.8.gz ifdown.8.gz interfaces.5.gz
-
diff --git a/net/ifupdown/DEPENDS b/net/ifupdown/DEPENDS
deleted file mode 100755
index e3c8a0d..0000000
--- a/net/ifupdown/DEPENDS
+++ /dev/null
@@ -1,7 +0,0 @@
-depends run-parts &&
-depends net-tools &&
-
-optional_depends "dhcpcd" "" "" "For DHCP support" &&
-optional_depends "wireless_tools" "" "" "For wireless configuration" &&
-optional_depends "wpa_supplicant" "" "" "For WPA wireless configuration"
-
diff --git a/net/ifupdown/DETAILS b/net/ifupdown/DETAILS
deleted file mode 100755
index e0f2520..0000000
--- a/net/ifupdown/DETAILS
+++ /dev/null
@@ -1,16 +0,0 @@
- SPELL=ifupdown
- VERSION=0.6.8
- SOURCE=${SPELL}_$VERSION.tar.gz
-SOURCE_DIRECTORY=$BUILD_DIRECTORY/$SPELL-$VERSION
- SOURCE_URL[0]=http://ftp.de.debian.org/debian/pool/main/i/ifupdown/$SOURCE
-
SOURCE_HASH=sha512:9842dce853b483e02cb2d0ca08d3fa66b42e9b7d37b9d86d2180e89835472260d1c2aeb445bf9cde274870c63584b0bd4d8035adf037cbb9ce167a522e1252df
- LICENSE[0]=GPL
- WEB_SITE=http://packages.debian.org/etch/ifupdown
- ENTERED=20080123
- KEYWORDS="tools net"
- SHORT="Interface control tools"
-cat << EOF
-This package provides the tools ifup and ifdown which may be used to
configure
-(or, respectively, deconfigure) network interfaces based on interface
-definitions in the file /etc/network/interfaces.
-EOF
diff --git a/net/ifupdown/HISTORY b/net/ifupdown/HISTORY
deleted file mode 100644
index 9bb0fe7..0000000
--- a/net/ifupdown/HISTORY
+++ /dev/null
@@ -1,3 +0,0 @@
-2008-01-30 David Kowis <dkowis AT shlrm.org>
- * DETAILS,BUILD,DEPENDS,PREPARE: Created this spell
-
diff --git a/net/ifupdown/INSTALL b/net/ifupdown/INSTALL
deleted file mode 100755
index d7a7916..0000000
--- a/net/ifupdown/INSTALL
+++ /dev/null
@@ -1,23 +0,0 @@
-# the makefile doesn't ln -sf so it might fail. so we destroy an easily
-# creatable symlink for safety
-if [ -h $INSTALL_ROOT/sbin/ifdown ]; then
- rm -f $INSTALL_ROOT/sbin/ifdown
-fi &&
-
-default_install &&
-
-# install the man pages to smart places
-cp *.8.gz $INSTALL_ROOT/usr/share/man/man8/. &&
-cp *.5.gz $INSTALL_ROOT/usr/share/man/man5/. &&
-
-# install the documentation type things
-mkdir -p $INSTALL_ROOT/usr/share/doc/$SPELL &&
-cp -va examples $INSTALL_ROOT/usr/share/doc/$SPELL/. &&
-
-# make the default directories
-mkdir -p /etc/network &&
-mkdir -p /etc/network/run &&
-mkdir -p /etc/network/if-post-down.d &&
-mkdir -p /etc/network/if-pre-up.d &&
-mkdir -p /etc/network/if-down.d &&
-mkdir -p /etc/network/if-up.d
diff --git a/net/ifupdown/PREPARE b/net/ifupdown/PREPARE
deleted file mode 100755
index c4840d1..0000000
--- a/net/ifupdown/PREPARE
+++ /dev/null
@@ -1,18 +0,0 @@
-persistent_add IFUPDOWNOKAY &&
-IFUPDOWNOKAY="n" &&
-if [ -f ${INSTALL_ROOT}/tmp/net-toolsNewInstall ] ; then
- IFUPDOWNOKAY="y" &&
- rm ${INSTALL_ROOT}/tmp/net-toolsNewInstall
-fi &&
-if ! spell_ok ifupdown ; then
- if [[ "$IFUPDOWNOKAY" != "y" ]] ; then
- if [ -x ${INSTALL_ROOT}/sbin/ifup ] ; then
- # spell net-tools is still installed at the old version :/
- message "${PROBLEM_COLOR}You have to upgrade net-tools first." &&
- message "This spell will overwrite /sbin/ifup and /sbin/ifdown." &&
- message "I've got to bail out right now, but I'm going to
pause.${DEFAULT_COLOR}" &&
- sleep 5 &&
- return 1
- fi
- fi
-fi
diff --git a/net/ifupdown/init.d/mountnetwork
b/net/ifupdown/init.d/mountnetwork
deleted file mode 100755
index 730529f..0000000
--- a/net/ifupdown/init.d/mountnetwork
+++ /dev/null
@@ -1,43 +0,0 @@
-#!/bin/bash
-
-. /etc/sysconfig/mountnetwork
-
-PROGRAM=/bin/false
-RUNLEVEL=3
-NEEDS="+network"
-PROVIDES="remote_fs"
-
-file_system_list=""
-
-for fs in ${FILESYSTEMS} ; do
- if [[ $fs == "nfs" ]] ; then
- NEEDS="$NEEDS +portmap"
- fi
- file_system_list="$file_system_list,$fs"
-done
-file_system_list=${file_system_list:1}
-
-. /etc/init.d/smgl_init
-
-start()
-{
- if [ "$file_system_list" != "" ] ; then
- required_executable /bin/mount
-
- echo "Mounting remote filesystems..."
- mount -a -F -t $file_system_list
- evaluate_retval
- fi
-}
-
-stop()
-{
- if [ "$file_system_list" != "" ] ; then
- required_executable /bin/umount
-
- echo "Unmounting remote filesystems..."
- umount -a -r -t $file_system_list
- evaluate_retval
- fi
-}
-
diff --git a/net/ifupdown/init.d/mountnetwork.conf
b/net/ifupdown/init.d/mountnetwork.conf
deleted file mode 100644
index 3211ca4..0000000
--- a/net/ifupdown/init.d/mountnetwork.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-# A space separated list of network file systems that are to be mounted at
-# boot. Supported values are "cifs", "nfs", "ncpfs", "smbfs" and "9p"
(without
-# the quotes). The /usr hierachy may be loaded through this script.
-FILESYSTEMS="cifs nfs ncpfs smbfs 9p"
diff --git a/net/ifupdown/init.d/network b/net/ifupdown/init.d/network
deleted file mode 100755
index 3bde6dc..0000000
--- a/net/ifupdown/init.d/network
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/bash
-
-PROGRAM=/bin/false # To get auto_init functionality
-RUNLEVEL=3
-PROVIDES=network
-
-[ "$USE_SYSLOG" = "yes" ] && NEEDS="+syslog"
-
-. /etc/init.d/smgl_init
-
-required_executable /sbin/ifup
-required_executable /sbin/ifdown
-
-start()
-{
- # make sure all the interfaces really do come up
- /sbin/ifup --force -a
-}
-
-stop()
-{
- /sbin/ifdown -a
-}
-
-restart()
-{
- echo "Shutting down ALL interfaces"
- stop
- # sleeping for some trickle time
- sleep 3
- start
-}
-
-status()
-{
- exit 0
-}
-
-reload() { exit 3; }
-
-usage()
-{
- echo "Usage: $0 {start|stop|restart|status} [DEVICE]"
-}
diff --git a/net/net-tools/DEPENDS b/net/net-tools/DEPENDS
index da0dbf3..6cfb39d 100755
--- a/net/net-tools/DEPENDS
+++ b/net/net-tools/DEPENDS
@@ -1,10 +1,13 @@
depends coreutils &&
depends gnupg &&
depends init.d &&
+depends netconf &&
depends smgl-fhs &&

#if [ "$DECNET" == "y" ]; then
# depends libdnet
#fi &&

-optional_depends "gettext" "" "" "for i18n internationalization support"
+optional_depends "gettext" "" "" "for i18n internationalization support"
&&
+optional_depends "dhcpcd" "" "" "For dhcp support (dynamic ip)"
&&
+optional_depends "wireless_tools" "" "" "For wifi support (iwconfig)"
diff --git a/net/net-tools/DETAILS b/net/net-tools/DETAILS
index 517f4a9..0104c66 100755
--- a/net/net-tools/DETAILS
+++ b/net/net-tools/DETAILS
@@ -4,7 +4,7 @@
SOURCE_DIRECTORY=$BUILD_DIRECTORY/$SPELL-$VERSION
SOURCE_URL[0]=http://www.tazenda.demon.co.uk/phil/net-tools/$SOURCE

SOURCE_HASH=sha512:8e1ae9bca726ad7d795a06c58388f9e11c1d617d94eebb9ed18bd11e5f34c6541e1ffe631706c407996db86e78df6e5cf1968a2d90b242b473596fda3b6d1eae
- PATCHLEVEL=11
+ PATCHLEVEL=10
LICENSE[0]=GPL
WEB_SITE=http://www.tazenda.demon.co.uk/phil/net-tools
ENTERED=20010922
diff --git a/net/net-tools/HISTORY b/net/net-tools/HISTORY
index 2c94fbe..7cd06df 100644
--- a/net/net-tools/HISTORY
+++ b/net/net-tools/HISTORY
@@ -1,13 +1,3 @@
-2008-02-03 Vlad Glagolev <stealth AT sourcemage.org>
- * DEPENDS: netconf is useless
-
-2008-01-30 David Kowis <dkowis AT shlrm.org>
- * DEPENDS: removed dependencies that aren't needed anymore
- * PREPARE: added to do all the magic for updating systems to the new
ifupdown
- * UP_TRIGGERS: makes ifupdown cast right after this one, but only the
first time
- * if*: removed all the ifupdown stuff
- * init.d: removed the initscripts
-
2008-01-28 Jaka Kranjc <lynxlynxlynx AT sourcemage.org>
* BUILD: removed is_depends_enabled.function reference

@@ -364,3 +354,4 @@
* DETAILS: Added MD5
* USEGCC2: Fixed Bug # 589 (builds fine with gcc3)
* HISTORY: Added HISTORY
+
diff --git a/net/net-tools/INSTALL b/net/net-tools/INSTALL
index 830a350..b76d745 100755
--- a/net/net-tools/INSTALL
+++ b/net/net-tools/INSTALL
@@ -1,2 +1,8 @@
-make_normal &&
-make BASEDIR=${INSTALL_ROOT}/ install
+make_normal &&
+make BASEDIR=${INSTALL_ROOT}/ install &&
+install -m 755 $SCRIPT_DIRECTORY/ifup ${INSTALL_ROOT}/sbin &&
+install -m 755 $SCRIPT_DIRECTORY/ifdown ${INSTALL_ROOT}/sbin &&
+install -m 755 $SCRIPT_DIRECTORY/ifup.8.gz \
+ ${INSTALL_ROOT}/usr/share/man/man8/ &&
+install -m 755 $SCRIPT_DIRECTORY/ifdown.8.gz \
+ ${INSTALL_ROOT}/usr/share/man/man8/
diff --git a/net/net-tools/PREPARE b/net/net-tools/PREPARE
deleted file mode 100755
index a170d4a..0000000
--- a/net/net-tools/PREPARE
+++ /dev/null
@@ -1,27 +0,0 @@
-persistent_add NETTOOLSHASTIME &&
-persistent_add NETTOOLSNEW &&
-if ! spell_ok ifupdown ; then
- NETTOOLSNEW="y" &&
- # Have to cheat to get a config option over into ifupdown
- touch ${INSTALL_ROOT}/tmp/net-toolsNewInstall &&
- # end cheat
- unset NETTOOLSHASTIME &&
- message "${PROBLEM_COLOR}This is a significant change to the way
networking works" &&
- message "You will have to build an /etc/network/interfaces file."
&&
- message "Its the same system that debian uses, so it's well documented."
&&
- message "Installing the spell won't break your current network
connections." &&
- message "But if you reboot, no network connections will come up."
&&
- message "Because of this, you must say y to the following question, or
this" &&
- message "spell will not install."
&&
- message "Right after casting this spell, you need to cast
ifupdown.${DEFAULT_COLOR}" &&
- config_query NETTOOLSHASTIME "Do you have time to configure your nifty new
networking?" n &&
-
- if [[ "$NETTOOLSHASTIME" != "y" ]]; then
- rm ${INSTALL_ROOT}/tmp/net-toolsNewInstall &&
- return 1
- fi
-else
- NETTOOLSHASTIME="y" &&
- NETTOOLSNEW="n"
-fi
-
diff --git a/net/net-tools/UP_TRIGGERS b/net/net-tools/UP_TRIGGERS
deleted file mode 100755
index 27c59e7..0000000
--- a/net/net-tools/UP_TRIGGERS
+++ /dev/null
@@ -1,3 +0,0 @@
-if [[ "$NETTOOLSNEW" == "y" ]]; then
- up_trigger ifupdown cast_self
-fi
diff --git a/net/net-tools/ifdown b/net/net-tools/ifdown
new file mode 100644
index 0000000..1917cf7
--- /dev/null
+++ b/net/net-tools/ifdown
@@ -0,0 +1,101 @@
+#!/bin/bash
+
+# $1 - needle
+exists_in_text()
+{
+ [ "$1" = "" ] && return 0
+
+ IFS="
+"
+
+ for x in $( cat ) ; do
+ [ "$1" = "$x" ] && return 0
+ done
+
+ return 1
+}
+
+_set_bridge()
+{
+ for port in "$@"
+ do
+ brctl delif $DEV $port
+ ifconfig $port 0.0.0.0 down
+ done
+}
+
+_do_device_down()
+{
+ [[ -n "$BRIDGE_PORTS" ]] && _set_bridge $BRIDGE_PORTS
+ if [[ "$MODE" =~ ^dynamic ]]; then
+ echo "Stopping dhcpcd on $DEV ..."
+ dhcpcd -k $DEV &&
+ sleep 2
+ fi
+ echo "Shutting down network interface $DEV ..."
+ ifconfig $DEV 0.0.0.0 down
+ [[ -n "$BRIDGE_PORTS" ]] && brctl delbr $DEV
+}
+
+_do_route_down()
+{
+ true
+}
+
+_on_down()
+{
+ true
+}
+
+# Handles function "overloading"
+run_func() {
+ # If for example do_route_up exists then run it, otherwise run _do_route_up
+ if [ "$( type -t $1 )" = function ] ; then
+ $1
+ else
+ _$1
+ fi
+}
+
+netdevdir=/etc/sysconfig/network
+
+#change this if your .pid file hides somewhere else
+DHCPCD_PATH="/var/run/dhcpcd-"
+DEV=$1
+
+if [ -z $DEV ]; then
+ echo "Usage: ifdown <device>"
+ exit 2
+fi
+
+if [ ! -f $netdevdir/$DEV.dev ]; then
+ echo "$DEV: no such network device"
+ exit 1
+fi
+
+if ! /sbin/ifconfig -a 2>&1 | exists_in_text $DEV ; then
+ echo "$DEV already down"
+ exit 0
+fi
+
+unset MODE MODULE IP BROADCAST NETMASK GATEWAY POINTTOPOINT MTU WIFI
+unset do_device_down do_route_down on_down
+
+. $netdevdir/$DEV.dev
+
+if [ -z "$MODE" ]; then
+ echo "There are errors in $netdevdir/$DEV.dev"
+ exit 1
+fi
+
+run_func do_device_down &&
+run_func do_route_down &&
+
+# only do this if network device is a module
+# sort needed to ensure unique lsmod module name (often 2x entries in table)
+if [ "$MODULE" ] && /sbin/lsmod | exists_in_text "$MODULE" ; then
+ echo "Unloading module $MODULE for $DEV ..."
+ modprobe -r $MODULE
+fi &&
+
+run_func on_down
diff --git a/net/net-tools/ifdown.8.gz b/net/net-tools/ifdown.8.gz
new file mode 100644
index 0000000..37fbdde
Binary files /dev/null and b/net/net-tools/ifdown.8.gz differ
diff --git a/net/net-tools/ifup b/net/net-tools/ifup
new file mode 100644
index 0000000..fba1147
--- /dev/null
+++ b/net/net-tools/ifup
@@ -0,0 +1,227 @@
+#!/bin/bash
+
+# $1 - needle
+exists_in_text()
+{
+ [ "$1" = "" ] && return 0
+
+ IFS="
+"
+
+ for x in $( cat ) ; do
+ [ "$1" = "$x" ] && return 0
+ done
+
+ return 1
+}
+
+# $1 - device name
+device_is_up()
+{
+ if [ -x /usr/bin/grep ]; then
+ /sbin/ifconfig ${1} | grep -q "UP"
+ else
+ /sbin/ifconfig ${1} 2>&1 | exists_in_text "UP"
+ fi
+}
+
+# $* - parameters for iwconfig, except device name
+# to be called from _do_device_up
+_set_wlan()
+{
+ iwconfig $DEV $* &&
+ IWC="$IWC $*"
+}
+
+_set_bridge()
+{
+ # if the bridge doesn't exist add it
+ if ! brctl show | grep $DEV
+ then
+ brctl addbr $DEV
+ fi
+ for port in "$@"
+ do
+ if ! brctl show $DEV | grep $port
+ then
+ brctl addif $DEV $port
+ fi &&
+ ifconfig $port 0.0.0.0 promisc up
+ done
+}
+
+_do_device_up()
+{
+ # collect settings for iwconfig
+ local IWC=
+ [[ -n "$WIFI_NWID" ]] && _set_wlan nwid $WIFI_NWID
+ [[ -n "$WIFI_ESSID" ]] && _set_wlan essid $WIFI_ESSID
+ [[ -n "$WIFI_RATE" ]] && _set_wlan rate $WIFI_RATE
+ [[ -n "$WIFI_MODE" ]] && _set_wlan mode $WIFI_MODE
+ [[ -n "$WIFI_KEY1" ]] && _set_wlan key $WIFI_KEY1 '[1]'
+ [[ -n "$WIFI_KEY2" ]] && _set_wlan key $WIFI_KEY2 '[2]'
+ [[ -n "$WIFI_KEY3" ]] && _set_wlan key $WIFI_KEY3 '[3]'
+ [[ -n "$WIFI_KEY4" ]] && _set_wlan key $WIFI_KEY4 '[4]'
+ [[ -n "$WIFI_DEFAULTKEY" ]] && _set_wlan key "[$WIFI_DEFAULTKEY]"
+ [[ -n "$WIFI_SECMODE" ]] && _set_wlan key $WIFI_SECMODE
+ [[ -n "$WIFI_KEY" ]] && _set_wlan key $WIFI_KEY
+ [[ -n "$BRIDGE_PORTS" ]] && _set_bridge $BRIDGE_PORTS
+
+ # make sure the wifi settings are applied if any of them are present
+ [[ -n "$IWC" ]] && iwconfig $DEV commit && sleep 2
+
+ case "$MODE" in
+ dynamic )
+ sed -i 's/MODE=.*/MODE=dynamic_set_hostname/' $netdevdir/$DEV.dev &&
+ echo "Fixed error in $DEV.dev"
+ . /etc/sysconfig/dhcpcd
+ ARGS="-h $HOSTNAME"
+
+ echo "Starting dhcpcd on $DEV ..."
+ if [ -e $DHCPCD_PATH$DEV.pid ]; then
+ dhcpcPid=`cat $DHCPCD_PATH$DEV.pid`
+ dhcpcd -k $DEV 1>/dev/null 2>&1 &&
+ renice 10 $dhcpcPid 1>/dev/null 2>&1 || rm -f $DHCPCD_PATH$DEV.pid &&
+ sleep 1
+ fi &&
+ dhcpcd -t $TIMEOUT $ARGS $OPTIONS $DEV
+ ;;
+ dynamic_set_hostname )
+ . /etc/sysconfig/dhcpcd
+ ARGS="-h $HOSTNAME"
+
+ echo "Starting dhcpcd on $DEV ..."
+ if [ -e $DHCPCD_PATH$DEV.pid ]; then
+ dhcpcPid=`cat $DHCPCD_PATH$DEV.pid`
+ dhcpcd -k $DEV 1>/dev/null 2>&1 &&
+ renice 10 $dhcpcPid 1>/dev/null 2>&1 || rm -f $DHCPCD_PATH$DEV.pid &&
+ sleep 1
+ fi &&
+ dhcpcd -t $TIMEOUT $ARGS $OPTIONS $DEV
+ ;;
+ dynamic_get_hostname )
+ . /etc/sysconfig/dhcpcd
+ ARGS="-H"
+
+ echo "Starting dhcpcd on $DEV ..."
+ if [ -e $DHCPCD_PATH$DEV.pid ]; then
+ dhcpcPid=`cat $DHCPCD_PATH$DEV.pid`
+ dhcpcd -k $DEV 1>/dev/null 2>&1 &&
+ renice 10 $dhcpcPid 1>/dev/null 2>&1 || rm -f $DHCPCD_PATH$DEV.pid &&
+ sleep 1
+ fi &&
+ dhcpcd -t $TIMEOUT $ARGS $OPTIONS $DEV
+ ;;
+ static )
+ echo "Setting up static networking on $DEV..."
+ ARGS=""
+ if [ "$POINTOPOINT" != "" ] ; then
+ ARGS="$ARGS pointopoint $POINTOPOINT"
+ fi
+ if [ "$MTU" != "" ] ; then
+ ARGS="$ARGS mtu $MTU"
+ fi
+
+ ifconfig $DEV $IP broadcast $BROADCAST netmask $NETMASK $ARGS
+ ;;
+ * )
+ echo "There are errors in $netdevdir/$DEV.dev"
+ exit 1
+ ;;
+ esac
+}
+
+_do_route_up()
+{
+ # check if GATEWAY is set; gateway is set by PPP or other software in some
+ # cases
+ if [ "$GATEWAY" ]; then
+ route add default gw $GATEWAY dev $DEV
+ fi
+}
+
+_on_up()
+{
+ true
+}
+
+# Handles function "overloading"
+run_func() {
+ # If for example do_route_up exists then run it, otherwise run _do_route_up
+ if [ "$( type -t $1 )" = function ] ; then
+ $1
+ else
+ _$1
+ fi
+}
+
+netdevdir=/etc/sysconfig/network
+
+#change this if your .pid file hides somewhere else
+DHCPCD_PATH="/var/run/dhcpcd-"
+DEV=$1
+
+if [ -z $DEV ]; then
+ echo "Usage: ifup <device>"
+ exit 2
+fi
+
+if [ ! -f $netdevdir/$DEV.dev ]; then
+ echo "$DEV: no such network device"
+ exit 1
+fi
+
+if device_is_up $DEV ; then
+ echo "$DEV already up"
+ exit 0
+fi
+
+unset MODE MODULE IP BROADCAST NETMASK GATEWAY POINTOPOINT MTU UP_ON_BOOT
MAC NEEDS
+unset WIFI_NWID WIFI_ESSID WIFI_RATE WIFI_MODE WIFI_SECMODE WIFI_ENCKEY
+unset do_device_up do_route_up on_up
+
+. $netdevdir/$DEV.dev
+
+for needed_device in ${NEEDS}; do
+ echo -n "Checking if $needed_device is up... "
+ if ( ifconfig | grep -q $needed_device ); then
+ echo "yes it is" ;
+ else
+ echo "NO, it's not! Aborting!"
+ exit 1 ;
+ fi
+done
+
+if [ -z "$MODE" ]; then
+ echo "There are errors in $netdevdir/$DEV.dev"
+ exit 1
+fi
+
+if [ "${_OBEY_UP_ON_BOOT}" = 1 -a "$UP_ON_BOOT" = no ] ; then
+ exit 0
+fi
+
+if [ "$MODULE" ] && ! /sbin/lsmod | exists_in_text "$MODULE" ; then
+ echo "Loading module $MODULE for $DEV ..."
+ modprobe $MODULE
+fi &&
+
+if [ "$WIFI" ]; then
+ echo "Configuring wifi for $DEV ..."
+ sleep 1 # to give the card time to start, needed on some cards.
+ iwconfig $DEV ${WIFI}
+fi &&
+
+if [ "$MAC" ]; then
+ echo "Setting custom MAC address for $DEV ..."
+ if ( ifconfig $DEV | grep -q Ethernet ); then
+ ifconfig $DEV hw ether $MAC
+ echo "Custom MAC set for device $DEV";
+ else
+ echo "Can't set custom MAC for non-ethernet device $DEV";
+ fi
+fi
+
+run_func do_device_up
+run_func do_route_up
+run_func on_up
diff --git a/net/net-tools/ifup.8.gz b/net/net-tools/ifup.8.gz
new file mode 100644
index 0000000..ae72c22
Binary files /dev/null and b/net/net-tools/ifup.8.gz differ
diff --git a/net/net-tools/init.d/dhcpcd.conf
b/net/net-tools/init.d/dhcpcd.conf
new file mode 100644
index 0000000..368cbc9
--- /dev/null
+++ b/net/net-tools/init.d/dhcpcd.conf
@@ -0,0 +1,10 @@
+# How many seconds should dhcpcd wait for an IP address?
+TIMEOUT=30
+
+# Set this variable to yes if you wish dhcpcd to use syslog for logging.
+USE_SYSLOG=no
+
+# Any command line options that should be passed to dhcpcd when it is
started.
+# Example usage: OPTIONS="-d -h $( hostname )"
+# See the manual page for dhcpcd for more information.
+OPTIONS=
diff --git a/net/net-tools/init.d/mountnetwork
b/net/net-tools/init.d/mountnetwork
new file mode 100755
index 0000000..730529f
--- /dev/null
+++ b/net/net-tools/init.d/mountnetwork
@@ -0,0 +1,43 @@
+#!/bin/bash
+
+. /etc/sysconfig/mountnetwork
+
+PROGRAM=/bin/false
+RUNLEVEL=3
+NEEDS="+network"
+PROVIDES="remote_fs"
+
+file_system_list=""
+
+for fs in ${FILESYSTEMS} ; do
+ if [[ $fs == "nfs" ]] ; then
+ NEEDS="$NEEDS +portmap"
+ fi
+ file_system_list="$file_system_list,$fs"
+done
+file_system_list=${file_system_list:1}
+
+. /etc/init.d/smgl_init
+
+start()
+{
+ if [ "$file_system_list" != "" ] ; then
+ required_executable /bin/mount
+
+ echo "Mounting remote filesystems..."
+ mount -a -F -t $file_system_list
+ evaluate_retval
+ fi
+}
+
+stop()
+{
+ if [ "$file_system_list" != "" ] ; then
+ required_executable /bin/umount
+
+ echo "Unmounting remote filesystems..."
+ umount -a -r -t $file_system_list
+ evaluate_retval
+ fi
+}
+
diff --git a/net/net-tools/init.d/mountnetwork.conf
b/net/net-tools/init.d/mountnetwork.conf
new file mode 100644
index 0000000..3211ca4
--- /dev/null
+++ b/net/net-tools/init.d/mountnetwork.conf
@@ -0,0 +1,4 @@
+# A space separated list of network file systems that are to be mounted at
+# boot. Supported values are "cifs", "nfs", "ncpfs", "smbfs" and "9p"
(without
+# the quotes). The /usr hierachy may be loaded through this script.
+FILESYSTEMS="cifs nfs ncpfs smbfs 9p"
diff --git a/net/net-tools/init.d/network b/net/net-tools/init.d/network
new file mode 100755
index 0000000..bdfc2b2
--- /dev/null
+++ b/net/net-tools/init.d/network
@@ -0,0 +1,77 @@
+#!/bin/bash
+
+. /etc/sysconfig/dhcpcd
+
+PROGRAM=/bin/false # To get auto_init functionality
+RUNLEVEL=3
+PROVIDES=network
+
+[ "$USE_SYSLOG" = "yes" ] && NEEDS="+syslog"
+
+. /etc/init.d/smgl_init
+
+required_executable /sbin/ifconfig
+required_executable /sbin/route
+required_executable /sbin/modprobe
+
+netdevdir=/etc/sysconfig/network
+
+# this provides you with the ability to start/stop/check status on
+# one or more cards if you so desire.
+
+if [ "$#" -le 1 ]; then
+ devices="$(ls $netdevdir | grep dev$ | cut -d. -f1)"
+else
+ devices="$(builtin echo $@ | sed s/$1//)"
+fi
+
+start()
+{
+ required_executable /sbin/ifup
+
+ export _OBEY_UP_ON_BOOT=1
+ for DEVICE in $devices ; do
+ [ "$DEVICE" = "lo" ] && continue
+ echo "$(unset -f echo; /sbin/ifup $DEVICE)"
+ evaluate_retval
+ done
+ unset _OBEY_UP_ON_BOOT
+}
+
+stop()
+{
+ required_executable /sbin/ifdown
+
+ for DEVICE in $devices ; do
+ [ "$DEVICE" = "lo" ] && continue
+ echo "$(unset -f echo; /sbin/ifdown $DEVICE)"
+ evaluate_retval
+ done
+}
+
+status()
+{
+ for DEVICE in $devices ; do
+ unset MODE on_status
+
+ . $netdevdir/$DEVICE.dev
+
+ if [ "$( type -t do_status )" = function ] ; then
+ do_status # If on_status is defined in the device file
+ elif [ -z "$MODE" ] ; then
+ echo " There are errors in $netdevdir/$DEVICE.dev"
+ else
+ if [ "$MODE" = dynamic ]; then
+ statusproc dhcpcd
+ fi
+ ifconfig $DEVICE
+ fi
+ done
+}
+
+reload() { exit 3; }
+
+usage()
+{
+ echo "Usage: $0 {start|stop|restart|status} [DEVICE]"
+}



  • [SM-Commit] GIT changes to stable-rc-0.18 grimoire by Eric Sandall (f24d9219cfb1694322c0b7e0d23173a5bdfa7506), Eric Sandall, 02/07/2008

Archive powered by MHonArc 2.6.24.

Top of Page