summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Schwarzott <zzam@gentoo.org>2005-08-07 14:37:18 +0000
committerMatthias Schwarzott <zzam@gentoo.org>2005-08-07 14:37:18 +0000
commit75f9ab6a82c35bd3e1cd87cef9cd2d07a0a0bdd9 (patch)
tree929b9185df89fcae3cd4799f00965d1cf178d770 /media-tv/vdrplugin-rebuild
parentCut off parts which are not content of the Academic Free License Version 1.2 ... (diff)
downloadgentoo-2-75f9ab6a82c35bd3e1cd87cef9cd2d07a0a0bdd9.tar.gz
gentoo-2-75f9ab6a82c35bd3e1cd87cef9cd2d07a0a0bdd9.tar.bz2
gentoo-2-75f9ab6a82c35bd3e1cd87cef9cd2d07a0a0bdd9.zip
import of program to rebuild all installed vdrplugins, code and ebuild is from sys-kernel/module-rebuild-0.5
(Portage version: 2.0.51.22-r2)
Diffstat (limited to 'media-tv/vdrplugin-rebuild')
-rw-r--r--media-tv/vdrplugin-rebuild/ChangeLog12
-rw-r--r--media-tv/vdrplugin-rebuild/Manifest3
-rw-r--r--media-tv/vdrplugin-rebuild/files/digest-vdrplugin-rebuild-0.10
-rw-r--r--media-tv/vdrplugin-rebuild/files/vdrplugin-rebuild-0.1292
-rw-r--r--media-tv/vdrplugin-rebuild/metadata.xml9
-rw-r--r--media-tv/vdrplugin-rebuild/vdrplugin-rebuild-0.1.ebuild19
6 files changed, 335 insertions, 0 deletions
diff --git a/media-tv/vdrplugin-rebuild/ChangeLog b/media-tv/vdrplugin-rebuild/ChangeLog
new file mode 100644
index 000000000000..2dd1074b1490
--- /dev/null
+++ b/media-tv/vdrplugin-rebuild/ChangeLog
@@ -0,0 +1,12 @@
+# ChangeLog for media-tv/vdrplugin-rebuild
+# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/media-tv/vdrplugin-rebuild/ChangeLog,v 1.1 2005/08/07 14:37:18 zzam Exp $
+
+*vdrplugin-rebuild-0.1 (07 Aug 2005)
+
+ 07 Aug 2005; Matthias Schwarzott <zzam@gentoo.org>
+ +files/vdrplugin-rebuild-0.1, +metadata.xml,
+ +vdrplugin-rebuild-0.1.ebuild:
+ import of program to rebuild all installed vdrplugins, code and ebuild is
+ from sys-kernel/module-rebuild-0.5
+
diff --git a/media-tv/vdrplugin-rebuild/Manifest b/media-tv/vdrplugin-rebuild/Manifest
new file mode 100644
index 000000000000..7eb31c4828ed
--- /dev/null
+++ b/media-tv/vdrplugin-rebuild/Manifest
@@ -0,0 +1,3 @@
+MD5 e5768673e96c45a7f9263b7eca387cc6 vdrplugin-rebuild-0.1.ebuild 472
+MD5 750a972e5e17c5a07f25dc9f31ba6e6a files/vdrplugin-rebuild-0.1 6689
+MD5 d41d8cd98f00b204e9800998ecf8427e files/digest-vdrplugin-rebuild-0.1 0
diff --git a/media-tv/vdrplugin-rebuild/files/digest-vdrplugin-rebuild-0.1 b/media-tv/vdrplugin-rebuild/files/digest-vdrplugin-rebuild-0.1
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/media-tv/vdrplugin-rebuild/files/digest-vdrplugin-rebuild-0.1
diff --git a/media-tv/vdrplugin-rebuild/files/vdrplugin-rebuild-0.1 b/media-tv/vdrplugin-rebuild/files/vdrplugin-rebuild-0.1
new file mode 100644
index 000000000000..02cd51943bec
--- /dev/null
+++ b/media-tv/vdrplugin-rebuild/files/vdrplugin-rebuild-0.1
@@ -0,0 +1,292 @@
+#!/bin/bash
+#######################################
+# Inspiration from bug #34921
+# Thanks to Paul Varner
+
+# Distributed under the GPL v2
+# Written by John Mylchreest (johnm@gentoo.org)
+
+# Changed for vdrplugins by Matthias Schwarzott (zzam@gentoo.org)
+# Copyright Gentoo Linux
+
+if [[ `id -u` != 0 ]]; then
+ echo "This application must be ran as root."
+ exit 1
+fi
+
+R_VERSION="0.5"
+R_MODULES="${ROOT}/var/lib/vdrplugin-rebuild/vdrplugindb"
+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;
+
+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 vdrplugindb."
+ fi
+}
+
+db_module_add() {
+ local package=${1}
+
+ if db_module_exists ${package}; then
+ echo -e "${C_BOLD}** Module already exists in vdrplugindb.${C_NORM}"
+ db_module_toggle ${package} 1
+ return 0
+ else
+ if package_exists ${package}; then
+ echo -e "${C_BOLD}${C_GREEN}** Adding ${package} to vdrplugindb.${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 vdrplugindb."
+ sed -ie "/.*${package/\//\\/}.*/d" ${R_MODULES}
+ return 0
+ else
+ echo "** ${package} not found in vdrplugindb."
+ 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.
+ for pkg in `grep -i /usr/lib/vdr/.*libvdr.*so ${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
+
+ emerge --oneshot --nodeps ${tomerge[@]}
+}
+
+phelp() {
+cat << EOF
+vdrplugin-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.
+
+Where action is one of:
+ add - Add package to vdrplugindb.
+ del - Delete a package from vdrplugindb.
+ 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 "XC" options; do
+ case ${options} in
+ X) R_OPTION_X='1';;
+ C) R_OPTION_C='1';;
+ *) 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 vdrplugindb doesnt exist, lets populate it automatically.
+if [[ ! -f ${R_MODULES} ]]; then
+ echo -e "${C_BOLD}${C_RED}No vdrplugindb found...${C_NORM}"
+
+ [[ ! -d ${ROOT}/var/lib/vdrplugin-rebuild/ ]] && \
+ echo -e "${C_BOLD}Creating vdrplugindb state directory.${C_NORM}"; \
+ mkdir -p ${ROOT}/var/lib/vdrplugin-rebuild/
+
+ echo -e "${C_BOLD}Populating vdrplugindb...${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/media-tv/vdrplugin-rebuild/metadata.xml b/media-tv/vdrplugin-rebuild/metadata.xml
new file mode 100644
index 000000000000..fb84c475836b
--- /dev/null
+++ b/media-tv/vdrplugin-rebuild/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>media-tv</herd>
+ <maintainer>
+ <email>zzam@gentoo.org</email>
+ <name>Matthias Schwarzott</name>
+ </maintainer>
+</pkgmetadata>
diff --git a/media-tv/vdrplugin-rebuild/vdrplugin-rebuild-0.1.ebuild b/media-tv/vdrplugin-rebuild/vdrplugin-rebuild-0.1.ebuild
new file mode 100644
index 000000000000..cbc6b2758529
--- /dev/null
+++ b/media-tv/vdrplugin-rebuild/vdrplugin-rebuild-0.1.ebuild
@@ -0,0 +1,19 @@
+# Copyright 1999-2005 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-tv/vdrplugin-rebuild/vdrplugin-rebuild-0.1.ebuild,v 1.1 2005/08/07 14:37:18 zzam Exp $
+
+DESCRIPTION="A utility to rebuild any plugins for vdr which you have installed."
+HOMEPAGE="http://www.gentoo.org/"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86"
+IUSE=""
+
+DEPEND=""
+
+src_install() {
+ newsbin ${FILESDIR}/${P} ${PN}
+}
+