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