summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'sys-kernel/module-rebuild')
-rw-r--r--sys-kernel/module-rebuild/ChangeLog10
-rw-r--r--sys-kernel/module-rebuild/Manifest14
-rw-r--r--sys-kernel/module-rebuild/files/module-rebuild-0.7298
-rw-r--r--sys-kernel/module-rebuild/module-rebuild-0.7.ebuild18
4 files changed, 337 insertions, 3 deletions
diff --git a/sys-kernel/module-rebuild/ChangeLog b/sys-kernel/module-rebuild/ChangeLog
index 32e7bac5b78c..67f4fcba3952 100644
--- a/sys-kernel/module-rebuild/ChangeLog
+++ b/sys-kernel/module-rebuild/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for sys-kernel/module-rebuild
-# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-kernel/module-rebuild/ChangeLog,v 1.15 2008/10/31 22:53:43 dsd Exp $
+# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/sys-kernel/module-rebuild/ChangeLog,v 1.16 2011/04/04 15:27:27 mpagano Exp $
+
+*module-rebuild-0.7 (04 Apr 2011)
+
+ 04 Apr 2011; Mike Pagano <mpagano@gentoo.org> +files/module-rebuild-0.7,
+ +module-rebuild-0.7.ebuild:
+ Version bump to support paludis cave. See bug #345403
*module-rebuild-0.6 (31 Oct 2008)
diff --git a/sys-kernel/module-rebuild/Manifest b/sys-kernel/module-rebuild/Manifest
index c455da07c2ab..9b2372394dff 100644
--- a/sys-kernel/module-rebuild/Manifest
+++ b/sys-kernel/module-rebuild/Manifest
@@ -1,6 +1,18 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
AUX module-rebuild-0.5 6574 RMD160 58299a46e61ce38fa4b9089c89225ee3912c1e70 SHA1 65594652c4fc542a5c676b441573317e00eb41fd SHA256 849a11601b47a4b7b864db28bc4e3a143acc08d286997d44a8ac0c4e58d20771
AUX module-rebuild-0.6 6933 RMD160 b25ad7d326163a926a90a2200b6d0f955eb81933 SHA1 7d9ef90ec0edfc8baa3f94ea0112646484fdea0e SHA256 2dc994fd87871b14bb5e55cd090c943d04f1b8473fa63291ee99bd35c3b9b254
+AUX module-rebuild-0.7 6922 RMD160 c7738efc7eff199b2fda8077a36de7bc47232ce7 SHA1 8804c8bfc1a4654db438d5c1a6a17945718b1de7 SHA256 efd1601038227be5c7a19f716779b266292aadc0e81abac3919e5588f9dc2b7c
EBUILD module-rebuild-0.5.ebuild 513 RMD160 75c629e15673b9e5340ac04e12caea9f345a18b3 SHA1 e167953fdbdfa494da25685fc29c20dd96443b91 SHA256 9bf399462df1a600b1bd66776f143fa5d8c62dfa347a90646020b53002b02cee
EBUILD module-rebuild-0.6.ebuild 522 RMD160 cededf1c443e32e019feb35f20d71ac8bc7e8742 SHA1 dc124b026c4c33585cdbcafc556dbddd7460214b SHA256 420271dd86a4a768bff293b93ccd20250498e29b88107d7dcc3844dd84cc0c16
-MISC ChangeLog 2863 RMD160 56a0d6b5d5bc947ba016858bb212cd0a2295ace8 SHA1 d0f859536ccb03f35e5060ed9e9ae121e87a20c5 SHA256 dedc1d861679819a2fd3afabb581b0dc4847f198e832c2975c8aeaf6a8e4f8cb
+EBUILD module-rebuild-0.7.ebuild 526 RMD160 43c36aee31bfb8651d13e9d181db9f8609c30dca SHA1 6f17940dcd697d0048ce2e99b6e4781546a60893 SHA256 8a70258e552cfbfa5f8da6a220a40f3a2cf33accba60c969bc666457a3bc4860
+MISC ChangeLog 3064 RMD160 1dc8744103e041ac1b41a6c39023286e17c49f51 SHA1 96cc37096485133b6cdad2a410bbb0b29e543785 SHA256 39659a449b690ee1a7c40c2d0c906731b061688929a4e7dc36728dc5f72a1c05
MISC metadata.xml 374 RMD160 8587ffda4241e8308e8c5d5d9de421fae958b47e SHA1 3a87927807d5454227501f23c31c679086f2e5a6 SHA256 85a863924bc35fee3224ab93d56c712819336b50ad712a474a780d016c72b22d
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.17 (GNU/Linux)
+
+iEYEARECAAYFAk2Z42cACgkQPDPGULV25OM/egCff6kd0EvHnIFku/h7PimbDwTd
+ueYAmwVYsQsVaGRThcRyh/bFvbjziutS
+=+wbP
+-----END PGP SIGNATURE-----
diff --git a/sys-kernel/module-rebuild/files/module-rebuild-0.7 b/sys-kernel/module-rebuild/files/module-rebuild-0.7
new file mode 100644
index 000000000000..75cd4475cffb
--- /dev/null
+++ b/sys-kernel/module-rebuild/files/module-rebuild-0.7
@@ -0,0 +1,298 @@
+#!/bin/bash
+#######################################
+# Inspiration from bug #34921
+# Thanks to Paul Varner
+
+# Distributed under the GPL v2
+# Written by John Mylchreest (johnm@gentoo.org)
+# Copyright Gentoo Linux
+
+if [[ `id -u` != 0 ]]; then
+ echo "This application must be run as root."
+ exit 1
+fi
+
+R_VERSION="0.7"
+R_MODULES="${ROOT}/var/lib/module-rebuild/moduledb"
+R_PORTAGEQ="`which portageq 2>/dev/null`"
+if [[ -z ${R_PORTAGEQ} ]]; then
+ echo "** FATAL: Unable to find portageq."
+ exit 1
+fi
+R_PORTDIR=`${R_PORTAGEQ} portdir`
+R_VDBPATH=`${R_PORTAGEQ} vdb_path`
+R_OPTION_X=0;
+R_OPTION_C=0;
+R_OPTION_PM="portage";
+
+package_valid() {
+ local package=${1}
+ [[ -z ${package} ]] && return 1
+ [[ -z ${package/*\/*} ]] && return 0 || return 1
+}
+
+package_valid_strict() {
+ local package=${1}
+ package_valid ${package} && [[ -z ${package%%*-[0-9]*} ]] && return 0 || return 1
+}
+
+package_exists() {
+ local package=${1}
+
+ package=${package%-[0-9]*}
+ if $(${R_PORTAGEQ} has_version / ${package}); then
+ return 0
+ else
+ return 1
+ fi
+}
+
+db_module_exists() {
+ local line package=${1}
+
+ for line in `<${R_MODULES}`; do
+ [[ -z ${line/*${package}*} ]] && return 0
+ done
+ return 1
+}
+
+db_module_toggle() {
+ local package=${1} toggleto=${2} togglefrom line
+
+ if db_module_exists ${package}; then
+ line=`grep ${package} ${R_MODULES}`
+ togglefrom=${line#*:}
+ togglefrom=${togglefrom/:*}
+ if [[ -z ${toggleto} ]]; then
+ [[ ${togglefrom} = 0 ]] && toggleto=1 || toggleto=0
+ fi
+ echo "** Setting ${package}; rebuild=${toggleto}."
+ sed -i -e "s:\(.\:\)\([01]\)\(\:${package}\):\1${toggleto}\3:g" ${R_MODULES}
+ else
+ echo "** ${package} not found in moduledb."
+ fi
+}
+
+db_module_add() {
+ local package=${1}
+
+ if db_module_exists ${package}; then
+ echo -e "${C_BOLD}** Module already exists in moduledb.${C_NORM}"
+ db_module_toggle ${package} 1
+ return 0
+ else
+ if package_exists ${package}; then
+ echo -e "${C_BOLD}${C_GREEN}** Adding ${package} to moduledb.${C_NORM}"
+ echo "m:1:${package}" >> ${R_MODULES}
+ return 0
+ else
+ echo -e "${C_RED}** Unable to locate an available ebuild for ${package}.${C_NORM}"
+ echo "** Please manually emerge ${package} first."
+ fi
+ fi
+ return 1
+}
+
+db_module_del() {
+ local package=${1}
+
+ if db_module_exists ${package}; then
+ echo "** Removing ${package} from moduledb."
+ sed -ie "/.*${package/\//\\/}.*/d" ${R_MODULES}
+ return 0
+ else
+ echo "** ${package} not found in moduledb."
+ return 1
+ fi
+}
+
+db_module_list() {
+ local line auto pkg a=0 b=0
+
+ for line in `<${R_MODULES}`; do
+ mode=${line:0:1}
+ pkg=${line#*:}
+ auto=${pkg/:*}
+ pkg=${pkg/*:}
+
+ if [[ ${R_OPTION_X} == 1 ]]; then
+ pkg=${pkg%-[0-9]*}
+ package_valid ${pkg}
+ else
+ package_valid_strict ${pkg} && pkg="=${pkg}"
+ fi
+
+ if [[ ${auto} = 1 ]]; then
+ tomerge[${a}]=${pkg}
+ a=$((${a} + 1))
+ else
+ toignore[${b}]=${pkg}
+ b=$((${b} + 1))
+ fi
+ done
+
+ pkg="${tomerge[@]}${toignore[@]}"
+ if [[ -z ${pkg} ]]; then
+ echo -e "${C_BOLD}${C_RED}** There are no known modules. Quitting.${C_NORM}"
+ exit 1
+ fi
+
+ if [[ -n ${tomerge[@]} ]]; then
+ echo -e "${C_BOLD}${C_GREEN}** Packages which I will emerge are:${C_NORM}"
+ for pkg in ${tomerge[@]}; do
+ echo -e "\t${pkg}"
+ done
+ fi
+
+ if [[ -n ${toignore[@]} ]]; then
+ echo -e "${C_BOLD}${C_GREEN}** Packages which I will ignore are:${C_NORM}"
+ for pkg in ${toignore[@]}; do
+ echo -e "\t${pkg}"
+ done
+ fi
+}
+
+db_module_populate() {
+ local i x=0 pkg version list pad
+
+ # Lets find them all
+ # chances are we will get a few dupes in here.
+ version=`uname -r`
+ for pkg in `grep -i /lib/modules/${version}/.*o ${R_VDBPATH}/*/*/CONTENTS`; do
+ pad=""; x=0;
+
+ if [[ -z ${pkg//${R_VDBPATH}*} ]]; then
+ for((i=0;i<=${#pkg};i++)); do
+ [[ ${pkg:${i}:1} = / ]] && x=$((${x} + 1));
+ [[ ${x} == 4 ]] || [[ ${x} == 5 ]] && pad="${pad}${pkg:${i}:1}";
+ done
+ # Remove any dupes
+ list=${list//${pad:1}}
+ list="${list} ${pad:1}"
+ fi
+ done
+
+ for pkg in ${list}; do
+ db_module_add ${pkg};
+ done
+}
+
+db_module_merge() {
+ local i pkg
+
+ echo -e "${C_BOLD}** Preparing to merge modules:${C_NORM}"
+ db_module_list >/dev/null
+
+ if [[ -z ${tomerge[@]} ]]; then
+ echo -e "${C_BOLD}${C_RED}** No packages to merge. Quitting.${C_NORM}"
+ exit 1
+ fi
+
+ echo -e "${C_BOLD}${C_GREEN}** Packages which I will emerge are:"${C_NORM}
+ for pkg in ${tomerge[@]}; do
+ echo -e "\t${pkg}"
+ done
+
+ for((i=1;i<6;i++)); do
+ echo -en "${C_BOLD}${C_RED}$((6 - ${i})) ${C_NORM}"
+ sleep 1
+ done
+ echo
+
+ case ${R_OPTION_PM} in
+ portage) emerge --ignore-default-opts --oneshot --nodeps ${tomerge[@]};;
+ paludis) cave resolve --execute --preserve-world --continue-on-failure if-satisfied --lazy ${tomerge[@]};;
+ *) echo "** Unsupported package manager"; phelp; exit 1;;
+ esac
+}
+
+phelp() {
+cat << EOF
+module-rebuild [options] action [category/package]
+Version: ${R_VERSION}
+
+Where options are:
+ -X - Emerge based on package names,
+ not exact versions.
+ -C - Disable all coloured output.
+ -P foo - Specify package manager: portage(default) or paludis
+
+Where action is one of:
+ add - Add package to moduledb.
+ del - Delete a package from moduledb.
+ toggle - Toggle auto-rebuild of Package.
+ list - List packages to auto-rebuild.
+ rebuild - Rebuild packages.
+ populate - Populate the database with any
+ packages which currently install
+ drivers into the running kernel.
+
+EOF
+
+}
+
+check_validity() {
+ local package=${1} strict=${2:-0} ret=1
+
+ [[ ${strict} = 0 ]] && package_valid ${package} && ret=0
+ [[ ${strict} = 1 ]] && package_valid_strict ${package} && ret=0
+
+ if [[ ${ret} != 0 ]]; then
+ echo "** Please pass the fully qualified package. For example:"
+ echo "** media-video/nvidia-kernel-1.0.7174"
+ exit 1
+ fi
+}
+
+while getopts "XCP:" options; do
+ case ${options} in
+ X) R_OPTION_X='1';;
+ C) R_OPTION_C='1';;
+ P) R_OPTION_PM="$OPTARG";;
+ *) phelp; exit 1;;
+ esac
+done
+
+if [[ ${R_OPTION_C} == 0 ]]; then
+ C_BOLD='\e[1m'
+ C_NORM='\e[0m'
+ C_GREEN='\e[32m'
+ C_RED='\e[31m'
+else
+ C_BOLD=''
+ C_NORM=''
+ C_GREEN=''
+ C_RED=''
+fi
+
+x=0
+for i in ${@:${OPTIND}}; do
+ if [[ ${i:0:1} != - ]]; then
+ R_PARAMS[${x}]=${i}
+ x=$((${x} + 1))
+ fi
+done
+unset i x
+
+# If the moduledb doesnt exist, lets populate it automatically.
+if [[ ! -f ${R_MODULES} ]]; then
+ echo -e "${C_BOLD}${C_RED}No moduledb found...${C_NORM}"
+
+ [[ ! -d ${ROOT}/var/lib/module-rebuild/ ]] && \
+ echo -e "${C_BOLD}Creating moduledb state directory.${C_NORM}"; \
+ mkdir -p ${ROOT}/var/lib/module-rebuild/
+
+ echo -e "${C_BOLD}Populating moduledb...${C_NORM}"
+ touch ${R_MODULES}
+ R_PARAMS[0]=populate
+fi
+
+case ${R_PARAMS[0]} in
+ add) check_validity ${R_PARAMS[1]} 1; db_module_add ${R_PARAMS[1]};;
+ del) check_validity ${R_PARAMS[1]}; db_module_del ${R_PARAMS[1]};;
+ toggle) check_validity ${R_PARAMS[1]}; db_module_toggle ${R_PARAMS[1]};;
+ list) db_module_list;;
+ rebuild) db_module_merge;;
+ populate) db_module_populate;;
+ *) phelp; exit 1;;
+esac
diff --git a/sys-kernel/module-rebuild/module-rebuild-0.7.ebuild b/sys-kernel/module-rebuild/module-rebuild-0.7.ebuild
new file mode 100644
index 000000000000..fedbb0e5f7bd
--- /dev/null
+++ b/sys-kernel/module-rebuild/module-rebuild-0.7.ebuild
@@ -0,0 +1,18 @@
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-kernel/module-rebuild/module-rebuild-0.7.ebuild,v 1.1 2011/04/04 15:27:27 mpagano Exp $
+
+DESCRIPTION="A utility to rebuild any kernel modules which you have installed"
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~ppc ~s390 ~sh ~sparc ~x86"
+IUSE=""
+
+DEPEND=""
+
+src_install() {
+ newsbin "${FILESDIR}"/${P} ${PN} || die
+}