diff options
author | John Mylchreest <johnm@gentoo.org> | 2005-06-30 17:27:02 +0000 |
---|---|---|
committer | John Mylchreest <johnm@gentoo.org> | 2005-06-30 17:27:02 +0000 |
commit | 705e9780d67bea524b0c1745fadf6525eca4f643 (patch) | |
tree | cdaf6d88a1187b1f25ce6bea50a93bb6aab0d41c /sys-kernel/module-rebuild/files | |
parent | Fix use invocation (diff) | |
download | historical-705e9780d67bea524b0c1745fadf6525eca4f643.tar.gz historical-705e9780d67bea524b0c1745fadf6525eca4f643.tar.bz2 historical-705e9780d67bea524b0c1745fadf6525eca4f643.zip |
Moving root check. Fixing bug #94424 - thanks mostly to Timothy Kilbourn.
Package-Manager: portage-2.0.51.22-r1
Diffstat (limited to 'sys-kernel/module-rebuild/files')
-rw-r--r-- | sys-kernel/module-rebuild/files/digest-module-rebuild-0.3 (renamed from sys-kernel/module-rebuild/files/digest-module-rebuild-0.2) | 0 | ||||
-rwxr-xr-x | sys-kernel/module-rebuild/files/module-rebuild-0.3 (renamed from sys-kernel/module-rebuild/files/module-rebuild-0.2) | 38 |
2 files changed, 21 insertions, 17 deletions
diff --git a/sys-kernel/module-rebuild/files/digest-module-rebuild-0.2 b/sys-kernel/module-rebuild/files/digest-module-rebuild-0.3 index e69de29bb2d1..e69de29bb2d1 100644 --- a/sys-kernel/module-rebuild/files/digest-module-rebuild-0.2 +++ b/sys-kernel/module-rebuild/files/digest-module-rebuild-0.3 diff --git a/sys-kernel/module-rebuild/files/module-rebuild-0.2 b/sys-kernel/module-rebuild/files/module-rebuild-0.3 index 42bdc7c035c1..d70d29966e1c 100755 --- a/sys-kernel/module-rebuild/files/module-rebuild-0.2 +++ b/sys-kernel/module-rebuild/files/module-rebuild-0.3 @@ -7,7 +7,12 @@ # Written by John Mylchreest (johnm@gentoo.org) # Copyright Gentoo Linux -R_VERSION="0.2" +if [[ `id -u` != 0 ]]; then + echo "This application must be ran as root." + exit 1 +fi + +R_VERSION="0.3" R_MODULES="${ROOT}/usr/share/module-rebuild/moduledb" R_PORTAGEQ="`which portageq 2>/dev/null`" if [[ -z ${R_PORTAGEQ} ]]; then @@ -31,13 +36,13 @@ package_valid() { package_valid_strict() { local package=${1} - package_valid ${package} && [[ -z ${package//*-[0-9]*} ]] && return 0 || return 1 + package_valid ${package} && [[ -z ${package%-[0-9]*} ]] && return 0 || return 1 } package_exists() { local package=${1} - package=${package//-[0-9]*} + package=${package%-[0-9]*} if $(${R_PORTAGEQ} has_version / ${package}); then return 0 else @@ -128,16 +133,20 @@ db_module_list() { echo -e "${C_BOLD}${C_RED}** There are no known modules. 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 - echo -e "${C_BOLD}${C_GREEN}** Packages which I will ignore are:${C_NORM}" - for pkg in ${toignore[@]}; do - echo -e "\t${pkg}" - done + 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() { @@ -209,11 +218,6 @@ EOF } -if [[ `id -u` != 0 ]]; then - echo "This application must be ran as root." - exit 1 -fi - if [[ ! -f ${ROOT}/usr/share/module-rebuild/moduledb ]]; then [[ ! -d ${ROOT}/usr/share/module-rebuild/ ]] && mkdir ${ROOT}/usr/share/module-rebuild/ touch ${ROOT}/usr/share/module-rebuild/moduledb |