aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>1999-12-28 06:11:06 +0000
committerBill Nottingham <notting@redhat.com>1999-12-28 06:11:06 +0000
commit7d302ba296c897e3770de1ee968ab9eb4c963491 (patch)
treef23633a04f84a8876e7a1a4961d628a995c69be2
parentd65f430d850549092ca90e784e753a3f76227c69 (diff)
downloadinitscripts-7d302ba296c897e3770de1ee968ab9eb4c963491.tar
initscripts-7d302ba296c897e3770de1ee968ab9eb4c963491.tar.gz
initscripts-7d302ba296c897e3770de1ee968ab9eb4c963491.tar.bz2
initscripts-7d302ba296c897e3770de1ee968ab9eb4c963491.tar.xz
initscripts-7d302ba296c897e3770de1ee968ab9eb4c963491.zip
switch from echoing values into /proc/sys to using sysctl
-rw-r--r--Makefile5
-rw-r--r--initscripts.spec35
-rwxr-xr-xrc.d/init.d/network61
-rwxr-xr-xrc.d/init.d/single2
-rwxr-xr-xrc.d/rc.sysinit19
-rw-r--r--sysconfig/init4
6 files changed, 46 insertions, 80 deletions
diff --git a/Makefile b/Makefile
index 103f2682..ea7a7bdf 100644
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,11 @@ install:
install -m755 service $(ROOT)/sbin
install -m755 sys-unconfig $(ROOT)/usr/sbin
install -m644 sys-unconfig.8 $(ROOT)/usr/man/man8
+ ( if uname -m | grep -q sparc ; then \
+ install -m644 sysctl.conf.sparc $(ROOT)/etc/sysctl.conf ; \
+ else \
+ install -m644 sysctl.conf $(ROOT)/etc/sysctl.conf ; \
+ fi )
mkdir -p $(ROOT)/etc/X11
install -m755 prefdm $(ROOT)/etc/X11/prefdm
mkdir -p $(ROOT)/etc/sysconfig
diff --git a/initscripts.spec b/initscripts.spec
index 5375ed54..a9303aae 100644
--- a/initscripts.spec
+++ b/initscripts.spec
@@ -1,6 +1,6 @@
Summary: The inittab file and the /etc/rc.d scripts.
Name: initscripts
-%define version 4.72
+%define version 4.80
Version: %{version}
Copyright: GPL
Group: System Environment/Base
@@ -8,7 +8,7 @@ Release: 1
Source: initscripts-%{version}.tar.gz
BuildRoot: /%{_tmppath}/%{name}-%{version}-%{release}-root
Requires: mingetty, /bin/awk, /bin/sed, mktemp, e2fsprogs >= 1.15, console-tools
-Requires: procps, modutils >= 2.1.121, sysklogd >= 1.3.31
+Requires: procps >= 2.0.3, modutils >= 2.1.121, sysklogd >= 1.3.31
Requires: setup >= 2.0.3, /sbin/fuser
%ifarch alpha
Requires: util-linux >= 2.9w-26
@@ -16,7 +16,7 @@ Requires: util-linux >= 2.9w-26
Conflicts: kernel <= 2.2, timeconfig < 3.0, pppd < 2.3.9, wvdial < 1.40-3
Conflicts: initscripts < 1.22.1-5
Obsoletes: rhsound
-Prereq: /sbin/chkconfig, /usr/sbin/groupadd, gawk
+Prereq: /sbin/chkconfig, /usr/sbin/groupadd, gawk, sh-utils
%description
The initscripts package contains the basic system scripts used to boot
@@ -126,6 +126,34 @@ if [ $1 = 0 ]; then
chkconfig --del network
fi
+%triggerpostun -- initscripts <= 4.72
+
+. /etc/sysconfig/init
+. /etc/sysconfig/network
+
+# These are the non-default settings. By putting them at the end
+# of the /etc/sysctl.conf file, it will override the default
+# settings earlier in the file.
+
+if [ -n "$FORWARD_IPV4" -a "$FORWARD_IPV4" != "no" -a "$FORWARD_IPV4" != "false" ]; then
+ echo "# added by initscripts install on `date`" >> /etc/sysctl.conf
+ echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
+fi
+if [ "$DEFRAG_IPV4" = "yes" -o "$DEFRAG_IPV4" = "true" ]; then
+ echo "# added by initscripts install on `date`" >> /etc/sysctl.conf
+ echo "net.ipv4.ip_always_defrag = 1" >> /etc/sysctl.conf
+fi
+if [ -n "$MAGIC_SYSRQ" -a "$MAGIC_SYSRQ" != "no" ]; then
+ echo "# added by initscripts install on `date`" >> /etc/sysctl.conf
+ echo "kernel.sysrq = 1" >> /etc/sysctl.conf
+fi
+if uname -m | grep -q sparc ; then
+ if [ -n "$STOP_A" -a "$STOP_A" != "no" ]; then
+ echo "# added by initscripts install on `date`" >> /etc/sysctl.conf
+ echo "kernel. = 1" >> /etc/sysctl.conf
+ fi
+fi
+
%clean
rm -rf $RPM_BUILD_ROOT
@@ -173,6 +201,7 @@ rm -rf $RPM_BUILD_ROOT
%config(missingok) /etc/rc.d/init.d/*
%config /etc/rc.d/rc
%config(noreplace) /etc/rc.d/rc.local
+%config(noreplace) /etc/sysctl.conf
%config /etc/profile.d/lang.sh
%config /etc/profile.d/lang.csh
/usr/sbin/sys-unconfig
diff --git a/rc.d/init.d/network b/rc.d/init.d/network
index d623d01c..8747cc65 100755
--- a/rc.d/init.d/network
+++ b/rc.d/init.d/network
@@ -43,64 +43,9 @@ for inter in `ls ifcfg* | egrep -v '(ifcfg-lo|:)' | egrep 'ifcfg-[a-z0-9]+$'`; d
[ -n "$int" ] && interfaces_boot="$interfaces_boot $int"
done
-ipv4_forward_set ()
-{
- # Turn IP forwarding on or off. We do this before bringing up the
- # interfaces to make sure we don't forward when we shouldn't, and
- # we do it even if networking isn't configured (why not?).
- if [ -d /proc/sys/net/ipv4 ]; then
- # people could have left this out of their kernel, which isn't
- # exactly an error
- if [ ! -f /proc/sys/net/ipv4/ip_forward ] ; then
- echo "/proc/sys/net/ipv4/ip_forward is missing --" \
- "cannot control IP forwarding" >&2
- else
- if [ "$FORWARD_IPV4" = "no" -o "$FORWARD_IPV4" = "false" ]; then
- value=0
- message="Disabling IPv4 packet forwarding"
- else
- value=1
- message="Enabling IPv4 packet forwarding"
- fi
-
- if [ $value != `cat /proc/sys/net/ipv4/ip_forward` ]; then
- action "$message" /bin/true
- echo "$value" > /proc/sys/net/ipv4/ip_forward
- fi
- fi
- fi
-}
-
-ipv4_defrag_set ()
-{
- # Sets whether or not to always defrag packets.
- # Good for masquerading. Not so good otherwise.
- if [ -d /proc/sys/net/ipv4 ]; then
- if [ ! -f /proc/sys/net/ipv4/ip_always_defrag ]; then
- echo "/proc/sys/net/ipv4/ip_always_defrag is missing --" \
- "cannot control IP defragmentation" >&2
- else
- if [ "$DEFRAG_IPV4" = "yes" -o "$DEFRAG_IPV4" = "true" ]; then
- value=1
- message="Enabling IPv4 automatic defragmentation"
- else
- value=0
- message="Disabling IPv4 automatic defragmentation"
- fi
-
- if [ $value != `cat /proc/sys/net/ipv4/ip_always_defrag` ]; then
- action "$message" /bin/true
- echo "$value" > /proc/sys/net/ipv4/ip_always_defrag
- fi
- fi
- fi
-}
-
# See how we were called.
case "$1" in
start)
- ipv4_forward_set
- ipv4_defrag_set
action "Bringing up interface lo" ./ifup ifcfg-lo
@@ -142,14 +87,12 @@ case "$1" in
if [ -d /proc/sys/net/ipv4 ]; then
if [ -f /proc/sys/net/ipv4/ip_forward ]; then
if [ `cat /proc/sys/net/ipv4/ip_forward` != 0 ]; then
- action "Disabling IPv4 packet forwarding" /bin/true
- echo 0 > /proc/sys/net/ipv4/ip_forward
+ action "Disabling IPv4 packet forwarding" sysctl -w net.ipv4.ip_forward=0
fi
fi
if [ -f /proc/sys/net/ipv4/ip_always_defrag ]; then
if [ `cat /proc/sys/net/ipv4/ip_always_defrag` != 0 ]; then
- action "Disabling IPv4 automatic defragmentation" /bin/true
- echo 0 > /proc/sys/net/ipv4/ip_always_defrag
+ action "Disabling IPv4 automatic defragmentation" sysctl -w net.ipv4.ip_always_defrag=0
fi
fi
fi
diff --git a/rc.d/init.d/single b/rc.d/init.d/single
index 0bcb9dab..4bf94387 100755
--- a/rc.d/init.d/single
+++ b/rc.d/init.d/single
@@ -31,7 +31,7 @@ rm -f /var/lock/subsys/*
# make sure modprobe is working
if [ -f /proc/sys/kernel/modprobe ]; then
- echo "/sbin/modprobe" > /proc/sys/kernel/modprobe
+ sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1
fi
# If they want to run something in single user mode, might as well run it...
diff --git a/rc.d/rc.sysinit b/rc.d/rc.sysinit
index 1e2b3220..c4852c2d 100755
--- a/rc.d/rc.sysinit
+++ b/rc.d/rc.sysinit
@@ -44,23 +44,15 @@ fi
action "Mounting proc filesystem" mount -n -t proc /proc /proc
-# Turn off sysrq
-if [ -f /proc/sys/kernel/sysrq -a "$MAGIC_SYSRQ" = "no" ]; then
- echo "0" > /proc/sys/kernel/sysrq
- action "Turning off Magic SysRq key" /bin/true
-fi
-# Turn off Stop-A
-if [ -f /proc/sys/kernel/stop-a -a "$STOP_A" = "no" ]; then
- echo "0" > /proc/sys/kernel/stop-a
- action "Turning off Stop-A/Break-A" /bin/true
-fi
+# Configure kernel parameters
+
+action "Configuring kernel parameters" sysctl -p /etc/sysctl.conf
# Set the system clock.
ARC=0
SRM=0
UTC=0
-
if [ -f /etc/sysconfig/clock ]; then
. /etc/sysconfig/clock
@@ -293,9 +285,10 @@ fi
if [ -f /proc/sys/kernel/modprobe ]; then
if [ -n "$USEMODULES" ]; then
- echo "/sbin/modprobe" > /proc/sys/kernel/modprobe
+ sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1
else
- echo "" > /proc/sys/kernel/modprobe
+ # We used to set this to NULL, but that causes 'failed to exec' messages"
+ sysctl -w kernel.modprobe="/bin/true" >/dev/null 2>&1
fi
fi
diff --git a/sysconfig/init b/sysconfig/init
index d9dcccb6..77e7520d 100644
--- a/sysconfig/init
+++ b/sysconfig/init
@@ -17,9 +17,5 @@ SETCOLOR_WARNING="echo -en \\033[1;33m"
SETCOLOR_NORMAL="echo -en \\033[0;39m"
# default kernel loglevel on boot (syslog will reset this)
LOGLEVEL=1
-# Setting this to something other than 'no' will turn on magic sysrq keys
-MAGIC_SYSRQ=no
-# Setting this to something other than 'no' will turn on stop-a (Sparc only)
-STOP_A=no
# Set to anything other than 'no' to allow hotkey interactive startup...
PROMPT=yes