Imported Upstream version 1.3.0
[debian/splat] / utils / install
1 #!/bin/bash
2 #
3 # Simple shell script for installing SPLAT! and associated utilities.
4 # Written by John A. Magliacane, KD2BD April 2002.  Updated March 2009.
5 #
6
7 install_citydecoder()
8 {
9         cp citydecoder /usr/local/bin
10         echo "citydecoder installed!"
11 }
12
13 install_usgs2sdf()
14 {
15         cp usgs2sdf /usr/local/bin
16         echo "usgs2sdf installed!"
17 }
18
19 install_srtm2sdf()
20 {
21         cp srtm2sdf /usr/local/bin
22         rm -f /usr/local/bin/srtm2sdf-hd
23         ln -s /usr/local/bin/srtm2sdf /usr/local/bin/srtm2sdf-hd
24         echo "srtm2sdf and srtm2sdf-hd installed!"
25 }
26
27 install_fontdata()
28 {
29         cp fontdata /usr/local/bin
30         echo "fontdata installed!"
31 }
32
33 whoami=`whoami`
34
35 if [ "$whoami" != "root" ]; then
36         echo "Sorry, $whoami.  You need to be 'root' to install this software.  :-("
37 fi
38
39 if [ "$#" = "0" ]; then
40         echo "Usage: ./install  { citydecoder, srtm2sdf, usgs2sdf, fontdata, all }"
41 else 
42
43         if [ "$1" = "citydecoder" ] && [ "$whoami" = "root" ] && [ -x citydecoder ]; then
44                 install_citydecoder
45         fi
46
47         if [ "$1" = "srtm2sdf" ] && [ "$whoami" = "root" ] && [ -x srtm2sdf ]; then
48                 install_srtm2sdf
49         fi
50
51         if [ "$1" = "usgs2sdf" ] && [ "$whoami" = "root" ] && [ -x usgs2sdf ]; then
52                 install_usgs2sdf
53         fi
54
55         if [ "$1" = "fontdata" ] && [ "$whoami" = "root" ] && [ -x fontdata ]; then
56                 install_fontdata
57         fi
58
59         if [ "$1" = "all" ]  && [ "$whoami" = "root" ]; then
60                 if [ -x citydecoder ]; then
61                         install_citydecoder
62                 fi
63
64                 if [ -x srtm2sdf ]; then
65                         install_srtm2sdf
66                 fi
67
68                 if [ -x usgs2sdf ]; then
69                         install_usgs2sdf
70                 fi
71
72                 if [ -x fontdata ]; then
73                         install_fontdata
74                 fi
75         fi
76
77         if [ "$1" != "citydecoder" ] && [ "$1" != "srtm2sdf" ] && [ "$1" != "usgs2sdf" ] && [ "$1" != "fontdata" ] && [ "$1" != "all" ]; then
78                 echo "Usage: install { citydecoder, srtm2sdf, usgs2sdf, fontdata, all }"
79         fi
80 fi
81