Lahmizzar Muinela
2014-03-09 36255aafc1fc0c5576c2d6878319f034ac08a800
commit | author | age
ee0fca 1 #!/bin/bash
LM 2
1fd179 3 # Copyright (C) 1997 - 2014 devXive - research and development
LM 4 #
5 # The scriptfile is licensed under the Apache License, Version 2.0 (the "License");
6 # You may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #      http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 # The content of static vars and/or static echo output is licensed under the
18 # devXive Proprietary Use License (http://devxive.com/legal/license)
19 #
20 # Author:  devXive, Lahmizzar Muinela
21 # Email:   support@devxive.com
22 # Twitter: @devxive
23 # Website: http://devxive.com
24 #
25 #
26 # Description:
ee0fca 27 # Simple script to build an appropriate language manifest
LM 28 #
29 # How to use
30 # ./create update 4.2.0b4 2013-12-06 (Fetch Updates from transifex first, then create the install file)
31 # ./create 4.2.0b4 2013-12-06 (Create the install file from the existing/current languages folder)
0251a9 32 #
LM 33 # This script is invoked by the build script, located in the root dir of this repo
ee0fca 34
4c5e04 35 sourcePath=$(realpath .)
LM 36
ee0fca 37 setUpdate="$1"
LM 38 setVersion="$2"
39 setDate="$3"
40
41 if [[ "$1" != "update" && "$1" != "noupdate" ]]
42     then
43       echo 'Please use update or noupdate or add option --help to get more informations'
44     exit 1 
45   fi
46
47 if [[ "$1" != "" && "$2" == "" ]]
48     then
49         echo 'Please set a version number or add option --help to get more informations'
50         exit 1 
51     fi
52
53 if [[ "$3" == "" ]]
54     then
55         setDate=$(date +"%Y-%m-%d")
4c5e04 56     echo "Using $setDate as build date"
ee0fca 57     fi
LM 58
59 version=$setVersion
60 creationDate=$setDate
61
62 if [[ "$1" == "update" ]]
63     then
4c5e04 64     $sourcePath/builder/pull $version
ee0fca 65   fi
LM 66
67 tempDir="$sourcePath/pkg_projectfork_languages"
68 fileName="pkg_projectfork_languages.xml"
69
70 rm -rf "$tempDir"
71 mkdir "$tempDir"
72
73 touch "$tempDir/$fileName"
74
75 cp -r $sourcePath/languages $tempDir
76 cp -r $sourcePath/archive/installer $tempDir
77 cp $sourcePath/archive/install.script.php $tempDir
78
79 file="$tempDir/pkg_projectfork_languages.xml"
80
81 echo '<?xml version="1.0" encoding="UTF-8"?>' >> "$file"
82 echo '<extension type="package" version="2.5" method="upgrade">' >> "$file"
83 echo '    <name>Projectfork Language Pack Installer</name>' >> "$file"
84 echo '    <packagename>projectfork_languages</packagename>' >> "$file"
85 echo "    <creationDate>$creationDate</creationDate>" >> "$file"
86 echo '    <author>Projectfork Translation Team</author>' >> "$file"
87 echo '    <authorEmail>support@projectfork.net</authorEmail>' >> "$file"
88 echo '    <authorUrl>http://www.projectfork.net</authorUrl>' >> "$file"
1fd179 89 echo '    <copyright>(C) 2012 - 2014 by the Projectfork Translation Team. All rights reserved.</copyright>' >> "$file"
ee0fca 90 echo "    <version>$version</version>" >> "$file"
LM 91 echo '    <updateable>fullupdate</updateable>' >> "$file"
92 echo '    <license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>' >> "$file"
93 echo '    <description></description>' >> "$file"
94 echo '' >> "$file"
95 echo '    <scriptfile>install.script.php</scriptfile>' >> "$file"
96 echo '' >> "$file"
97 echo '    <files folder="languages">' >> "$file"
98 echo '    </files>' >> "$file"
99 echo '' >> "$file"
100 echo '    <!-- Extension Update Specification -->' >> "$file"
101 echo '    <updateservers>' >> "$file"
102 echo '        <server type="extension" priority="1" name="PF4 Translation Update Server">https://raw.github.com/projectfork/Translations/master/archive/update.xml</server>' >> "$file"
103 echo '    </updateservers>' >> "$file"
104 echo '</extension>' >> "$file"
105
106 # zip build in build script
107 # zip -r $sourcePath/archive/zips/lang_pf4_$version.zip $tempDir/*
108 # rm -rf "$tempDir"