Systemd-based config for RPM

pull/49/head
Jan "Yenya" Kasprzak 9 years ago
parent 7ffdd1fa30
commit ca80972e4b

@ -1,38 +0,0 @@
#!/bin/bash
#
# chkconfig: 2345 9 99
# description: network reconfigure
#
# -------------------------------------------------------------------------- #
# Copyright 2010-2016, OpenNebula Systems #
# #
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
# not use this file except in compliance with the License. You may obtain #
# a copy of the License at #
# #
# http://www.apache.org/licenses/LICENSE-2.0 #
# #
# Unless required by applicable law or agreed to in writing, software #
# distributed under the License is distributed on an "AS IS" BASIS, #
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
# See the License for the specific language governing permissions and #
# limitations under the License. #
#--------------------------------------------------------------------------- #
### BEGIN INIT INFO
# Provides: vmcontext
# Required-Start: $all
# Required-Stop:
# Should-Start: networking
# Should-Stop: networking
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: OpenNebula contextualization script
### END INIT INFO
case "$1" in
"start")
/usr/sbin/one-contextd
esac

@ -125,6 +125,7 @@ IPV6INIT=yes
IPV6ADDR=$IPV6 IPV6ADDR=$IPV6
IPV6_AUTOCONF=no IPV6_AUTOCONF=no
EOT EOT
echo 0 > /proc/sys/net/ipv6/conf/$DEV/autoconf
if [ -n "$MTU" ]; then if [ -n "$MTU" ]; then
echo "MTU=$MTU" echo "MTU=$MTU"
@ -184,7 +185,7 @@ gen_network_configuration()
( (
cat <<EOT cat <<EOT
DEVICE=$DEV DEVICE=$DEV
BOOTPROTO=none BOOTPROTO=static
ONBOOT=yes ONBOOT=yes
NM_CONTROLLED=no NM_CONTROLLED=no
TYPE=Ethernet TYPE=Ethernet
@ -193,22 +194,8 @@ EOT
[[ -n $IPV6 ]] && gen_iface6_conf [[ -n $IPV6 ]] && gen_iface6_conf
) > /etc/sysconfig/network-scripts/ifcfg-${DEV} ) > /etc/sysconfig/network-scripts/ifcfg-${DEV}
ifup ${DEV}
done done
} }
configure_network() gen_network_configuration
{
gen_network_configuration
service network restart
sleep 2
}
[ -z "$(env | cut -d= -f1 | grep -E '^ETH[0-9]+_IPV*6*')" ] && exit 0
configure_network

@ -0,0 +1,13 @@
[Unit]
Description=OpenNebula contextualization script
Requires=dev-disk-by\x2dlabel-CONTEXT.device
After=dev-disk-by\x2dlabel-CONTEXT.device
Before=network.service
[Service]
Type=oneshot
ExecStart=/usr/sbin/one-contextd
[Install]
WantedBy=multi-user.target

@ -28,7 +28,7 @@ fi
# RedHat based distros # RedHat based distros
if [ -d /etc/sysconfig/network-scripts ]; then if [ -d /etc/sysconfig/network-scripts ]; then
# Register Service # Register Service
chkconfig --add vmcontext # chkconfig --add vmcontext
fi fi

@ -56,7 +56,7 @@ fi
# RedHat based distros # RedHat based distros
if [ -d /etc/sysconfig/network-scripts ]; then if [ -d /etc/sysconfig/network-scripts ]; then
# Register Service # Register Service
chkconfig --add vmcontext systemctl enable vmcontext.service
# Prepare network files # Prepare network files
rm -f /etc/sysconfig/network-scripts/ifcfg-eth* rm -f /etc/sysconfig/network-scripts/ifcfg-eth*

Loading…
Cancel
Save