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