source: orange/install-scripts/mac/fink-selfupdate-orange.sh @ 9170:d07edbb05748

Revision 9170:d07edbb05748, 5.1 KB checked in by mitar, 2 years ago (diff)

Updated our Fink selfupdate script. See #1003

  • Property exe set to *
Line 
1#!/bin/bash -e
2#
3# Should be run as: sudo ./fink-selfupdate-orange.sh [/path/to/fink/root]
4#
5
6# Default is /sw
7FINK_ROOT=${1:-/sw}
8
9MAC_VERSION=`sw_vers -productVersion | cut -d '.' -f 2`
10
11# Sets error handler
12trap "echo \"Script failed\"" ERR
13
14((`id -u` == 0)) || { echo "Must run as root user (use sudo)."; exit 1; }
15
16test -r $FINK_ROOT/bin/init.sh || { echo "Fink cannot be found." exit 2; }
17
18# Configures environment for Fink
19. $FINK_ROOT/bin/init.sh
20
21if [ -e $FINK_ROOT/fink/dists/ailab/ ]; then
22    echo "Removing obsolete local ailab Fink info files repository."
23    rm -rf "$FINK_ROOT/fink/dists/ailab/"
24fi
25
26echo "Preparing local biolab Fink info files repository."
27mkdir -p $FINK_ROOT/fink/dists/biolab/main/finkinfo/
28rm -f $FINK_ROOT/fink/dists/biolab/main/finkinfo/*
29
30# Gets current (daily) info files from SVN
31echo "Updating local biolab Fink info files repository."
32curl "http://orange.biolab.si/fink/dists/10.$MAC_VERSION/main/finkinfo/all.tgz" --output $FINK_ROOT/fink/dists/biolab/main/finkinfo/all.tgz
33tar -xzf $FINK_ROOT/fink/dists/biolab/main/finkinfo/all.tgz -C $FINK_ROOT/fink/dists/biolab/main/finkinfo/
34rm -f $FINK_ROOT/fink/dists/biolab/main/finkinfo/all.tgz
35
36if grep '^Trees:' $FINK_ROOT/etc/fink.conf | grep -q 'ailab/main'; then
37    echo "Removing obsolete local ailab Fink info files repository from Fink configuration."
38    perl -p -i -l -e 's| ?ailab/main||g if /^Trees/' $FINK_ROOT/etc/fink.conf   
39fi
40
41if ! grep '^Trees:' $FINK_ROOT/etc/fink.conf | grep -q 'biolab/main'; then
42    echo "Adding local biolab Fink info files repository to Fink configuration."
43    perl -p -i -l -e '$_ = "$_ biolab/main" if /^Trees/' $FINK_ROOT/etc/fink.conf
44fi
45
46if ! grep -q '^UseBinaryDist:.*true' $FINK_ROOT/etc/fink.conf; then
47    echo "Enabling Fink binary packages repositories."
48    perl -p -i -l -e 's/^UseBinaryDist:.*false/UseBinaryDist: true/' $FINK_ROOT/etc/fink.conf
49fi
50
51# Adds our binary repository to local Fink (APT) configuration if on Mac OS X versions we provide binary packages for
52if grep -q "ailab" $FINK_ROOT/etc/apt/sources.list; then
53    echo "Removing obsolete ailab Fink binary packages repository from Fink configuration."
54    grep -v "ailab" $FINK_ROOT/etc/apt/sources.list > $FINK_ROOT/etc/apt/sources.list.new
55    mv $FINK_ROOT/etc/apt/sources.list.new $FINK_ROOT/etc/apt/sources.list
56    apt-get update
57fi
58
59if [[ "$MAC_VERSION" -eq 5 || "$MAC_VERSION" -eq 6 ]] && ! grep -q "deb http://orange.biolab.si/fink 10.$MAC_VERSION main" $FINK_ROOT/etc/apt/sources.list; then
60    echo "Adding biolab Fink binary packages repository to Fink configuration."
61    echo "deb http://orange.biolab.si/fink 10.$MAC_VERSION main" >> $FINK_ROOT/etc/apt/sources.list
62fi
63
64# Refreshes packages lists
65fink --yes scanpackages
66fink --yes index
67
68cat <<-EOMSG
69   
70    Information about biolab packages have been updated. You can now update installed
71    packages using:
72   
73        fink update-all
74   
75    You can list available biolab packages using commands like:
76   
77        fink list --tab orange
78   
79    and you can install them using commands like:
80   
81        fink install orange-gui-svn-py27
82EOMSG
83
84if ! grep '^Trees:' $FINK_ROOT/etc/fink.conf | grep -q 'unstable/main' || grep '^SelfUpdateMethod:' $FINK_ROOT/etc/fink.conf | grep -q 'point'; then
85    cat <<-EOMSG
86       
87        WARNING: Your local Fink installation does not seem to use unstable Fink
88                 packages tree with rsync or CVS updating. This means that it could
89                 happen that some package on which biolab packages depend will not be
90                 found or possible to install. In this case please configure Fink to
91                 use unstable tree using:
92                 
93                     fink selfupdate-rsync
94                     fink configure
95                 
96                 and after that upgrade Fink to rsync updating using:
97                 
98                     fink scanpackages
99                     ./fink-selfupdate-orange.sh
100                     fink selfupdate
101                     fink selfupdate-rsync
102                     fink update-all
103    EOMSG
104   
105    if [ ! -x /usr/bin/xcodebuild ]; then
106        cat <<-EOMSG
107                     
108                     You will need Xcode installed on a system for above commands to work
109                     correctly as it is a requirement for unstable Fink packages tree. You
110                     can install it from your Mac OS X installation disk or from:
111                     
112                         http://developer.apple.com/technology/xcode.html
113        EOMSG
114    fi
115fi
116
117if [ $MAC_VERSION -lt "5" ] && [ ! -x /usr/X11/bin/X ]; then
118    cat <<-EOMSG
119       
120        WARNING: It seems you do not have X11 installed on a system. This means that it
121                 could happen that some package on which biolab packages depend will fail
122                 to run or compile. In this case please install it from your Mac OS X
123                 installation disk.
124    EOMSG
125elif [ $MAC_VERSION -ge "5" ] && [ ! "`/usr/X11/bin/X -version 2>&1 | grep '^X.Org X Server' | grep -E -o '[0-9]+\.[0-9]+\.[0-9]+' | cut -d '.' -f 2`" -gt "3" ]; then
126    cat <<-EOMSG
127       
128        WARNING: It seems you do not have X11 version 2.3.0 or later installed on a
129                 system. This means that it could happen that some package on which
130                 biolab packages depend will fail to run or compile. In this case
131                 please install it from your Mac OS X installation disk or from:
132                 
133                     http://xquartz.macosforge.org/trac/wiki
134    EOMSG
135fi
Note: See TracBrowser for help on using the repository browser.