aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Müller <ulm@gentoo.org>2011-08-28 07:52:52 +0000
committerUlrich Müller <ulm@gentoo.org>2011-08-28 07:52:52 +0000
commite331c9410570cf28a9bf9a4452290b3a0bb69c10 (patch)
tree89515807dad53deeb258644b44a43e68043ef95e /modules/kernel.eselect
parentWhitespace. (diff)
downloadeselect-e331c9410570cf28a9bf9a4452290b3a0bb69c10.tar.gz
eselect-e331c9410570cf28a9bf9a4452290b3a0bb69c10.tar.bz2
eselect-e331c9410570cf28a9bf9a4452290b3a0bb69c10.zip
Clean up coding style.
svn path=/trunk/; revision=827
Diffstat (limited to 'modules/kernel.eselect')
-rw-r--r--modules/kernel.eselect30
1 files changed, 15 insertions, 15 deletions
diff --git a/modules/kernel.eselect b/modules/kernel.eselect
index bc5c1e6..0ca28fd 100644
--- a/modules/kernel.eselect
+++ b/modules/kernel.eselect
@@ -1,6 +1,6 @@
# -*-eselect-*- vim: ft=eselect
-# Copyright 1999-2011 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
+# Copyright 2005-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2 or later
# $Id$
DESCRIPTION="Manage the /usr/src/linux symlink"
@@ -36,20 +36,22 @@ find_targets() {
done | sort_kernel_versions
}
-# try to remove the kernel symlink
+# remove the kernel symlink
remove_symlink() {
rm "${EROOT}/usr/src/linux"
}
# set the kernel symlink
set_symlink() {
- local target=${1}
+ local target=$1
+
if is_number "${target}"; then
local targets=( $(find_targets) )
target=${targets[target-1]}
fi
+
if [[ -z ${target} ]]; then
- die -q "Target \"${1}\" doesn't appear to be valid!"
+ die -q "Target \"$1\" doesn't appear to be valid!"
elif [[ -d ${EROOT}/usr/src/${target} ]]; then
ln -s "${target}" "${EROOT}/usr/src/linux"
elif [[ -d ${EROOT}/usr/src/linux-${target} ]]; then
@@ -83,6 +85,7 @@ describe_list() {
do_list() {
local i targets=( $(find_targets) )
+
write_list_start "Available kernel symlink targets:"
for (( i = 0; i < ${#targets[@]}; i++ )); do
[[ ${targets[i]} = \
@@ -107,20 +110,17 @@ describe_set_options() {
}
do_set() {
- if [[ -z ${1} ]]; then
- # no parameter
- die -q "You didn't tell me what to set the symlink to"
- elif [[ -L ${EROOT}/usr/src/linux ]]; then
+ [[ -z $1 ]] && die -q "You didn't tell me what to set the symlink to"
+ [[ $# -gt 1 ]] && die -q "Too many parameters"
+
+ if [[ -L ${EROOT}/usr/src/linux ]]; then
# existing symlink
- if ! remove_symlink; then
- die -q "Couldn't remove existing symlink"
- elif ! set_symlink "${1}"; then
- die -q "Couldn't set a new symlink"
- fi
+ remove_symlink || die -q "Couldn't remove existing symlink"
+ set_symlink "$1" || die -q "Couldn't set a new symlink"
elif [[ -e ${EROOT}/usr/src/linux ]]; then
# we have something strange
die -q "${EROOT}/usr/src/linux exists but is not a symlink"
else
- set_symlink "${1}" || die -q "Couldn't set a new symlink"
+ set_symlink "$1" || die -q "Couldn't set a new symlink"
fi
}