-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rc.M,rc.inet1: added container einvironment checks.
- Loading branch information
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,10 @@ | |
# Author: Fred N. van Kempen, <[email protected]> | ||
# Heavily modified by Patrick Volkerding <[email protected]> | ||
# | ||
# tweaks for an lxc container by ponce <[email protected]>, | ||
# a check for a CONTAINER variable is made to jump unneeded sections | ||
|
||
CONTAINER=yes | ||
|
||
# Tell the viewers what's going to happen. | ||
echo "Going multiuser..." | ||
|
@@ -20,10 +24,15 @@ if [ -x /sbin/ldconfig ]; then | |
/sbin/ldconfig & | ||
fi | ||
|
||
# container check | ||
if [ ! $CONTAINER ]; then | ||
|
||
# Screen blanks after 15 minutes idle time, and powers down in one hour | ||
# if the kernel supports APM or ACPI power management: | ||
/bin/setterm -blank 15 -powersave powerdown -powerdown 60 | ||
|
||
fi # end container check | ||
|
||
# Set the hostname. | ||
if [ -r /etc/HOSTNAME ]; then | ||
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,11 @@ | |
# This script is used to bring up the various network interfaces. | ||
# | ||
# @(#)/etc/rc.d/rc.inet1 10.2 Sun Jul 24 12:45:56 PDT 2005 (pjv) | ||
# | ||
# tweaks for an lxc container by ponce <[email protected]>, | ||
# a check for a CONTAINER variable is made to jump unneeded sections | ||
|
||
CONTAINER=yes | ||
|
||
############################ | ||
# READ NETWORK CONFIG FILE # | ||
|
@@ -82,6 +87,10 @@ if_up() { | |
[ "${IFNAME[$i]}" = "${1}" ] && break | ||
i=$(($i+1)) | ||
done | ||
|
||
# container check | ||
if [ ! $CONTAINER ]; then | ||
|
||
# If the interface isn't in the kernel yet (but there's an alias for it in | ||
# modules.conf), then it should be loaded first: | ||
if ! grep `echo ${1}: | cut -f 1 -d :`: /proc/net/dev 1> /dev/null ; then # no interface yet | ||
|
@@ -90,6 +99,9 @@ if_up() { | |
/sbin/modprobe ${1} | ||
fi | ||
fi | ||
|
||
fi # end container check | ||
|
||
if grep `echo ${1}: | cut -f 1 -d :`: /proc/net/dev 1> /dev/null ; then # interface exists | ||
if ! /sbin/ifconfig | grep -w "${1}" 1>/dev/null || \ | ||
! /sbin/ifconfig ${1} | grep "inet addr" 1> /dev/null ; then # interface not up or not configured | ||
|