look for java, javac and javadoc with the .exe suffix on windows
[LibreOffice.git] / setup_native / scripts / langpackscript.sh
blob1a6bb39a3d487c98340ea6531005e1ce9e6b338c
1 #!/bin/sh
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 # This file incorporates work covered by the following license notice:
11 # Licensed to the Apache Software Foundation (ASF) under one or more
12 # contributor license agreements. See the NOTICE file distributed
13 # with this work for additional information regarding copyright
14 # ownership. The ASF licenses this file to you under the Apache
15 # License, Version 2.0 (the "License"); you may not use this file
16 # except in compliance with the License. You may obtain a copy of
17 # the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 MYUID=`id | sed "s/(.*//g" | sed "s/.*=//"`
22 if [ $MYUID -ne 0 ]
23 then
24 echo You need to have super-user rights to install this language package
25 exit 1
28 linenum=LINENUMBERPLACEHOLDER
30 # Determining current platform
32 platform=`uname -s`
34 case $platform in
35 SunOS)
36 tail_prog="tail"
38 Linux)
39 tail_prog="tail -n"
42 tail_prog="tail"
44 esac
46 more << "EOF"
47 LICENSEFILEPLACEHOLDER
48 EOF
50 agreed=
51 while [ x$agreed = x ]; do
52 echo
53 echo "Do you agree to the above license terms? [yes or no] "
54 read reply leftover
55 case $reply in
56 y* | Y*)
57 agreed=1;;
58 n* | N*)
59 echo "If you don't agree to the license you can't install this software";
60 exit 1;;
61 esac
62 done
64 case $platform in
65 SunOS)
66 SEARCHPACKAGENAME="BASISPACKAGEPREFIXPLACEHOLDERPRODUCTVERSIONPLACEHOLDER-core01"
67 echo
68 echo "Searching for the FULLPRODUCTNAMELONGPLACEHOLDER installation ..."
69 PACKAGENAME=`pkginfo -x | grep $SEARCHPACKAGENAME | sed "s/ .*//"`
70 if [ "x$PACKAGENAME" != "x" ]
71 then
72 PRODUCTINSTALLLOCATION="`pkginfo -r $PACKAGENAME`"
73 else
74 echo "FULLPRODUCTNAMELONGPLACEHOLDER not installed (no package $SEARCHPACKAGENAME installed)"
75 exit 1
78 Linux)
79 SEARCHPACKAGENAME="BASISPACKAGEPREFIXPLACEHOLDERPRODUCTVERSIONPLACEHOLDER-core01"
80 FIXPATH="/openoffice.org"
81 echo
82 echo "Searching for the FULLPRODUCTNAMELONGPLACEHOLDER installation ..."
83 RPMNAME=`rpm -qa | grep $SEARCHPACKAGENAME`
84 if [ "x$RPMNAME" != "x" ]
85 then
86 PRODUCTINSTALLLOCATION="`rpm -ql $RPMNAME | head -n 1`"
87 else
88 echo "FULLPRODUCTNAMELONGPLACEHOLDER not installed (no package $SEARCHPACKAGENAME installed)"
89 exit 1
91 PRODUCTINSTALLLOCATION=`echo $PRODUCTINSTALLLOCATION | sed "s#${FIXPATH}##"`
94 echo "Unsupported platform"
95 exit 1
97 esac
99 # Asking for the installation directory
101 # echo
102 # echo "Where do you want to install the language pack ? [$PRODUCTINSTALLLOCATION] "
103 # read reply leftover
104 # if [ "x$reply" != "x" ]
105 # then
106 # PRODUCTINSTALLLOCATION="$reply"
107 # fi
109 # Unpacking
111 outdir=`mktemp -d -p /var/tmp`
113 #diskSpace=`df -k $outdir | $tail_prog -1 | awk '{if ( $4 ~ /%/) { print $3 } else { print $4 } }'`
114 #if [ $diskSpace -lt $diskSpaceRequired ]; then
115 # printf "You will need at least %s kBytes of free disk space\n" $diskSpaceRequired
116 # printf "Please free up the required disk space and try again\n"
117 # exit 3
120 trap 'rm -rf $outdir; exit 1' HUP INT QUIT TERM
121 echo "Unpacking and installing..."
123 #if [ -x /usr/bin/sum ] ; then
124 # echo "Checksumming..."
126 # sum=`/usr/bin/sum $outdir/$outname`
127 # index=1
128 # for s in $sum
129 # do
130 # case $index in
131 # 1) sum1=$s;
132 # index=2;
133 # ;;
134 # 2) sum2=$s;
135 # index=3;
136 # ;;
137 # esac
138 # done
139 # if expr $sum1 != <sum1replace> || expr $sum2 != <sum2replace> ; then
140 # echo "The download file appears to be corrupted. Please refer"
141 # echo "to the Troubleshooting section of the Installation"
142 # exit 1
143 # fi
144 #else
145 # echo "Can't find /usr/bin/sum to do checksum. Continuing anyway."
148 case $platform in
149 SunOS)
150 $tail_prog +$linenum $0 | gunzip | (cd $outdir; tar xvf -)
151 adminfile=$outdir/admin.$$
152 echo "basedir=$PRODUCTINSTALLLOCATION" > $adminfile
153 INSTALLLINES
155 Linux)
156 $tail_prog +$linenum $0 | gunzip | (cd $outdir; tar xvf -)
157 INSTALLLINES
160 echo "Unsupported platform"
161 exit 1
163 esac
165 rm -rf $outdir
167 echo "Done..."
169 exit 0