Bump version to 6.4-15
[LibreOffice.git] / setup_native / scripts / langpackscript.sh
blob4f0dd548467b59beebeed4ac70aa52e9d9dd48a8
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=/var/tmp/install_$$
112 mkdir $outdir
114 #diskSpace=`df -k $outdir | $tail_prog -1 | awk '{if ( $4 ~ /%/) { print $3 } else { print $4 } }'`
115 #if [ $diskSpace -lt $diskSpaceRequired ]; then
116 # printf "You will need at least %s kBytes of free disk space\n" $diskSpaceRequired
117 # printf "Please free up the required disk space and try again\n"
118 # exit 3
121 trap 'rm -rf $outdir; exit 1' HUP INT QUIT TERM
122 echo "Unpacking and installing..."
124 #if [ -x /usr/bin/sum ] ; then
125 # echo "Checksumming..."
127 # sum=`/usr/bin/sum $outdir/$outname`
128 # index=1
129 # for s in $sum
130 # do
131 # case $index in
132 # 1) sum1=$s;
133 # index=2;
134 # ;;
135 # 2) sum2=$s;
136 # index=3;
137 # ;;
138 # esac
139 # done
140 # if expr $sum1 != <sum1replace> || expr $sum2 != <sum2replace> ; then
141 # echo "The download file appears to be corrupted. Please refer"
142 # echo "to the Troubleshooting section of the Installation"
143 # exit 1
144 # fi
145 #else
146 # echo "Can't find /usr/bin/sum to do checksum. Continuing anyway."
149 case $platform in
150 SunOS)
151 $tail_prog +$linenum $0 | gunzip | (cd $outdir; tar xvf -)
152 adminfile=$outdir/admin.$$
153 echo "basedir=$PRODUCTINSTALLLOCATION" > $adminfile
154 INSTALLLINES
156 Linux)
157 $tail_prog +$linenum $0 | gunzip | (cd $outdir; tar xvf -)
158 INSTALLLINES
161 echo "Unsupported platform"
162 exit 1
164 esac
166 rm -rf $outdir
168 echo "Done..."
170 exit 0