~ubuntu-branches/ubuntu/karmic/vzctl/karmic

« back to all changes in this revision

Viewing changes to etc/dists/scripts/suse-add_ip.sh

  • Committer: Bazaar Package Importer
  • Author(s): Ola Lundqvist
  • Date: 2007-04-10 18:08:16 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070410180816-0uuzj9fnna7gmzxv
Tags: 3.0.16-4
Etch has been released which means that this version can be uploaded
to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/bash
2
 
#  Copyright (C) 2000-2006 SWsoft. All rights reserved.
 
2
#  Copyright (C) 2000-2007 SWsoft. All rights reserved.
3
3
#
4
4
#  This program is free software; you can redistribute it and/or modify
5
5
#  it under the terms of the GNU General Public License as published by
28
28
#
29
29
# this should set up networking for SuSE-based VE
30
30
VENET_DEV=venet0
31
 
FAKEGATEWAYNET=191.255.255.0
32
 
FAKEGATEWAY=191.255.255.1
33
31
IFCFG_DIR=/etc/sysconfig/network/
34
32
IFCFG=${IFCFG_DIR}/ifcfg-${VENET_DEV}
35
33
ROUTES=${IFCFG_DIR}/ifroute-${VENET_DEV}
54
52
IPADDR=127.0.0.1" > ${IFCFG} || \
55
53
        error "Can't write to file ${IFCFG_DIR}/${VENET_DEV_CFG}" ${VZ_FS_NO_DISK_SPACE}
56
54
 
57
 
        if ! grep -q -E "${FAKEGATEWAYNET}[[:space:]]0.0.0.0[[:space:]]255.255.255.0[[:space:]]${VENET_DEV}" ${ROUTES};
 
55
        remove_fake_old_route ${ROUTES}
 
56
        if ! grep -q -E "${FAKEGATEWAYNET}[[:space:]]0.0.0.0[[:space:]]255.255.255.0[[:space:]]${VENET_DEV}" ${ROUTES} 2>/dev/null;
58
57
        then
59
 
                echo "${FAKEGATEWAYNET} 0.0.0.0 255.255.255.0   ${VENET_DEV}" >> ${ROUTES}
 
58
                echo "${FAKEGATEWAYNET} 0.0.0.0 255.255.255.0   ${VENET_DEV}" >> ${ROUTES}
60
59
        fi
61
 
        if ! grep -q -E "default[[:space:]]${FAKEGATEWAY}[[:space:]]0.0.0.0[[:space:]]${VENET_DEV}" ${ROUTES};
 
60
        if ! grep -q -E "default[[:space:]]${FAKEGATEWAY}[[:space:]]0.0.0.0[[:space:]]${VENET_DEV}" ${ROUTES} 2>/dev/null;
62
61
        then
63
 
                echo "default ${FAKEGATEWAY}    0.0.0.0 ${VENET_DEV}" >> ${ROUTES}
 
62
                echo "default ${FAKEGATEWAY}    0.0.0.0 ${VENET_DEV}" >> ${ROUTES}
64
63
        fi
65
64
        # Set up /etc/hosts
66
65
        if [ ! -f ${HOSTFILE} ]; then
84
83
        local ifnum=-1
85
84
 
86
85
        if [ "x${IPDELALL}" = "xyes" -o "x${VE_STATE}" = "xstarting" ]; then
 
86
                rm -f ${IFCFG} 2>/dev/null
 
87
        fi
 
88
        if [ ! -f "${IFCFG}" ]; then
87
89
                init
88
90
        fi
89
91
        get_aliases