1#!/bin/sh
2#
3# install-darwin.sh used to install SSWF from a .dmg
4# on Mac OS/X 10.x
5# Written by Alexis Wilke
6#
7# Copyright (c) 2004-2009 Made to Order Software Corp.
8#
9# Permission is hereby granted, free of charge, to any
10# person obtaining a copy of this software and
11# associated documentation files (the "Software"), to
12# deal in the Software without restriction, including
13# without limitation the rights to use, copy, modify,
14# merge, publish, distribute, sublicense, and/or sell
15# copies of the Software, and to permit persons to whom
16# the Software is furnished to do so, subject to the
17# following conditions:
18#
19# The above copyright notice and this permission notice
20# shall be included in all copies or substantial
21# portions of the Software.
22#
23# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
24# ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
25# LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
26# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
27# EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
28# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
29# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
30# ARISING FROM, OUT OF OR IN CONNECTION WITH THE
31# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32# SOFTWARE.
33#
34
35
36set -e
37
38echo "This script will install SSWF on your Macintosh"
39echo "It requires at least Mac OS/X 10.0 -- thought it only was"
40echo "tested on Mac OS/X 10.3 at this time"
41echo
42echo "Note: for the installation to succeed you need to be root"
43echo "      thus you need to run this script as root or use 'sudo';"
44echo "      for instance:"
45echo "          su"
46echo "          install.sh"
47echo "      or:"
48echo "          sudo install.sh"
49echo "      To use 'su' you need to know the root password. To use"
50echo "      sudo, you need to enter your own password and have"
51echo "      administrative rights."
52echo
53echo "If you want to proceed, type 'yes' at the prompt and then enter."
54echo "For each file to be overwritten, you will be prompted for confirmation."
55
56# You have 10 minutes to answer or it cancels
57answer="no"
58read -p "So (yes/[no])? " -t 600 answer
59
60if test "$answer" != "yes"
61then
62	echo "WARNING: Installation aborted"
63	exit 1;
64fi
65
66p=`dirname "$0"`
67cd "$p/sswf-"*
68
69# Files which already exist?
70found=false
71for f in `find usr`;
72do
73	if test -f /$f
74	then
75		echo $f already exists
76		found=true
77	fi
78done
79if $found
80then
81	echo "WARNING: some of the files to be installed already exist on your system!"
82	read -p "Do you want to continue (yes/[no])? " -t 600 answer
83
84	if test "$answer" != "yes"
85	then
86		echo "WARNING: Installation aborted"
87		exit 1;
88	fi
89fi
90
91echo "Copying from '`pwd`/usr' to '/.'"
92tar -cf - usr | tar -xvf - -C /
93