75.diff

patch - kvaps kvaps, 05/04/2017 01:09 PM

Download (4.32 KB)

View differences:

postinstall.one
32 32
fi
33 33

  
34 34
if [ -f /etc/init.d/one-context ]; then
35
    if [ -d /etc/sysconfig/network-scripts ]; then
35
    if [ -d /etc/sysconfig/network-scripts ] || [ -d /etc/sysconfig/network ]; then
36 36
        chkconfig --add one-context-local
37 37
        chkconfig --add one-context
38 38
    elif [ -d /etc/network ]; then
......
79 79
    rm -f /etc/sysconfig/network-scripts/ifcfg-eth*
80 80
fi
81 81

  
82
# openSUSE based distros
83
if [ -d /etc/sysconfig/network ]; then
84
    # Prepare network files
85
    rm -f /etc/sysconfig/network/ifcfg-eth*
86
    rm -f /etc/sysconfig/network/routes
87
    sed -i '/^NETCONFIG_DNS_STATIC_SERVERS=/ s/=.*$/=""/' /etc/sysconfig/network/config
88
    sed -i '/^NETCONFIG_DNS_STATIC_SEARCHLIST=/ s/=.*$/=""/' /etc/sysconfig/network/config
89
fi
90

  
src/etc/one-context.d/loc-10-network##rpm.one
105 105
EOT
106 106

  
107 107
    if [ -n "$GATEWAY" ]; then
108
        echo "GATEWAY=$GATEWAY"
108
        if [ "$CONFIG_PATH" = "/etc/sysconfig/network" ]; then
109
            echo "default $GATEWAY - -" >> /etc/sysconfig/network/routes
110
        else
111
            echo "GATEWAY=$GATEWAY"
112
        fi
109 113
    fi
110 114

  
111 115
    if [ -n "$MTU" ]; then
......
125 129
    fi
126 130

  
127 131
    if [ -n "$GATEWAY6" ]; then
128
        echo "IPV6_DEFAULTGW=$GATEWAY6"
132
        if [ "$CONFIG_PATH" = "/etc/sysconfig/network" ]; then
133
            echo "default $GATEWAY6 - -" >> /etc/sysconfig/network/routes
134
        else
135
            echo "IPV6_DEFAULTGW=$GATEWAY6"
136
        fi
129 137
    fi
130 138

  
131 139
    if [ -n "$MTU" ]; then
......
153 161

  
154 162
gen_network_configuration()
155 163
{
164
    if [ -d /etc/sysconfig/network-scripts ]; then
165
        CONFIG_PATH=/etc/sysconfig/network-scripts
166
    elif [ -d /etc/sysconfig/network ]; then
167
        CONFIG_PATH=/etc/sysconfig/network
168
    fi
169

  
156 170
    INTERFACE_MAC=$(get_interface_mac)
157 171
    CONTEXT_INTERFACES=$(get_context_interfaces)
158 172
    GATEWAY_IFACE_NUM=$(echo "$GATEWAY_IFACE" | sed 's/^ETH//')
......
179 193
        [ -z "${DEV}" ] && continue
180 194

  
181 195
        (
196
            rm -f /etc/sysconfig/network/routes 
182 197
            cat <<EOT
183 198
DEVICE=$DEV
184
BOOTPROTO=none
185
ONBOOT=yes
199
BOOTPROTO=static
186 200
NM_CONTROLLED=no
187 201
TYPE=Ethernet
188 202
EOT
203
        if [ "$CONFIG_PATH" = "/etc/sysconfig/network" ]; then
204
            echo "STARTMODE=auto"
205
        else
206
            echo "ONBOOT=yes"
207
        fi
208

  
189 209
            [[ -n $IP ]] && gen_iface_conf
190 210
            [[ -n $IP6 ]] && gen_iface6_conf
191 211

  
192
        ) > /etc/sysconfig/network-scripts/ifcfg-${DEV}
212
        ) > ${CONFIG_PATH}/ifcfg-${DEV}
193 213

  
194 214
        ifup ${DEV}
195 215

  
src/etc/one-context.d/loc-11-dns##one
46 46
    echo nameserver $nameserver >> /etc/resolv.conf
47 47
done
48 48

  
49
if [ -f /etc/sysconfig/network/config ]; then
50
    sed -i "/^NETCONFIG_DNS_STATIC_SERVERS=/ s/=.*$/=\"$nameservers\"/" /etc/sysconfig/network/config
51
fi
52

  
49 53
[ -z "$searchdomains" ] && exit 0
50 54

  
51 55
echo search $searchdomains >> /etc/resolv.conf
52 56

  
57
if [ -f /etc/sysconfig/network/config ]; then
58
    sed -i "/^NETCONFIG_DNS_STATIC_SEARCHLIST=/ s/=.*$/=\"$searchdomains\"/" /etc/sysconfig/network/config
59
fi
src/etc/one-context.d/loc-23-selinux-ssh##rpm
1
restorecon -R -v /root/.ssh
1
[ -x /sbin/restorecon ] && restorecon -R -v /root/.ssh
src/etc/one-context.d/net-15-hostname##one
24 24
}
25 25

  
26 26
function get_first_ip() {
27
    hostname -I | cut -d' ' -f1
27
    ip route get 1 | awk '{print $NF;exit}'
28 28
}
29 29

  
30 30
function get_dns_name() {