4 Commits

Author SHA1 Message Date
Jay Larson
9730a62265 Corrected loopback device - will now set IP 2017-11-18 08:48:35 -06:00
Jay Larson
68281843d3 The following changes were made:
* Completely re-written as shell script
  * Modified documentation to better reflect reality
  * Removed the rather useless 'ifquery' tool
2017-11-05 11:34:59 -06:00
Jay Larson
53077da060 The following changes were made:
* Package now manages /etc/network.conf via usher
  * Added man page and ifup symlinks
  * Updated network init script
2017-05-16 14:36:54 -05:00
Jay Larson
e50782227d Added dependency for dhclient 2017-05-05 11:13:43 -05:00
8 changed files with 486 additions and 963 deletions

View File

@@ -8,7 +8,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
DEPENDS = iproute2,perl
DEPENDS = dhclient,iproute2
ARCH = none
URL =
BRIEF = Scripts for starting and stopping network interfaces
@@ -19,8 +19,8 @@ SNAPVER = 0
ARCHIVE :=
SRCDIR := $(PWD)/SRC/iftools
PATCHDIR := $(PWD)/SRC/patches
VERSION := $(shell grep 'VERSION\s*=>' SRC/iftools/ifup| \
cut -d "'" -f2)-$(SNAPVER)
VERSION := $(shell grep 'VERSION=' SRC/iftools/ifup| \
cut -d "=" -f2)-$(SNAPVER)
include /usr/share/snap/Makefile.snaplinux

20
SNAP/usher Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
set -e
case $1 in
preinst)
exit 0
;;
postinst)
if [ ! -f ${TARGET}/etc/network.conf ]; then
cp ${TARGET}/usr/share/iftools/network.conf ${TARGET}/etc/network.conf
fi
;;
prerm)
exit 0
;;
postrm)
exit 0
;;
esac

View File

@@ -3,8 +3,10 @@ dirs:
install -d -v -m 755 $(DESTDIR)/etc/network.d
install -d -v -m 755 $(DESTDIR)/usr/share/iftools
install -d -v -m 755 $(DESTDIR)/usr/share/man/man{5,8}
install -d -v -m 755 $(DESTDIR)/sbin
files:
install -v -m 755 ifup $(DESTDIR)/sbin/ifup
install -v -m 755 network.init $(DESTDIR)/etc/init.d/network
install -v -m 755 network.conf \
$(DESTDIR)/usr/share/iftools/network.conf
@@ -12,4 +14,10 @@ files:
$(DESTDIR)/usr/share/man/man5/network.conf.5
install -v -m 644 ifup.8 $(DESTDIR)/usr/share/man/man8/ifup.8
install: dirs files
links:
ln -s ifup.8 $(DESTDIR)/usr/share/man/man8/ifdown.8
ln -s ifup.8 $(DESTDIR)/usr/share/man/man8/ifreload.8
ln -s ifup $(DESTDIR)/sbin/ifdown
ln -s ifup $(DESTDIR)/sbin/ifreload
install: dirs files links

File diff suppressed because it is too large Load Diff

View File

@@ -5,30 +5,25 @@ ifup \- bring a network interface up
ifdown \- take a network interface down
.br
ifreload \- reload interface configuration
.br
ifquery \- view current state of interfaces
.SH SYNOPSIS
.B ifup
\f |
.B ifdown
\f |
.B ifreload
\f |
.B ifquery
\f <OPTIONS> <INTERFACES>
.SH DESCRIPTION
The
.BR ifup " and " ifdown
commands may be used to configure (or, respectively, deconfigure) network
commands may be used to configure, or deconfigure network
interfaces based on interface definitions in the file
.IR /etc/network.conf ". The"
.BR ifreload " command will perform an ifdown and ifup in one command."
.BR ifquery " may be used to display the running configuration."
.SH OPTIONS
A summary of options is included below.
.TP
.BR \-a ", " \-\-all
If given to \fBifup\fP, affect all interfaces marked \fBauto\fP.
.BR \-a
If given to \fBifup\fP, all interfaces marked \fBauto\fP are brought online.
Interfaces are brought up in the order in which they are defined
in
.IR /etc/network.conf .
@@ -36,17 +31,17 @@ If given to \fBifdown\fP, affect all defined interfaces.
Interfaces are brought down in the order in which they are
listed in the configuration files.
.TP
.BR \-h ", " \-\-help
.BR \-h
Show summary of options.
.TP
.BR \-n ", " \-\-no\-act
Don't configure any interfaces or run any "up" or "down" commands.
.BR \-n
Take no action, but output commands that would be executed.
.TP
.BR \-V ", " \-\-version
Show copyright and version information.
.BR \-v
Show configuration steps as they are taken.
.TP
.BR \-v ", " \-\-verbose
Show commands as they are executed.
.BR \-V
Show version information.
.SH EXAMPLES
.TP
.B ifup -a
@@ -62,25 +57,17 @@ Bring up interface
.TP
.B ifdown -a
Bring down all interfaces that are currently up.
.TP
.B ifquery eth0
Print the running configuration of eth0
.SH NOTES
.BR ifup ,
.BR ifdown ,
.BR ifreload ,
and
.BR ifquery
.BR ifreload
are actually the same program called by different names.
.P
The program does not configure network interfaces directly;
it runs low level utilities such as
.BR ip
to do its dirty work.
.P
When invoked a check will be performed to verify that there
are no other instances running. If another instance is
detected the program will exit with an error.
.SH FILES
.TP
.I /etc/network.conf
@@ -88,9 +75,6 @@ definitions of network interfaces
See
.BR network.conf (5)
for more information.
.TP
.I /run/network/ifstate
current state of network interfaces
.SH AUTHOR
iftools was written by Jay Larson <jlarson@snaplinux.org>. The functionality is loosely based on the ifupdown suite written by Anthony Towns <aj@azure.humbug.org.au>.
.SH SEE ALSO

View File

@@ -1,16 +1,4 @@
auto lo
iface lo inet loopback
# An example of an interface automatically started on boot with dhcp
#auto eth0
#iface eth0 inet dhcp
# Another example with a static IP and static route
#iface eth1 inet static
# address 192.168.0.202
# netmask 255.255.255.0
# gateway 192.168.0.1
# route 192.168.3.0 via 192.168.0.100
# This requests that all files in /etc/network.d be appended
source-directory network.d

View File

@@ -46,8 +46,8 @@ There can be multiple "auto" stanzas.
brings the named interfaces up in the order listed.
.P
Lines beginning with "source-directory" are used to source multiple
files at once. All non-dotted files within the directory are sourced
in lexical order.
files at once. All non-dotted files ending in .conf within the directory
are sourced in lexical order.
.P
When sourcing directories, if a path doesn't have a leading slash
it's considered relative to the directory containing the network.conf

View File

@@ -1,30 +1,30 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: $network
# Required-Start: $local_fs swap localnet
# Required-Stop: $local_fs swap localnet
# Required-Start: $local_fs swap
# Required-Stop: $local_fs swap
# Should-Start: $syslog
# Should-Stop: $syslog
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: Starts and configures network interfaces.
# Description: Starts and configures network interfaces.
# Short-Description: Start and configure network interfaces
# X-Required: true
### END INIT INFO
. /lib/lsb/init-functions
case "$1" in
start)
log_info_msg "Bringing up network interfaces"
log_init_msg "Bringing up network interfaces"
ifup -a && log_success_msg || log_failure_msg
;;
stop)
log_info_msg "Bringing down network interfaces"
log_init_msg "Bringing down network interfaces"
ifdown -a && log_success_msg || log_failure_msg
;;
reload|restart)
log_info_msg "Restarting network interfaced"
log_init_msg "Restarting network interfaces"
ifreload -a && log_success_msg || log_failure_msg
;;