source: branches/gsoc08-privileges/base/setupenv.bash.in @ 65055

Last change on this file since 65055 was 38145, checked in by pmagrath@…, 12 years ago

Merged revisions 38101-38102,38107,38109,38114-38115 via svnmerge from
https://svn.macosforge.org/repository/macports/trunk/base

........

r38101 | raimue@… | 2008-07-06 17:41:47 +0100 (Sun, 06 Jul 2008) | 3 lines


doc/Makefile:
gzip man pages on make all

........

r38102 | raimue@… | 2008-07-06 17:43:33 +0100 (Sun, 06 Jul 2008) | 3 lines


doc:
Ignore generated gzipped man pages

........

r38107 | raimue@… | 2008-07-06 19:49:40 +0100 (Sun, 06 Jul 2008) | 3 lines


Makefile.in:
Remove Doxyfile on distclean

........

r38109 | raimue@… | 2008-07-06 21:27:48 +0100 (Sun, 06 Jul 2008) | 5 lines


base:
Add a new setupenv.sh script which can be used to setup the environment for
MacPorts. It will be installed to ${prefix}/share/macports/setupenv.sh and can
be sourced from your profile.

........

r38114 | raimue@… | 2008-07-07 01:38:32 +0100 (Mon, 07 Jul 2008) | 3 lines


base:
Rename setupenv.sh to setupenv.bash to reflect that it is for bash only

........

r38115 | raimue@… | 2008-07-07 02:00:40 +0100 (Mon, 07 Jul 2008) | 3 lines


setupenv.bash.in:
Set svn:keywords=Id and svn:eol-style=native

........

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.8 KB
Line 
1# -*- coding: utf-8; mode: shell-script-mode; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=sh:et:sw=4:ts=4:sts=4
2#
3# Copyright (c) 2008 Rainer Mueller <raimue@macports.org>, The MacPorts Project.
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions
8# are met:
9# 1. Redistributions of source code must retain the above copyright
10#    notice, this list of conditions and the following disclaimer.
11# 2. Redistributions in binary form must reproduce the above copyright
12#    notice, this list of conditions and the following disclaimer in the
13#    documentation and/or other materials provided with the distribution.
14# 3. Neither the name of Apple, Inc., The MacPorts Project nor the
15#    names of its contributors may be used to endorse or promote products
16#    derived from this software without specific prior written permission.
17#
18# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
19# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
22# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28# SUCH DAMAGE.
29#
30# $Id: setupenv.bash.in 38145 2008-07-08 20:39:57Z pmagrath@macports.org $
31
32function export_path() {
33    local binpath="@prefix_expanded@/bin"
34    local sbinpath="@prefix_expanded@/sbin"
35
36    local IFS=":"
37    for p in $PATH; do
38        if [ "$p" == "$binpath" ]; then
39            binpath=""
40        elif [ "$p" == "$sbinpath" ]; then
41            sbinpath=""
42        fi
43    done
44
45    if [ -n "$binpath" ]; then
46        binpath+=":"
47    fi
48
49    if [ -n "$sbinpath" ]; then
50        sbinpath+=":"
51    fi
52
53    export PATH="${binpath}${sbinpath}${PATH}"
54}
55
56function export_manpath() {
57    mpath="@prefix_expanded@/share/man"
58
59    local IFS=":"
60    for p in $MANPATH; do
61        if [ "$p" == "$mpath" ]; then
62            mpath=""
63        fi
64    done
65
66    if [ -n "$mpath" ]; then
67        mpath+=":"
68    fi
69
70    export MANPATH="${mpath}${MANPATH}"
71}
72
73function export_display() {
74    if [ -z $DISPLAY ]; then
75        export DISPLAY=":0.0"
76    fi
77}
78
79export_path
80export_manpath
81export_display
82
83# Remove defined functions to prevent them from cluttering the shell,
84# but they are needed to restrict variables to the local scope
85unset export_path
86unset export_manpath
87unset export_display
Note: See TracBrowser for help on using the repository browser.