From: <abe...@us...> - 2015-02-19 15:34:31
|
Revision: 6976 http://sourceforge.net/p/astlinux/code/6976 Author: abelbeck Date: 2015-02-19 15:34:29 +0000 (Thu, 19 Feb 2015) Log Message: ----------- kernel runtime params, add support for /etc/sysctl.conf via either /mnt/kd/sysctl.conf or the rc.conf variable KERNEL_SYSCTL, disabled by default Modified Paths: -------------- branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf Added Paths: ----------- branches/1.0/project/astlinux/target_skeleton/etc/init.d/sysctl branches/1.0/project/astlinux/target_skeleton/etc/runlevels/default/S97sysctl branches/1.0/project/astlinux/target_skeleton/etc/sysctl.conf Added: branches/1.0/project/astlinux/target_skeleton/etc/init.d/sysctl =================================================================== --- branches/1.0/project/astlinux/target_skeleton/etc/init.d/sysctl (rev 0) +++ branches/1.0/project/astlinux/target_skeleton/etc/init.d/sysctl 2015-02-19 15:34:29 UTC (rev 6976) @@ -0,0 +1,73 @@ +#!/bin/sh + +. /etc/rc.conf + +gen_sysctl_conf() +{ + local i param value IFS + + unset IFS + for i in $KERNEL_SYSCTL; do + param="$(echo "$i" | cut -s -d'=' -f1)" + value="$(echo "$i" | cut -s -d'=' -f2)" + if [ -n "$param" -a -n "$value" ]; then + echo "$param = $value" + fi + done +} + +init () { + + if [ -f /mnt/kd/sysctl.conf ]; then + echo "# Autogenerated. Edit /mnt/kd/sysctl.conf file. +" > /tmp/etc/sysctl.conf + cat /mnt/kd/sysctl.conf >>/tmp/etc/sysctl.conf + elif [ -n "$KERNEL_SYSCTL" ]; then + echo "# Autogenerated. Do not edit. +# A manually generated sysctl config will use /mnt/kd/sysctl.conf if it exists. +" > /tmp/etc/sysctl.conf + gen_sysctl_conf >>/tmp/etc/sysctl.conf + elif [ -f /etc/sysctl.conf ]; then + rm -f /tmp/etc/sysctl.conf + fi +} + +start () { + + if [ -f /etc/sysctl.conf ]; then + echo "Setting kernel runtime parameters..." + sysctl -p /etc/sysctl.conf >/dev/null + fi +} + +stop () { + : +} + +case $1 in + +start) + start + ;; + +stop) + stop + ;; + +init) + init + start + ;; + +restart) + stop + sleep 2 + start + ;; + +*) + echo "Usage: start|stop|restart" + ;; + +esac + Property changes on: branches/1.0/project/astlinux/target_skeleton/etc/init.d/sysctl ___________________________________________________________________ Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Added: branches/1.0/project/astlinux/target_skeleton/etc/runlevels/default/S97sysctl =================================================================== --- branches/1.0/project/astlinux/target_skeleton/etc/runlevels/default/S97sysctl (rev 0) +++ branches/1.0/project/astlinux/target_skeleton/etc/runlevels/default/S97sysctl 2015-02-19 15:34:29 UTC (rev 6976) @@ -0,0 +1 @@ +link ../../init.d/sysctl \ No newline at end of file Property changes on: branches/1.0/project/astlinux/target_skeleton/etc/runlevels/default/S97sysctl ___________________________________________________________________ Added: svn:special ## -0,0 +1 ## +* \ No newline at end of property Added: branches/1.0/project/astlinux/target_skeleton/etc/sysctl.conf =================================================================== --- branches/1.0/project/astlinux/target_skeleton/etc/sysctl.conf (rev 0) +++ branches/1.0/project/astlinux/target_skeleton/etc/sysctl.conf 2015-02-19 15:34:29 UTC (rev 6976) @@ -0,0 +1 @@ +link /tmp/etc/sysctl.conf \ No newline at end of file Property changes on: branches/1.0/project/astlinux/target_skeleton/etc/sysctl.conf ___________________________________________________________________ Added: svn:special ## -0,0 +1 ## +* \ No newline at end of property Modified: branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf =================================================================== --- branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf 2015-02-12 18:06:38 UTC (rev 6975) +++ branches/1.0/project/astlinux/target_skeleton/stat/etc/rc.conf 2015-02-19 15:34:29 UTC (rev 6976) @@ -802,6 +802,11 @@ ## Module options ## Edit /etc/modprobe.d/options.conf if you need to pass any options. +## Kernel runtime parameters +## List of kernel sysctl 'param=value' entries, space or newline separated. +## Note: If /mnt/kd/sysctl.conf exists, it will be used instead. +#KERNEL_SYSCTL="kernel.panic=3 vm.min_free_kbytes=8192" + ## LMSensors Modules ## List your hardware modules, seperated by spaces ## You will also need to create a sensors.conf This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |