summaryrefslogtreecommitdiff
path: root/recipes/update-modules
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
committerDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
commit709c4d66e0b107ca606941b988bad717c0b45d9b (patch)
tree37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/update-modules
parentfa6cd5a3b993f16c27de4ff82b42684516d433ba (diff)
rename packages/ to recipes/ per earlier agreement
See links below for more details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326 http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816 Signed-off-by: Denys Dmytriyenko <denis@denix.org> Acked-by: Mike Westerhof <mwester@dls.net> Acked-by: Philip Balister <philip@balister.org> Acked-by: Khem Raj <raj.khem@gmail.com> Acked-by: Marcin Juszkiewicz <hrw@openembedded.org> Acked-by: Koen Kooi <koen@openembedded.org> Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/update-modules')
-rwxr-xr-xrecipes/update-modules/update-modules-1.0/openmn/update-modules3
-rwxr-xr-xrecipes/update-modules/update-modules-1.0/update-modules197
-rw-r--r--recipes/update-modules/update-modules_1.0.bb37
3 files changed, 237 insertions, 0 deletions
diff --git a/recipes/update-modules/update-modules-1.0/openmn/update-modules b/recipes/update-modules/update-modules-1.0/openmn/update-modules
new file mode 100755
index 0000000000..976161f141
--- /dev/null
+++ b/recipes/update-modules/update-modules-1.0/openmn/update-modules
@@ -0,0 +1,3 @@
+#!/bin/sh
+depmod -ae
+exit 0
diff --git a/recipes/update-modules/update-modules-1.0/update-modules b/recipes/update-modules/update-modules-1.0/update-modules
new file mode 100755
index 0000000000..636fe1c0d4
--- /dev/null
+++ b/recipes/update-modules/update-modules-1.0/update-modules
@@ -0,0 +1,197 @@
+#!/bin/sh
+#
+# This is the update-modules script for Debian GNU/Linux.
+# Copyright 1998-2001 Wichert Akkerman <wakkerma@debian.org>
+# Licensed under the GNU GPL, version 2
+#
+
+MODCONFFILE=/etc/modules.conf
+MODCONFTMPFILE="${MODCONFFILE}.$$"
+MODULESFILE=/etc/modules
+MODULESTMPFILE="${MODULESFILE}.$$"
+
+ARCHDIR=/etc/modutils/arch
+CPUDIR=/etc/modutils/cpu
+HEADER="### This file is automatically generated by update-modules"
+
+set -e
+
+if [ "$1" = "force" ] ; then
+ force=1
+else
+ force=
+fi
+
+# Reset the sorting order since we depend on it
+LC_COLLATE=C
+export LC_COLLATE
+
+depdir()
+{
+ dep=`grep '[[:space:]]*depfile' "${MODCONFFILE}" | tail -n 1 | sed -e 's/depfile=//' -e 's,/[^/]*$,,'`
+ if [ -z "$dep" ] ; then
+ dep="/lib/modules/`uname -r`"
+ fi
+
+ echo $dep
+}
+
+arch() {
+ local model=`uname -m`
+ case $model in
+ i[0-9]86) model=i386; ;;
+ sun4u) model=sparc64; ;;
+ arm*) model=arm; ;;
+ ppc) model=powerpc; ;;
+ esac
+ echo $model
+}
+
+archmodel() {
+ local arch=`arch`
+ local model=""
+ if [ $arch = "m68k" ]; then
+ if [ -f /proc/hardware ]; then
+ model=`sed -ne 's/^Model:[[:space:]]*//p' /proc/hardware`
+ case $model in
+ Atari*) model="atari"; ;;
+ Amiga*) model="amiga"; ;;
+ Macintosh*) model="mac"; ;;
+ Motorola*) model="MVME"; ;;
+ *) model="generic"; ;;
+ esac
+ model=".${model}"
+ else
+ echo "/proc/hardware does not exist, assuming general m68k system"
+ model=".generic"
+ fi
+ elif [ $arch = "powerpc" ]; then
+ if [ -f /proc/cpuinfo ]; then
+ model=`sed -ne 's/^machine[[:space:]]*:[[:space:]]*//p' /proc/cpuinfo`
+ case $model in
+ Amiga*) model="apus"; ;;
+ Power*) model="pmac"; ;;
+ *) model="generic"; ;;
+ esac
+ model=".${model}"
+ else
+ echo "/proc/cpuinfo does not exist, assuming general powerpc system"
+ model=".generic"
+ fi
+ fi
+ echo "${arch}${model}"
+}
+
+checkoverwrite() {
+ local cfgfile="$1"
+
+ if [ -f "$cfgfile" ]; then
+ if ! sed -ne 1p "$cfgfile" | grep -q "^$HEADER" ; then
+ echo "Error: the current $cfgfile is not automatically generated." >&2
+ if [ -z "$force" ]; then
+ echo "Use \"update-modules force\" to force (re)generation."
+ exit 1
+ else
+ echo "force specified, (re)generating file anyway."
+ fi
+ fi
+ fi
+}
+
+createfile() {
+ cat <<EOF > "$1"
+$HEADER"
+#
+# Please do not edit this file directly. If you want to change or add
+# anything please take a look at the files in /etc/modutils and read
+# the manpage for update-modules.
+#
+EOF
+}
+
+addfile() {
+ local src="$1"
+ local tgt="$2"
+
+ echo "### update-modules: start processing $src" >> "$tgt"
+ if [ -x "$src" ]; then
+ if ! "$src" >> "$tgt" ; then
+ echo "Error while executing $src, aborting" >&2
+ exit 1
+ fi
+ else
+ cat "$src" >> "$tgt"
+ fi
+ cat <<EOF >> "$tgt"
+
+### update-modules: end processing $cfg
+
+EOF
+}
+
+
+checkoverwrite "$MODCONFFILE"
+
+if [ 0 -ne "`id -u`" ]; then
+ echo "You have to be root to do this." >&2
+ exit 2
+fi
+
+model=`archmodel`
+oldmodel=$model
+
+while [ ! -f "${ARCHDIR}/${model}" ]; do
+ oldmodel=$model
+ model=`echo $oldmodel | sed -e 's/\.[^.]\+//'`
+ if [ "$model" = "$oldmodel" ]; then
+ break
+ fi
+ echo "Configuration for $oldmodel not found, trying $model"
+done
+
+CONF="${ARCHDIR}/${model}"
+
+if [ ! -f "$CONF" ]; then
+ ## echo "Architecture-specific modutils configuration not found, using defaults"
+ CONF="${ARCHDIR}/generic"
+fi
+
+[ -e "$MODCONFFILE" ] && cp -f "$MODCONFFILE" "${MODCONFFILE}.old"
+
+createfile "$MODCONFTMPFILE"
+createfile "$MODULESTMPFILE"
+
+for cfg in /etc/modutils/* $CONF ; do
+ if [ -f "$cfg" ]; then # this check is necesarry to skip /etc/modutils/archs
+ if echo $cfg | grep -q '\.dpkg-[a-z]*\|~$' ; then
+ true
+ elif echo $cfg | grep -q '\.conf$' ; then
+ addfile "$cfg" "$MODCONFTMPFILE"
+ else
+ addfile "$cfg" "$MODULESTMPFILE"
+ fi
+ fi
+done
+
+first_time=0
+if [ ! -f $MODULESFILE ]; then
+ first_time=1
+fi
+
+mv "$MODCONFTMPFILE" "$MODCONFFILE"
+mv "$MODULESTMPFILE" "$MODULESFILE"
+
+if [ $first_time -eq 1 ]; then
+ /etc/init.d/modutils.sh || true
+fi
+
+# 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 || true
+fi
+
+exit 0
+
diff --git a/recipes/update-modules/update-modules_1.0.bb b/recipes/update-modules/update-modules_1.0.bb
new file mode 100644
index 0000000000..0c2d1894ac
--- /dev/null
+++ b/recipes/update-modules/update-modules_1.0.bb
@@ -0,0 +1,37 @@
+SECTION = "base"
+DESCRIPTION = "Script to manage module configuration files"
+LICENSE = "GPLv2"
+PACKAGE_ARCH = "all"
+RDEPENDS = "${@base_contains("MACHINE_FEATURES", "kernel26", "module-init-tools-depmod","modutils-depmod",d)} "
+PR = "r8"
+
+SRC_URI = "file://update-modules"
+
+pkg_postinst() {
+if [ "x$D" != "x" ]; then
+ exit 1
+fi
+update-modules
+}
+
+do_install() {
+ install -d ${D}${sbindir}
+ install ${WORKDIR}/update-modules ${D}${sbindir}
+}
+
+# The Unslung distro uses a 2.4 kernel for a machine (the NSLU2) which
+# supports both 2.4 and 2.6 kernels. Rather than forcing OE to have
+# to deal with that unique legacy corner case, we just nullify the
+# RDEPENDS here and handle it in the Unslung image recipe. I know this
+# is ugly. Please don't remove it unless you first make the RDEPENDS
+# line at the top of this file understand that a machine can be used
+# in both a 2.4 kernel distro and a 2.6 kernel distro. Really, it's
+# not worth the effort to do that, so just overlook the next line.
+RDEPENDS_unslung = ""
+
+# The SlugOS distro is testing the use of the busybox mod* utilities.
+# If that works out, we should create a virtual/update-modules, and
+# let the distros select if they want busybox, or some other package
+# to provide it. Until then, the following line just removes the
+# unwanted dependencies for SlugOS.
+RDEPENDS_slugos = "" \ No newline at end of file