Lahmizzar Muinela
2014-01-07 0251a9aac9cae56d046de9637504fa9b77b2103c
commit | author | age
ee0fca 1 #!/bin/bash
LM 2
3   ######################################
4   # Author: devXive, Lahmizzar Muinela #
5   # Email: support@devxive.com         #
6   # Twitter: @devXive                  #
7   # Website: http://www.devxive.com    #
8   ######################################
9
10 # Simple script to build an appropriate language manifest
11 #
12 # How to use
13 # ./create update 4.2.0b4 2013-12-06 (Fetch Updates from transifex first, then create the install file)
14 # ./create 4.2.0b4 2013-12-06 (Create the install file from the existing/current languages folder)
0251a9 15 #
LM 16 # This script is invoked by the build script, located in the root dir of this repo
ee0fca 17
4c5e04 18 sourcePath=$(realpath .)
LM 19
ee0fca 20 setUpdate="$1"
LM 21 setVersion="$2"
22 setDate="$3"
23
24 if [[ "$1" != "update" && "$1" != "noupdate" ]]
25     then
26       echo 'Please use update or noupdate or add option --help to get more informations'
27     exit 1 
28   fi
29
30 if [[ "$1" != "" && "$2" == "" ]]
31     then
32         echo 'Please set a version number or add option --help to get more informations'
33         exit 1 
34     fi
35
36 if [[ "$3" == "" ]]
37     then
38         setDate=$(date +"%Y-%m-%d")
4c5e04 39     echo "Using $setDate as build date"
ee0fca 40     fi
LM 41
42 version=$setVersion
43 creationDate=$setDate
44
45 if [[ "$1" == "update" ]]
46     then
4c5e04 47     $sourcePath/builder/pull $version
ee0fca 48   fi
LM 49
50 tempDir="$sourcePath/pkg_projectfork_languages"
51 fileName="pkg_projectfork_languages.xml"
52
53 rm -rf "$tempDir"
54 mkdir "$tempDir"
55
56 touch "$tempDir/$fileName"
57
58 cp -r $sourcePath/languages $tempDir
59 cp -r $sourcePath/archive/installer $tempDir
60 cp $sourcePath/archive/install.script.php $tempDir
61
62 file="$tempDir/pkg_projectfork_languages.xml"
63
64 echo '<?xml version="1.0" encoding="UTF-8"?>' >> "$file"
65 echo '<extension type="package" version="2.5" method="upgrade">' >> "$file"
66 echo '    <name>Projectfork Language Pack Installer</name>' >> "$file"
67 echo '    <packagename>projectfork_languages</packagename>' >> "$file"
68 echo "    <creationDate>$creationDate</creationDate>" >> "$file"
69 echo '    <author>Projectfork Translation Team</author>' >> "$file"
70 echo '    <authorEmail>support@projectfork.net</authorEmail>' >> "$file"
71 echo '    <authorUrl>http://www.projectfork.net</authorUrl>' >> "$file"
72 echo '    <copyright>(C) 2012 - 2013 by the Projectfork Translation Team. All rights reserved.</copyright>' >> "$file"
73 echo "    <version>$version</version>" >> "$file"
74 echo '    <updateable>fullupdate</updateable>' >> "$file"
75 echo '    <license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>' >> "$file"
76 echo '    <description></description>' >> "$file"
77 echo '' >> "$file"
78 echo '    <scriptfile>install.script.php</scriptfile>' >> "$file"
79 echo '' >> "$file"
80 echo '    <files folder="languages">' >> "$file"
81 echo '    </files>' >> "$file"
82 echo '' >> "$file"
83 echo '    <!-- Extension Update Specification -->' >> "$file"
84 echo '    <updateservers>' >> "$file"
85 echo '        <server type="extension" priority="1" name="PF4 Translation Update Server">https://raw.github.com/projectfork/Translations/master/archive/update.xml</server>' >> "$file"
86 echo '    </updateservers>' >> "$file"
87 echo '</extension>' >> "$file"
88
89 # zip build in build script
90 # zip -r $sourcePath/archive/zips/lang_pf4_$version.zip $tempDir/*
91 # rm -rf "$tempDir"