aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Walker <ka0ttic@gentoo.org>2005-10-18 11:53:44 +0000
committerAaron Walker <ka0ttic@gentoo.org>2005-10-18 11:53:44 +0000
commit50e058737b6ff4a58f99ac6ae20bce3a88300d22 (patch)
tree142ddd3a64269dbc1ed1f018adaa7c6154d762d2
parentAdded write_warning_msg function. (diff)
downloadeselect-50e058737b6ff4a58f99ac6ae20bce3a88300d22.tar.gz
eselect-50e058737b6ff4a58f99ac6ae20bce3a88300d22.tar.bz2
eselect-50e058737b6ff4a58f99ac6ae20bce3a88300d22.zip
Have arch() use new write_warning_msg to print a warning and return 1 if it cannot determine the arch instead of die()'ing, as the caller may want to do something anyways and exit successfully ('eselect profile set --force' for example).
svn path=/trunk/; revision=228
-rw-r--r--ChangeLog5
-rw-r--r--libs/portage.bash.in63
2 files changed, 40 insertions, 28 deletions
diff --git a/ChangeLog b/ChangeLog
index 7a1df1b..01490ff 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,11 @@ ChangeLog for eselect
* libs/output.bash.in, doc/developer-guide.txt: Added
write_warning_msg function. Similar to write_error_msg but uses "!!!
Warning" and ${COLOUR_WARN}.
+ * libs/portage.bash.in: Have arch() use new write_warning_msg to print
+ a warning and return 1 if it cannot determine the arch instead of
+ die()'ing as the caller may want to do something anyways and exit
+ successfully ("eselect profile set --force" for example). Also fixed
+ errant 'i' in '[[ -z ${ROOT}i ]]' and also fixed indenting.
2005-10-17 Aaron Walker <ka0ttic@gentoo.org>
diff --git a/libs/portage.bash.in b/libs/portage.bash.in
index d38b71c..8fa29ca 100644
--- a/libs/portage.bash.in
+++ b/libs/portage.bash.in
@@ -20,37 +20,44 @@
# arch
# Return the architecture we're running on...
arch() {
- local ret=$(portageq envvar ARCH 2>/dev/null) suffix
+ local ret=$(portageq envvar ARCH 2>/dev/null) suffix
- # $arch will be null if there's no current make.profile symlink
- # we cannot get a list of valid profiles without it.
- if [[ -z ${ret} ]] ; then
- [[ -z ${ROOT}i || ${ROOT} == / ]] \
- || die -q "Failed to determine \${ARCH}. Is your make.profile symlink valid?"
- ret=$(uname -m)
- case ${ret} in
- alpha|ia64|ppc) ;;
- i?86) ret=x86 ;;
- mips*) ret=mips ;;
- sparc*) ret=sparc ;;
- x86_64) ret=amd64 ;;
- *) die \
- "Unknown architecture. Please submit a bug including the output of 'uname -m'!"
- ;;
- esac
+ # $arch will be null if there's no current make.profile symlink
+ # we cannot get a list of valid profiles without it.
+ if [[ -z ${ret} ]] ; then
+
+ if [[ -n "${ROOT}" && ${ROOT} != "/" ]] ; then
+ write_warning_msg "Failed to determine \${ARCH}. Is your make.profile symlink valid?"
+ return 1
+ fi
- case $(uname -s) in
- Linux) ;;
- FreeBSD) suffix="-fbsd" ;;
- NetBSD) suffix="-nbsd" ;;
- DragonFly) suffix="-dfly" ;;
- *) die \
- "Unknown OS. Please submit a bug including the output of 'uname -s'!"
- ;;
- esac
- fi
+ ret=$(uname -m)
+ case ${ret} in
+ alpha|ia64|ppc) ;;
+ i?86) ret=x86 ;;
+ mips*) ret=mips ;;
+ sparc*) ret=sparc ;;
+ x86_64) ret=amd64 ;;
+ *) write_warning_msg \
+ "Unknown architecture. Please submit a bug including the output of 'uname -m'!"
+ return 1
+ ;;
+ esac
- echo ${ret}${suffix}
+ case $(uname -s) in
+ Linux) ;;
+ FreeBSD) suffix="-fbsd" ;;
+ NetBSD) suffix="-nbsd" ;;
+ OpenBSD) suffix="-obsd" ;;
+ DragonFly) suffix="-dfly" ;;
+ *) write_warning_msg \
+ "Unknown OS. Please submit a bug including the output of 'uname -s'!"
+ return 1
+ ;;
+ esac
+ fi
+
+ echo ${ret}${suffix}
}