1#!/bin/sh
2
3MYUID=`id | sed "s/(.*//g" | sed "s/.*=//"`
4
5if [ $MYUID -ne 0 ]
6then
7	echo You need to have super-user rights to install this language package
8	exit 1
9fi
10
11linenum=LINENUMBERPLACEHOLDER
12
13# Determining current platform
14
15platform=`uname -s`
16
17case $platform in
18SunOS)
19  tail_prog="tail"
20  ;;
21Linux)
22  tail_prog="tail -n"
23  ;;
24*)
25  tail_prog="tail"
26  ;;
27esac
28
29more << "EOF"
30LICENSEFILEPLACEHOLDER
31EOF
32
33agreed=
34while [ x$agreed = x ]; do
35    echo
36    echo "Do you agree to the above license terms? [yes or no] "
37    read reply leftover
38    case $reply in
39	y* | Y*)
40	    agreed=1;;
41	n* | N*)
42    echo "If you don't agree to the license you can't install this software";
43    exit 1;;
44    esac
45done
46
47case $platform in
48SunOS)
49  SEARCHPACKAGENAME="BASISPACKAGEPREFIXPLACEHOLDEROOOBASEVERSIONPLACEHOLDER-core01"
50  echo
51  echo "Searching for the FULLPRODUCTNAMELONGPLACEHOLDER installation ..."
52  PACKAGENAME=`pkginfo -x | grep $SEARCHPACKAGENAME | sed "s/ .*//"`
53  if [ "x$PACKAGENAME" != "x" ]
54  then
55    PRODUCTINSTALLLOCATION="`pkginfo -r $PACKAGENAME`"
56  else
57    echo "FULLPRODUCTNAMELONGPLACEHOLDER not installed (no package $SEARCHPACKAGENAME installed)"
58    exit 1
59  fi
60  ;;
61Linux)
62  SEARCHPACKAGENAME="BASISPACKAGEPREFIXPLACEHOLDEROOOBASEVERSIONPLACEHOLDER-core01"
63  FIXPATH="/openoffice.org"
64  echo
65  echo "Searching for the FULLPRODUCTNAMELONGPLACEHOLDER installation ..."
66  RPMNAME=`rpm -qa | grep $SEARCHPACKAGENAME`
67  if [ "x$RPMNAME" != "x" ]
68  then
69    PRODUCTINSTALLLOCATION="`rpm -ql $RPMNAME | head -n 1`"
70  else
71    echo "FULLPRODUCTNAMELONGPLACEHOLDER not installed (no package $SEARCHPACKAGENAME installed)"
72    exit 1
73  fi
74  PRODUCTINSTALLLOCATION=`echo $PRODUCTINSTALLLOCATION | sed "s#${FIXPATH}##"`
75  ;;
76*)
77  echo "Unsupported platform"
78  exit 1
79  ;;
80esac
81
82# Asking for the installation directory
83
84# echo
85# echo "Where do you want to install the language pack ? [$PRODUCTINSTALLLOCATION] "
86# read reply leftover
87# if [ "x$reply" != "x" ]
88# then
89#   PRODUCTINSTALLLOCATION="$reply"
90# fi
91
92# Unpacking
93
94outdir=/var/tmp/install_$$
95mkdir $outdir
96
97#diskSpace=`df -k $outdir | $tail_prog -1 | awk '{if ( $4 ~ /%/) { print $3 } else { print $4 } }'`
98#if [ $diskSpace -lt $diskSpaceRequired ]; then
99#    printf "You will need atleast %s kBytes of Disk Free\n" $diskSpaceRequired
100#    printf "Please free up the required Disk Space and try again\n"
101#    exit 3
102#fi
103
104trap 'rm -rf $outdir; exit 1' HUP INT QUIT TERM
105echo "Unpacking and installing..."
106
107#if [ -x /usr/bin/sum ] ; then
108#    echo "Checksumming..."
109#
110#    sum=`/usr/bin/sum $outdir/$outname`
111#    index=1
112#    for s in $sum
113#    do
114#	case $index in
115#	1)  sum1=$s;
116#     index=2;
117#	    ;;
118#	2)  sum2=$s;
119#	    index=3;
120#	    ;;
121#	esac
122#    done
123#    if expr $sum1 != <sum1replace> || expr $sum2 != <sum2replace> ; then
124#	echo "The download file appears to be corrupted.  Please refer"
125#	echo "to the Troubleshooting section of the Installation"
126#	exit 1
127#   fi
128#else
129#    echo "Can't find /usr/bin/sum to do checksum.  Continuing anyway."
130#fi
131
132case $platform in
133SunOS)
134  $tail_prog +$linenum $0 | gunzip | (cd $outdir; tar xvf -)
135  adminfile=$outdir/admin.$$
136  echo "basedir=$PRODUCTINSTALLLOCATION" > $adminfile
137INSTALLLINES
138  ;;
139Linux)
140  $tail_prog +$linenum $0 | gunzip | (cd $outdir; tar xvf -)
141INSTALLLINES
142  ;;
143*)
144  echo "Unsupported platform"
145  exit 1
146  ;;
147esac
148
149rm -rf $outdir
150
151echo "Done..."
152
153exit 0
154