source: trunk/base/src/portmgr/dmg/postflight @ 15109

Last change on this file since 15109 was 15109, checked in by jmpp, 15 years ago

Submitted by: jmpp@

Here are the files that are meant for the dp dmg, I believe this to be a
better location. However, they also *need* to live in the files/ dir of the
darwinports dport portdir (i.e. dports/sysutils/darwinports/files), so
having them here might be redundant, not too sure yet.

  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 3.4 KB
Line 
1#!/bin/bash
2#
3# Copyright (c) 2005 Ole Guldberg Jensen <olegb@opendarwin.org>
4# Copyright (c) 2005 Dr. Ernie Prabhakar <drernir@opendarwin.org>
5# Copyright (c) 2005 Matt Anton <matt@opendarwin.org>
6# Copyright (c) 2005 Juan Manuel Palacios <jmpp@opendarwin.org>
7# All rights reserved.
8#
9# Redistribution and use in source and binary forms, with or without
10# modification, are permitted provided that the following conditions
11# are met:
12# 1. Redistributions of source code must retain the above copyright
13#    notice, this list of conditions and the following disclaimer.
14# 2. Redistributions in binary form must reproduce the above copyright
15#    notice, this list of conditions and the following disclaimer in the
16#    documentation and/or other materials provided with the distribution.
17#
18# THIS SOFTWARE IS PROVIDED BY Eric Melville 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 REGENTS 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
31echo ""
32echo "Checking the PATH variable for $USER..."
33echo ""
34
35BINPATH=/opt/local/bin
36SBINPATH=/opt/local/sbin
37TMP=`/usr/bin/mktemp /tmp/dp.$$`
38$SHELL -l <<EOF > $TMP
39    /usr/bin/printenv PATH
40    exit
41EOF
42
43if grep $BINPATH $TMP >/dev/null 2>&1; then
44        echo "You already have the right PATH - l337!"
45else
46    USHELL=`basename $SHELL`
47   echo "Setting the PATH of $USHELL for $USER in ${HOME:=/Users/$USER}..."
48    case $USHELL in
49      *csh)
50        /bin/cp -fp $HOME/.cshrc $HOME/.cshrc.dpsaved   # we backup the original
51        echo "#" >> $HOME/.cshrc
52        echo "# Your previous .cshrc (if any) is saved as .cshrc.dpsaved" >> $HOME/.cshrc
53        echo "# Setting the path for DarwinPorts." >> $HOME/.cshrc
54        echo "set path=($BINPATH $SBINPATH" '$path'")" >> $HOME/.cshrc
55        chown $USER $HOME/.cshrc
56        echo "Finished modifying $HOME/.cshrc"
57       ;;
58      *sh)
59        /bin/cp -fp $HOME/.profile $HOME/.profile.dpsaved # we backup the original
60        echo "#" >> $HOME/.profile
61        echo "# Your previous .profile  (if any) is saved as .profile.dpsaved" >> $HOME/.profile
62        echo "# Setting the path for DarwinPorts." >> $HOME/.profile
63        echo "export PATH=$BINPATH:$SBINPATH:\$PATH" >> $HOME/.profile
64        chown $USER $HOME/.profile
65        echo "Finished modifying $HOME/.profile"
66        ;;
67      *)
68        echo "Unknown shell! Please set your own PATH manually."
69        ;;
70    esac
71fi
72
73export PATH=$BINPATH:$PATH
74
75# run selfupdate
76
77echo""
78echo "Selfupdating The DarwinPorts system ..."
79echo ""
80
81port -d selfupdate
82if [ $? != 0 ]; then
83    echo "An attempt to synchronize your recent DarwinPorts installation with OpenDarwin servers failed, please run 'port -d selfupdate' manually to find out the cause of the error."
84    exit
85fi
86
87# done !!
88echo ""
89echo "You have succesfully installed the DarwinPorts system."
90echo ""
91echo "Launch a terminal and try it out !!"
92echo "Read the port manualpage for help."
93echo ""
Note: See TracBrowser for help on using the repository browser.