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