diff options
Diffstat (limited to 'usr/src')
| -rw-r--r-- | usr/src/lib/brand/lx/zone/Makefile | 3 | ||||
| -rw-r--r-- | usr/src/lib/brand/lx/zone/lx_init_zone.ksh | 19 | ||||
| -rw-r--r-- | usr/src/lib/brand/lx/zone/lx_init_zone_debian.ksh | 33 | ||||
| -rw-r--r-- | usr/src/lib/brand/lx/zone/lx_init_zone_ubuntu.ksh | 25 | ||||
| -rw-r--r-- | usr/src/lib/brand/lx/zone/lx_networking.ksh | 74 |
5 files changed, 142 insertions, 12 deletions
diff --git a/usr/src/lib/brand/lx/zone/Makefile b/usr/src/lib/brand/lx/zone/Makefile index 43ecc553e5..92695fba65 100644 --- a/usr/src/lib/brand/lx/zone/Makefile +++ b/usr/src/lib/brand/lx/zone/Makefile @@ -26,7 +26,8 @@ # PROGS = lx_install lx_distro_install lx_init_zone lx_boot -PROGS += lx_init_zone_debian lx_init_zone_redhat +PROGS += lx_init_zone_debian lx_init_zone_redhat lx_init_zone_ubuntu +PROGS += lx_networking SUBDIRS = distros XMLDOCS = config.xml platform.xml TEMPLATES = SUNWlx.xml SUNWlx26.xml diff --git a/usr/src/lib/brand/lx/zone/lx_init_zone.ksh b/usr/src/lib/brand/lx/zone/lx_init_zone.ksh index 08aa6e5f19..bd377d67a5 100644 --- a/usr/src/lib/brand/lx/zone/lx_init_zone.ksh +++ b/usr/src/lib/brand/lx/zone/lx_init_zone.ksh @@ -295,16 +295,29 @@ fi # # Perform distribution-specific changes. # +distro="" if [[ -f etc/redhat-release ]]; then - . $(dirname $0)/lx_init_zone_redhat + distro="redhat" +elif [[ -f etc/lsb-release ]]; then + if egrep -s Ubuntu etc/lsb-release; then + distro="ubuntu" + elif [[ -f etc/debian_version ]]; then + distro="debian" + fi elif [[ -f etc/debian_version ]]; then - . $(dirname $0)/lx_init_zone_debian -else + distro="debian" +fi + +if [[ -z $distro ]]; then log "" log "NOTE: Unsupported distribution!" i18n_echo "NOTE: Unsupported distribution!" + exit 1 fi +i18n_echo "Customizing for $distro" +. $(dirname $0)/lx_init_zone_${distro} + log "" log "System configuration modifications complete `date`" log "" diff --git a/usr/src/lib/brand/lx/zone/lx_init_zone_debian.ksh b/usr/src/lib/brand/lx/zone/lx_init_zone_debian.ksh index 34d5ab76e1..dbaaf26a8c 100644 --- a/usr/src/lib/brand/lx/zone/lx_init_zone_debian.ksh +++ b/usr/src/lib/brand/lx/zone/lx_init_zone_debian.ksh @@ -206,13 +206,30 @@ fi # # Fix mountall # -tmpfile=etc/init.d/mountall.$$ -sed 's/mount_run/# disabled for lx brand: &/ - s/mount_shm/# disabled for lx brand: &/ - s/mount_tmp/# disabled for lx brand: &/ - s/pidof \/sbin\/init/false/ - ' etc/init.d/mountall.sh > $tmpfile -mv -f $tmpfile etc/init.d/mountall.sh -chmod +x etc/init.d/mountall.sh +if [ -f etc/init.d/mountall.sh ]; then + tmpfile=etc/init.d/mountall.$$ + sed 's/mount_run/# disabled for lx brand: &/ + s/mount_shm/# disabled for lx brand: &/ + s/mount_tmp/# disabled for lx brand: &/ + s/pidof \/sbin\/init/false/ + ' etc/init.d/mountall.sh > $tmpfile + mv -f $tmpfile etc/init.d/mountall.sh + chmod +x etc/init.d/mountall.sh +fi + +ip_stack_type=`/usr/sbin/zonecfg -z $zonename info ip-type | cut -d' ' -f2` +if [[ "$ip_stack_type" == "exclusive" ]]; then + # We already moved aside the 'networking' service in the code + # above. Setup our own service which will configure the net. + cp /usr/lib/brand/lx/lx_networking etc/init.d/networking +fi + +if [[ $distro == "debian" ]]; then + # No upstart, setup rc link + ln -s ../init.d/networking etc/rcS.d/S10networking + +# else must be Ubuntu, so upstart. + +fi # Hand control back to lx_init_zone diff --git a/usr/src/lib/brand/lx/zone/lx_init_zone_ubuntu.ksh b/usr/src/lib/brand/lx/zone/lx_init_zone_ubuntu.ksh new file mode 100644 index 0000000000..e46c536ea3 --- /dev/null +++ b/usr/src/lib/brand/lx/zone/lx_init_zone_ubuntu.ksh @@ -0,0 +1,25 @@ +#!/bin/ksh -p +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2014 Joyent, Inc. All rights reserved. +# + +# +# Customisation for Ubuntu-based distributions. Assumes to have been +# sourced from lx_init_zone. +# + +# Use the debian script to begin with +. $(dirname $0)/lx_init_zone_debian + +# Hand control back to lx_init_zone diff --git a/usr/src/lib/brand/lx/zone/lx_networking.ksh b/usr/src/lib/brand/lx/zone/lx_networking.ksh new file mode 100644 index 0000000000..7c1451b2fa --- /dev/null +++ b/usr/src/lib/brand/lx/zone/lx_networking.ksh @@ -0,0 +1,74 @@ +#!/bin/sh -e +### BEGIN INIT INFO +# Provides: networking +# Required-Start: +# Required-Stop: $local_fs +# Should-Start: ifupdown +# Should-Stop: ifupdown +# Default-Start: +# Default-Stop: 0 6 +# Short-Description: Raise network interfaces. +### END INIT INFO + +PATH="/sbin:/bin:/usr/sbin:/usr/bin" + +[ -x /sbin/ipmgmtd ] || exit 0 +[ -x /sbin/ifconfig ] || exit 0 + +. /lib/lsb/init-functions + +[ -f /etc/default/networking ] && . /etc/default/networking + +config_ifs() { + if [ ! -f /etc/network/interfaces ]; then + return + fi + + while read cmd nm typ how; do + if [ "$cmd" = "iface" ]; then + ifconfig $nm plumb + if [ "$nm" != "lo0" ]; then + if [ "$how" = "dhcp" ]; then + ifconfig $nm dhcp + elif [ "$how" = "static" ]; then + read nxt addr remain + read nxt mask remain + ifconfig $nm inet $addr netmask $mask up + fi + fi + fi + done < /etc/network/interfaces +} + +case "$1" in +start) + /sbin/ipmgmtd + + log_action_begin_msg "Configuring network interfaces" + config_ifs + log_action_end_msg $? + ;; + +stop) + log_action_begin_msg "Deconfiguring network interfaces" + log_action_end_msg $? + ;; + +reload) + log_action_begin_msg "Reloading network interfaces configuration" + log_action_end_msg $? + ;; + +force-reload|restart) + log_warning_msg "Running $0 $1 is deprecated because it may not re-enable some interfaces" + log_action_begin_msg "Reconfiguring network interfaces" + log_action_end_msg $? + ;; + +*) + echo "Usage: /etc/init.d/networking {start|stop|reload|restart|force-reload}" + exit 1 + ;; +esac + +exit 0 |
