#!/bin/sh # # This is the update-make.conf.d script # This is based on the update-modules script of debian, modifed by the people below: # Written by Wichert Akkerman # Copyright (C) 1998, 1999 Software in the Public Interest # Modifications by Daniel Robbins , Gentoo Technologies, Inc. # 02 Sep 2001 -- Removed "arch" stuff since I see no reason to have support for varying # CPU architectures on a single system. CFGFILE="/etc/make.conf" TMPFILE="${CFGFILE}.$!" MODDIR="/etc/make.conf.d" HEADER="### This file is automatically generated by update-make.conf" set -e # Reset the sorting order since we depend on it export LC_COLLATE="C" depdir() { dep="`egrep '[[:space:]]*depfile' ${CFGFILE} | tail -n 1 | sed -e 's/depfile=//' -e 's,/[^/]*$,,'`" if [ -z "${dep}" ] then dep=/lib/modules/`uname -r` fi echo ${dep} } if [ -f ${CFGFILE} ] then if ! sed -ne 1p ${CFGFILE} | egrep -q "^${HEADER}" then echo "Error: the current ${CFGFILE} is not automatically generated." if [ "$1" != "force" ] then echo "Use \"update-modules force\" to force (re)generation." exit 1 else echo "force specified, (re)generating file anyway." fi fi fi if [ 0 -ne "`id -u`" ] then echo "You have to be root to do this." exit 2 fi if [ -e ${CFGFILE} ] then cp -f ${CFGFILE} ${CFGFILE}.old fi echo ${HEADER} > ${TMPFILE} cat <> ${TMPFILE} # # Please do not edit this file directly. If you want to change or add # anything please take a look at the files in $MODDIR and read # the manpage for update-modules. # EOF for cfg in ${MODDIR}/* ${CONF} do [ -d ${cfg} ] && continue [ ! -r ${cfg} ] && continue [ -n "`echo ${cfg} | awk '!/~$|\.bak$/ { print $0 }'`" ] || continue echo "### update-modules: start processing ${cfg}" >> ${TMPFILE} if [ -x ${cfg} ] then # $cfg can be executable; nice touch, Wichert! :) ${cfg} >> ${TMPFILE} else cat ${cfg} >> ${TMPFILE} fi echo >> ${TMPFILE} echo "### update-modules: end processing ${cfg}" >> ${TMPFILE} echo >> ${TMPFILE} done mv -f ${TMPFILE} ${CFGFILE} # We also call depmod here to stop insmod from complaining that modules.conf # is more recent then modules.dep # if [ -d `depdir` -a -f /proc/modules ] then depmod -a fi # vim:ts=4