Commit 110a1749 authored by Mircea Bardac's avatar Mircea Bardac

Tools for Installer Management

git-svn-id: svn+ssh://svn.psi-im.org/home/psi/svn/win-installer/trunk@4 2d3a5ac0-73f9-4639-b284-2310bd1da355
parent 94deb425
......@@ -70,5 +70,8 @@
and base packages will have no suffix
! sorted the installer languages alphabetically
! fixed auto_uninstall (thanks Michal)
* v2.0beta (2005-09-25)
+ separated Psi language files & setup
+ added tools/prepfiles, tools/preplang scripts for easy management
******************************************************************************
......@@ -61,6 +61,7 @@
\ - psi_app
| - psi_lang
| - lang
| - tools
* INSTALLER_SOURCE can be changed at the beginning of the script.
The folder contains:
......@@ -76,7 +77,11 @@
* psi_lang contains Psi's *.qm language files
* lang contains files with translations for the installer:
Example: psi_installer_LANG.nsh
* tools contains scrips (& their configuration) for updating the
installer when a new Psi version and/or Psi language files are out
- prepfiles < bash script used for updating the file list
- preplang < Python script used for updating the Psi language file list
- psi_lang.map < language map file used by the preplang script
*******************************************************************************
** Installer languages
......@@ -109,36 +114,20 @@
*******************************************************************************
** Adding a new Psi language to the installer script:
1. Search in the .nsi file for "*** FOLLOW THE PATTERN WHEN ADDING LANGUAGES"
(without quotes)
2. You'll find 3 occurrences where the file must be modified so the installer
could work properly with another language.
3. First of all, add the language to the Languages section (1st occurrence)
Example for adding Polish language:
Section /o "Polish" LangPL
SetOverwrite on
SetOutPath "$INSTDIR\"
File "${INSTALLER_SOURCE}\psi_lang\psi_pl.qm"
SectionEnd
4. Add the language file to the Uninstall section (2nd occurence)
Example for adding Polish language to the uninstall section:
Delete "$INSTDIR\psi_pl.qm"
5. The 3rd occurrence allows the installer to automatically check the
language pack selected by the user.
(after checking the installer's language)
Example for the Polish language:
StrCmp $LANGUAGE ${LANG_POLISH} 0 +2
SectionSetFlags ${LangPL} ${SF_SELECTED}
Note that ${LANG_POLISH} is already defined and must be known by the
compiler. This last function is not mandatory for the good functioning of
the installer.
1. add the language to the "psi_lang/" dir
2. make sure the language map file in tools/psi_lang.map contains the correct
information for the language you add (also check the comments at the
beginning of the file)
3. run "./preplang" (Python script) in the "tools/" dir
*******************************************************************************
** Updating the file list
1. run "./prepfiles archive.zip" (Bash script) in the "tools/" dir with
archive.zip being the Psi archive with the release you're packing
*******************************************************************************
** Functionality
......
......@@ -224,100 +224,8 @@ SectionEnd
!ifdef BUILD_WITH_LANGPACKS
SubSection "$LSTR_LANGUAGES" SectionLang
; Czech
Section /o "Czech" LangCS
SetOverwrite on
SetOutPath "$INSTDIR\"
File "${INSTALLER_SOURCE}\psi_lang\psi_cs.qm"
SectionEnd
; Dutch
Section /o "Dutch" LangNL
SetOverwrite on
SetOutPath "$INSTDIR\"
File "${INSTALLER_SOURCE}\psi_lang\psi_nl.qm"
SectionEnd
; Estonian
Section /o "Estonian" LangET
SetOverwrite on
SetOutPath "$INSTDIR\"
File "${INSTALLER_SOURCE}\psi_lang\psi_et.qm"
SectionEnd
; French
Section /o "French" LangFR
SetOverwrite on
SetOutPath "$INSTDIR\"
File "${INSTALLER_SOURCE}\psi_lang\psi_fr.qm"
SectionEnd
; German
Section /o "German" LangDE
SetOverwrite on
SetOutPath "$INSTDIR\"
File "${INSTALLER_SOURCE}\psi_lang\psi_de.qm"
SectionEnd
; Greek
Section /o "Greek" LangEL
SetOverwrite on
SetOutPath "$INSTDIR\"
File "${INSTALLER_SOURCE}\psi_lang\psi_el.qm"
SectionEnd
; Macedonian
Section /o "Macedonian" LangMK
SetOverwrite on
SetOutPath "$INSTDIR\"
File "${INSTALLER_SOURCE}\psi_lang\psi_mk.qm"
SectionEnd
; Polish
Section /o "Polish" LangPL
SetOverwrite on
SetOutPath "$INSTDIR\"
File "${INSTALLER_SOURCE}\psi_lang\psi_pl.qm"
SectionEnd
; Simplified Chinese
Section /o "Simplified Chinese" LangZH
SetOverwrite on
SetOutPath "$INSTDIR\"
File "${INSTALLER_SOURCE}\psi_lang\psi_zh.qm"
SectionEnd
; Spanish
Section /o "Spanish" LangES
SetOverwrite on
SetOutPath "$INSTDIR\"
File "${INSTALLER_SOURCE}\psi_lang\psi_es.qm"
SectionEnd
; Russian
Section /o "Russian" LangRU
SetOverwrite on
SetOutPath "$INSTDIR\"
File "${INSTALLER_SOURCE}\psi_lang\psi_ru.qm"
SectionEnd
; Slovak
Section /o "Slovak" LangSK
SetOverwrite on
SetOutPath "$INSTDIR\"
File "${INSTALLER_SOURCE}\psi_lang\psi_sk.qm"
SectionEnd
; Vietnamese
Section /o "Vietnamese" LangVI
SetOverwrite on
SetOutPath "$INSTDIR\"
File "${INSTALLER_SOURCE}\psi_lang\psi_vi.qm"
SectionEnd
; *** FOLLOW THE PATTERN WHEN ADDING LANGUAGES
!include "psi_lang_install.inc"
; See ReadME.txt for more information
SubSectionEnd
!endif
......@@ -435,33 +343,8 @@ Function .onInit
!ifdef BUILD_WITH_LANGPACKS
; automatically choose language pack to install
StrCmp $LANGUAGE ${LANG_CZECH} 0 +2
SectionSetFlags ${LangCS} ${SF_SELECTED}
StrCmp $LANGUAGE ${LANG_ESTONIAN} 0 +2
SectionSetFlags ${LangET} ${SF_SELECTED}
StrCmp $LANGUAGE ${LANG_DUTCH} 0 +2
SectionSetFlags ${LangNL} ${SF_SELECTED}
StrCmp $LANGUAGE ${LANG_FRENCH} 0 +2
SectionSetFlags ${LangFR} ${SF_SELECTED}
StrCmp $LANGUAGE ${LANG_GERMAN} 0 +2
SectionSetFlags ${LangDE} ${SF_SELECTED}
StrCmp $LANGUAGE ${LANG_GREEK} 0 +2
SectionSetFlags ${LangEL} ${SF_SELECTED}
StrCmp $LANGUAGE ${LANG_MACEDONIAN} 0 +2
SectionSetFlags ${LangMK} ${SF_SELECTED}
StrCmp $LANGUAGE ${LANG_POLISH} 0 +2
SectionSetFlags ${LangPL} ${SF_SELECTED}
StrCmp $LANGUAGE ${LANG_SIMPCHINESE} 0 +2
SectionSetFlags ${LangZH} ${SF_SELECTED}
StrCmp $LANGUAGE ${LANG_SPANISH} 0 +2
SectionSetFlags ${LangES} ${SF_SELECTED}
StrCmp $LANGUAGE ${LANG_RUSSIAN} 0 +2
SectionSetFlags ${LangRU} ${SF_SELECTED}
StrCmp $LANGUAGE ${LANG_SLOVAK} 0 +2
SectionSetFlags ${LangSK} ${SF_SELECTED}
; no Vietnamese AutoSelection
; *** FOLLOW THE PATTERN WHEN ADDING LANGUAGES
!include "psi_lang_setup.inc"
; See ReadME.txt for more information
; ****************
!endif
......@@ -612,20 +495,8 @@ Section Uninstall
!ifdef BUILD_WITH_LANGPACKS
; Delete Language files
Delete "$INSTDIR\psi_cs.qm"
Delete "$INSTDIR\psi_et.qm"
Delete "$INSTDIR\psi_nl.qm"
Delete "$INSTDIR\psi_fr.qm"
Delete "$INSTDIR\psi_de.qm"
Delete "$INSTDIR\psi_el.qm"
Delete "$INSTDIR\psi_mk.qm"
Delete "$INSTDIR\psi_pl.qm"
Delete "$INSTDIR\psi_zh.qm"
Delete "$INSTDIR\psi_es.qm"
Delete "$INSTDIR\psi_ru.qm"
Delete "$INSTDIR\psi_sk.qm"
Delete "$INSTDIR\psi_vi.qm"
; *** FOLLOW THE PATTERN WHEN ADDING LANGUAGES
!include "psi_lang_uninstall.inc"
; See ReadME.txt for more information
!endif
; Clean up Psi (base)
......
#!/bin/bash
# PrepFiles v1.0
# Copyright (c) 2005 Mircea Bardac
# E-mail: dev AT mircea.bardac.net
# Script to prepare the (un)install file lists for the installer
# Start from: installer/tools/
# Usage: ./prepfiles program_archive.zip
# The script will also replace the contents of psi_app/
infile=$1
echo $infile
yes A | unzip -q $infile # | grep -v "warning" | grep -v "chmod"
indir=$(find -type d | grep / | head -n 1 | sed "s|./||g")
find $indir -type d > directories.list
out_inst="psi_files_install.nsi"
echo ";" > $out_inst
echo "; List of files to be INSTALLED (Base section)" >> $out_inst
echo ";" >> $out_inst
echo >> $out_inst
out_uninst="psi_files_uninstall.nsi"
echo ";" > $out_uninst
echo "; List of files to be UNINSTALLED (Base section)" >> $out_uninst
echo ";" >> $out_uninst
echo >> $out_uninst
cat directories.list | while read cline; do
#echo $cline
outpath=$(echo "$cline" | sed "s|$indir|\$INSTDIR|g")
echo -e "\tSetOutPath \"$outpath\"" >> $out_inst
find $cline -type f | grep -v "$cline/.*/.*" | while read cfile; do
fpath=$(echo "$cfile" | sed -e "s|$indir||g")
echo -e "\tFile \"psi_app$fpath\"" >> $out_inst
echo -e "\tDelete \"\$INSTDIR$fpath\"" >> $out_uninst
done
echo >> $out_inst
echo >> $out_uninst
done
cat directories.list | sort -r | while read cdir; do
outpath=$(echo "$cdir" | sed "s|$indir|\$INSTDIR|g")
echo -e "\tRMDir \"$outpath\"" >> $out_uninst
done
sed -i "s|/|\\\|g" $out_inst
sed -i "s|/|\\\|g" $out_uninst
rm -f directories.list
rm -rf ../psi_app
#mkdir ../psi_app
ls $indir/
cp -a $indir ../psi_app
rm -rf $indir
mv $out_inst ../
mv $out_uninst ../
\ No newline at end of file
#!/usr/bin/env python
# PrepLang v1.0
# Copyright (c) 2005 Mircea Bardac
# E-mail: dev AT mircea.bardac.net
# Script to prepare the (un)install file lists & setup for the language files
# Start from: installer/tools/
# Usage: ./preplang
# The script will also put the new language setup files in the installer dir
import os
import string
import array
fmap=open("psi_lang.map")
flanginst=open("../psi_lang_install.inc","w")
flangsetup=open("../psi_lang_setup.inc","w")
flanguninst=open("../psi_lang_uninstall.inc","w")
langmap={}
for s in fmap.readlines():
s=s.replace("\n","")
langsettings=s.split('\t')
if langsettings[0]!='':
if s[0]=='#': continue
langmap[langsettings[0]]=langsettings[1:]
langlist={}
for file in os.listdir("../psi_lang"):
if (not langmap.has_key(file)):
print "!Language definition not found for file: "+file+" (skipped)"
continue
else:
print "Language definition found for: "+file+" = "+langmap[file][2]
langlist[langmap[file][2]]=[file, langmap[file][0], langmap[file][1]]
for lang in sorted(langlist.keys()):
filename=langlist[lang][0]
sectionid=langlist[lang][1]
langid=langlist[lang][2]
flanginst.write("; "+lang+"\n")
flanginst.write("Section /o \""+lang+"\" "+sectionid+"\n")
flanginst.write("\tSetOverwrite on\n")
flanginst.write("\tSetOutPath \"$INSTDIR\\\"\n")
flanginst.write("\tFile \"${INSTALLER_SOURCE}\\psi_lang\\"+filename+"\n")
flanginst.write("SectionEnd\n\n")
flanguninst.write("\tDelete \"$INSTDIR\\"+filename+"\"\n")
if langid!="":
flangsetup.write("\tStrCmp $LANGUAGE ${"+langid+"} 0 +2\n")
flangsetup.write("\t\tSectionSetFlags ${"+sectionid+"} ${SF_SELECTED}\n")
else:
flangsetup.write("\t; No "+lang+" AutoSelection\n")
flanginst.close()
flangsetup.close()
flanguninst.close()
\ No newline at end of file
# Language Mapping File
# Structure:
# <FileName> <SectionName> <LanguageID> <LanguageName>
# <LanguageID> is the NSIS language ID - can be missing
psi_cs.qm LangCS LANG_FRENCH Czech
psi_nl.qm LangNL LANG_DUTCH Dutch
psi_et.qm LangET LANG_ESTONIAN Estonian
psi_fr.qm LangFR LANG_FRENCH French
psi_de.qm LangDE LANG_GERMAN German
psi_el.qm LangEL LANG_GREEK Greek
psi_mk.qm LangMK LANG_MACEDONIAN Macedonian
psi_pl.qm LangPL LANG_POLISH Polish
psi_zh.qm LangZH LANG_SIMPCHINESE Simplified Chinese
psi_es.qm LangES LANG_SPANISH Spanish
psi_ru.qm LangRU LANG_RUSSIAN Russian
psi_sk.qm LangSK LANG_SLOVAK Slovak
psi_vi.qm LangVI Vietnamese
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment