Browse Source

indent,

manutest: remove ifconfig call since it doesn't behave as I thought it did

r308
master
David Whedon 22 years ago
parent
commit
0e59d85796
  1. 2
      Makefile
  2. 18
      README
  3. 2
      debian/control
  4. 3
      debian/menutest-common
  5. 2
      debian/netcfg-dhcp.dirs
  6. 2
      debian/netcfg-static.dirs
  7. 15
      debian/rules
  8. 24
      netcfg.c
  9. 2
      utils.c
  10. 10
      utils.h

2
Makefile

@ -15,7 +15,7 @@ all: $(PROGS)
install:
$(foreach PROG, $(PROGS), \
-cp $(PROG) debian/$(PROG).postinst)
cp $(PROG) debian/$(PROG).postinst)
netcfg-dhcp: netcfg.c utils.o
$(CC) $(CFLAGS) -DDHCP netcfg.c utils.o -o $@ $(INCS) $(LDOPTS)

18
README

@ -0,0 +1,18 @@
netcfg
This package is used by debian-installer to configure the network. The purpose
is two-fold:
1. configure the network for the currently running kernel so that the base
system can be retrieved from the internet or a local mirror.
2. write configuration files so that when the machine reboots into the full
debian system the network is brought up automatically.
netcfg is written specifically for the debian-installer and probably won't work
as expected is you try to run it on a full Debian system. If you want
something for a full system, take a look at etherconf.
Currently static and dhcp configuration is supported.

2
debian/control

@ -25,5 +25,5 @@ XBC-Installer-Menu-Item: 2
Description: Configure a static network
If you have information such as IP address, netmask, gateway, then you will be
able to configure a static network. If you don't know this information, you
should ask you system administrator.
should ask you system administrator, or look at configuration via DHCP.

3
debian/menutest-common

@ -1,7 +1,6 @@
#!/bin/sh
if [ -z "`/sbin/ifconfig`" ] &&
[ -n "`cat /proc/net/dev | sed -e "s/lo://" | grep "[a-z0-9]*:[ ]*[0-9]*"`" ] ; then
if [ -n "`cat /proc/net/dev | sed -e "s/lo://" | grep "[a-z0-9]*:[ ]*[0-9]*"`" ] ; then
exit 0
else
exit 1

2
debian/netcfg-dhcp.dirs

@ -1,2 +0,0 @@
etc
etc/network

2
debian/netcfg-static.dirs

@ -1,2 +0,0 @@
etc
etc/network

15
debian/rules

@ -47,7 +47,6 @@ install: build
dh_testdir
dh_testroot
dh_clean -k
# dh_installdirs
$(foreach PACKAGE, $(PACKAGES), \
( $(MAKE) install PROGS=$(PACKAGE) DESTDIR=`pwd`/debian/$(PACKAGE)) ; )
@ -58,7 +57,6 @@ binary-indep: build install
# Build architecture-dependent files here.
binary-arch: build install
# dh_testversion
dh_testdir
dh_testroot
dh_installdebconf
@ -66,20 +64,12 @@ binary-arch: build install
cat debian/netcfg-common.templates >> debian/netcfg-dhcp/DEBIAN/templates
cp debian/menutest-common debian/netcfg-dhcp/DEBIAN/menutest
cp debian/menutest-common debian/netcfg-static/DEBIAN/menutest
# dh_installdocs
# dh_installchangelogs
# dh_link
dh_strip
dh_compress
dh_fixperms
# You may want to make some executables suid here.
# dh_suidregister
# dh_makeshlibs
dh_installdeb
# dh_perl
dh_shlibdeps
dh_gencontrol -- -fdebian/files~ # to make a .udeb
# dh_gencontrol
dh_gencontrol -- -fdebian/files~
$(foreach PACKAGE, $(PACKAGES), \
(dpkg-distaddfile $(PACKAGE)_$(VERSION)_$(ARCH).udeb \
debian-installer $(PRIORITY) ) ; )
@ -92,8 +82,7 @@ binary-arch: build install
$(foreach PACKAGE, $(PACKAGES), \
(cd debian ; \
dpkg-deb -b $(PACKAGE) ../../$(PACKAGE)_$(VERSION)_$(ARCH).udeb \
); ) # make a .udeb
# dh_builddeb
); )
binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install configure

24
netcfg.c

@ -44,6 +44,7 @@ debconf_input (char *priority, char *template)
return client->value;
}
static int
netcfg_mkdir (char *path)
{
@ -56,6 +57,7 @@ netcfg_mkdir (char *path)
return 0;
}
int
is_interface_up (char *inter)
{
@ -78,6 +80,7 @@ int_up_done:
return ret;
}
static void
get_name (char *name, char *p)
{
@ -392,10 +395,10 @@ netcfg_get_common ()
save = ptr = strdup (ptr);
#ifdef DHCP
client->command (client, "subst", "netcfg/confirm_dhcp",
"nameservers", ptr, NULL);
"nameservers", ptr, NULL);
#else
client->command (client, "subst", "netcfg/confirm_static",
"nameservers", ptr, NULL);
"nameservers", ptr, NULL);
#endif
ns = strtok_r (ptr, " ", &ptr);
dot2num (&nameservers[0], ns);
@ -409,7 +412,7 @@ netcfg_get_common ()
free (save);
}
else
nameservers[0] = 0;
nameservers[0] = 0;
}
@ -461,15 +464,15 @@ static char *dhcp_hostname = NULL;
static void
netcfg_get_dhcp ()
{
if (dhcp_hostname)
free (dhcp_hostname);
if (dhcp_hostname)
free (dhcp_hostname);
client->command (client, "input", "high", "netcfg/dhcp_hostname", NULL);
client->command (client, "go", NULL);
client->command (client, "get", "netcfg/dhcp_hostname", NULL);
if (client->value)
dhcp_hostname = strdup(client->value);
dhcp_hostname = strdup (client->value);
}
@ -501,7 +504,7 @@ netcfg_write_dhcp ()
static void
netcfg_activate_dhcp ()
{
char buf[128];
char buf[128];
char *ptr;
execlog ("/sbin/ifconfig lo 127.0.0.1");
@ -530,12 +533,13 @@ main (int argc, char *argv[])
netcfg_get_common ();
netcfg_get_dhcp ();
client->command (client, "subst", "netcfg/confirm_dhcp", "interface",
interface, NULL);
interface, NULL);
client->command (client, "subst", "netcfg/confirm_dhcp", "hostname",
hostname, NULL);
client->command (client, "subst", "netcfg/confirm_dhcp", "domain",
(domain ? domain : "<none>"), NULL);
client->command (client, "subst", "netcfg/confirm_dhcp", "dhcp_hostname",
client->command (client, "subst", "netcfg/confirm_dhcp",
"dhcp_hostname",
(dhcp_hostname ? dhcp_hostname : "<none>"), NULL);
ptr = debconf_input ("medium", "netcfg/confirm_dhcp");
@ -593,7 +597,7 @@ netcfg_get_static ()
client->command (client, "subst", "netcfg/confirm_static",
"gateway", (gateway ? num2dot (gateway) : "<none>"), NULL);
if (gateway && ( (gateway & netmask) != network))
if (gateway && ((gateway & netmask) != network))
{
client->command (client, "input", "high",
"netcfg/gateway_unreachable", NULL);

2
utils.c

@ -7,9 +7,7 @@
#include <syslog.h>
#define EXECLOG_FILE "/var/log/installer.log"
#define MAXLINE 512
#define DEBUG
int
execlog (const char *incmd)

10
utils.h

@ -1,7 +1,7 @@
#ifndef __DEBIAN_INSTALLER_H__
#define __DEBIAN_INSTALLER_H__
#ifndef __UTILS_H__
#define __UTILS_H__
int execlog(char *);
int check_dir(char *);
int execlog (char *);
int check_dir (char *);
#endif /* __DEBIAN_INSTALLER_H__ */
#endif /* __UTILS_H__ */

Loading…
Cancel
Save