/[baselayout]/trunk/sbin/update-modules
Gentoo

Contents of /trunk/sbin/update-modules

Parent Directory Parent Directory | Revision Log Revision Log


Revision 251 - (show annotations) (download)
Mon Oct 28 01:49:22 2002 UTC (16 years, 7 months ago) by azarah
File size: 2238 byte(s)
bugfix

1 #!/bin/sh
2 #
3 # This is the update-modules script for Debian GNU/Linux.
4 # Written by Wichert Akkerman <wakkerma@debian.org>
5 # Copyright (C) 1998, 1999 Software in the Public Interest
6
7 # Modifications by Daniel Robbins <drobbins@gentoo.org>, Gentoo Technologies, Inc.
8 # 02 Sep 2001 -- Removed "arch" stuff since I see no reason to have support for varying
9 # CPU architectures on a single system.
10
11 CFGFILE="/etc/modules.conf"
12 TMPFILE="${CFGFILE}.$!"
13 MODDIR="/etc/modules.d"
14 ARCHDIR="${MODDIR}/arch"
15 HEADER="### This file is automatically generated by update-modules"
16
17 set -e
18
19 # Reset the sorting order since we depend on it
20 export LC_COLLATE="C"
21
22 depdir() {
23 dep="`egrep '[[:space:]]*depfile' ${CFGFILE} | tail -n 1 | sed -e 's/depfile=//' -e 's,/[^/]*$,,'`"
24 if [ -z "${dep}" ]
25 then
26 dep=/lib/modules/`uname -r`
27 fi
28
29 echo ${dep}
30 }
31
32 if [ -f ${CFGFILE} ]
33 then
34 if ! sed -ne 1p ${CFGFILE} | egrep -q "^${HEADER}"
35 then
36 echo "Error: the current ${CFGFILE} is not automatically generated."
37
38 if [ "$1" != "force" ]
39 then
40 echo "Use \"update-modules force\" to force (re)generation."
41 exit 1
42 else
43 echo "force specified, (re)generating file anyway."
44 fi
45 fi
46 fi
47
48 if [ 0 -ne "`id -u`" ]
49 then
50 echo "You have to be root to do this."
51 exit 2
52 fi
53
54 if [ -e ${CFGFILE} ]
55 then
56 cp -f ${CFGFILE} ${CFGFILE}.old
57 fi
58
59 echo ${HEADER} > ${TMPFILE}
60 cat <<EOF >> ${TMPFILE}
61 #
62 # Please do not edit this file directly. If you want to change or add
63 # anything please take a look at the files in $MODDIR and read
64 # the manpage for update-modules.
65 #
66 EOF
67
68 for cfg in ${MODDIR}/* ${CONF}
69 do
70 [ -d ${cfg} ] && continue
71
72 [ ! -r ${cfg} ] && continue
73
74 [ -n "`echo ${cfg} | awk '!/~$|\.bak$/ { print $0 }'`" ] || continue
75
76 echo "### update-modules: start processing ${cfg}" >> ${TMPFILE}
77
78 if [ -x ${cfg} ]
79 then
80 # $cfg can be executable; nice touch, Wichert! :)
81 ${cfg} >> ${TMPFILE}
82 else
83 cat ${cfg} >> ${TMPFILE}
84 fi
85
86 echo >> ${TMPFILE}
87 echo "### update-modules: end processing ${cfg}" >> ${TMPFILE}
88 echo >> ${TMPFILE}
89 done
90
91 mv -f ${TMPFILE} ${CFGFILE}
92
93 # We also call depmod here to stop insmod from complaining that modules.conf
94 # is more recent then modules.dep
95 #
96 if [ -d `depdir` -a -f /proc/modules ]
97 then
98 depmod -a
99 fi
100
101
102 # vim:ts=4

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.20