summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD136
1 files changed, 108 insertions, 28 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 0afec2e7a911..3cad780d1b5d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,33 +1,111 @@
# Contributor: Jozef Riha <jose1711 at gmail dot com>
# Updated by Manuel Conzelmann, changed to non-branded software
-_keyaccount=16523
-_productUrname='Mein CEWE FOTOBUCH'
-_productRename='CEWE Fotobuch'
-_lang='de_DE'
-
-pkgname=cewe-fotobuch
-conflicts=(cewe-fotoservice)
-pkgdesc='an offline client for creating photobooks, uploading and ordering them at cewe.de'
-md5sums=('5ff70068560ab60ba5d74add52a2221e'
-# template start; name=cewe; version=6.4.5;
- '11e395d7c48d7f340435eeb938bcb502')
-
-pkgver=6.4.5
-pkgrel=1
+# to package a different version, change this line to _productVariant=<one of the words after '_prams_' below>
+# or download a setup file from a local CEWE site, put it in the same folder as this file, and run:
+# _SETUP_FILE=<filename> makepkg
+_productVariant=Fotobuch
+# leave this unset to get a package name based on the application name
+pkgname=
+pkgrel=3
+
+## Begin shared code ##
+pkgdesc='an offline client for creating photobooks and other photo products and ordering them from CEWE or partners'
+# 7.3.1 segfaults without this:
+options=(!strip)
+
+declare -g -A _scriptTailMd5sums
+_scriptTailMd5sums[7.1]=1b231f3988603dbec4e857e247784295
+_scriptTailMd5sums[7.2]=d9edd2bb89870dc61692e73f81fe0efa
+_scriptTailMd5sums[7.3]=8cf896344365958462902bfb340201cd
+_scriptTailMd5sums[7.4]=b9878ccca286ec7faa4d230633294853
+_scriptTailMd5sums[7.4a]=6f987a683f17b3595cc5993c1b1375ed
+
+# locale, key account, original name, version, (optional) replacement name
+_prams_Austria=(de_AT 29762 'CEWE Fotowelt' 7.1.4)
+_prams_Belgie=(nl_BE 28049 'CEWE Photoservice' 7.1.4)
+_prams_Belgique=(fr_BE 28049 'CEWE Photoservice' 7.1.4)
+_prams_Czechia=(cs_CZ 4860 'CEWE fotosvet' 7.3.3 "CEWE fotosvět")
+_prams_France=(fr_FR 7884 'Logiciel de création CEWE' 7.1.5)
+_prams_Fnac=(fr_FR 18455 'Atelier Photo Fnac' 7.1.3)
+_prams_Fotobuch=(de_DE 16523 'Mein CEWE FOTOBUCH' 7.4.3 'CEWE Fotobuch')
+_prams_Fotowelt=(de_DE 6822 'CEWE Fotowelt' 7.4.0)
+_prams_Germany=(de_DE 24441 'CEWE Fotowelt' 7.4.3)
+_prams_Pixum=(de_DE 1291 'Pixum Fotowelt' 7.3.3)
+_prams_Italy=(it_IT 19991 'CEWE.IT Foto World' 7.1.5)
+_prams_Luxemburg=(de_LU 32905 'CEWE Photoservice' 7.1.5)
+_prams_Luxembourg=(fr_LU 32905 'CEWE Photoservice' 7.1.4)
+_prams_Netherlands=(nl_NL 28035 'CEWE Fotoservice' 7.1.4)
+_prams_Poland=(pl_PL 29241 'CEWE Fotoswiat' 7.1.4 'CEWE Fotoświat')
+_prams_Slovakia=(sk_SK 31916 'CEWE fotosvet' 7.1.3)
+_prams_Slovenia=(sl_SI 17409 'CEWE Fotosvet' 7.1.5)
+_prams_Spain=(es_ES 29227 'Taller CEWE' 7.1.3)
+_prams_UK=(en_GB 12611 'CEWE Creator' 7.1.3)
+
+pkgver() {
+ [ -z "$1" ] && set -- '$HPS_VER'
+ grep -m1 "my $1" ${2}install.pl | grep -Po "'.*'" | grep -Po "[^']+"
+}
+
+if [ -z "$_SETUP_FILE" ]
+then
+ declare -n _prams=_prams_$_productVariant
+ # remove any accents and replace spaces and dots for setup file name
+ source="https://dls.photoprintit.com/download/Data/${_prams[1]}-${_prams[0]}/hps/setup_$(echo ${_prams[2]} | iconv -t ascii//TRANSLIT | sed 's/[ .]/_/g').tgz"
+else
+ mkdir -p src
+ bsdtar -xf "$_SETUP_FILE" -C src install.pl
+
+ _prams=('$FULL_LOCALE' '$KEYACCID' '$APPLICATION_NAME' '$HPS_VER' "$_RENAME")
+ for _i in {0..3}
+ do
+ _prams[_i]="$(pkgver "${_prams[_i]}" src/)"
+ done
+ source="$_SETUP_FILE"
+ [ $(whoami) != root -a -z "$_UPDATING" ] && echo -e "_prams_?=(${_prams[@]:0:2} '${_prams[2]}' ${_prams[3]})\n_scriptTailMd5sums[${_prams[3]%.*}]=$(md5sum <(sed '0,/AB HIER SOLLTE NICHTS MEHR GEAENDERT WERDEN/d' src/install.pl) | grep -Po '^[^ ]*')"
+ [ -n "$_PRAMS_ONLY" ] && exit
+fi
+
+_keyaccount=${_prams[1]}
+# what they call their package (e.g. MY CEWE TOO MANY CAPITALS)
+_productUrname=${_prams[2]}
+# what I want to call it (e.g. CEWE Sensible Name)
+[ -z "${_prams[4]}" ] && _productRename="$_productUrname" || _productRename=${_prams[4]}
+
+# remove accents, lowercase and replace spaces for package name
+[ -z "$pkgname" ] && pkgname="$(iconv -t ascii//TRANSLIT <(echo $_productRename))"
+pkgname=${pkgname,,}
+pkgname=${pkgname// /-}
+[ -f CEWE.install -a "$BUILDPKG" != 0 ] && sed "s/CEWE/$pkgname/" CEWE.install > $pkgname.install
+
+conflicts=(cewe-fotowelt cewe-fotobuch cewe-fotoservice cewe-monlivrephoto-fnac cewe-monlivrephoto-fr)
+conflicts=(${conflicts[@]/$pkgname/})
+
+pkgver=${_prams[3]}
+
url="http://www.cewe.de/"
license=("custom:eula")
-depends=('libx11' 'libjpeg' 'curl' 'wget' 'snappy')
-makedepends=('unzip')
+depends=('libx11' 'libjpeg' 'curl' 'wget' 'snappy' 'libxcrypt-compat')
+makedepends=('p7zip' 'xdg-utils')
arch=('i686' 'x86_64')
-source=("https://dls.photoprintit.com/download/Data/$_keyaccount-$_lang/hps/setup_${_productUrname// /_}.tgz"
- 'updater.pl')
-install=$pkgname.install
+source=($source 'updater.pl')
+md5sums=(SKIP SKIP)
+install="$pkgname.install"
_installDir=/usr/share/$pkgname
-pkgver() {
- grep 'my $HPS_VER' $srcdir/install.pl | grep -Po '[\d\.]+'
+check() {
+ # from start of script, where parameters are set:
+ local setRightDownloadServer="$(sed '0,/AB HIER SOLLTE NICHTS MEHR GEAENDERT WERDEN/p;d' "$src"install.pl | grep -Po '^my \$DOWNLOAD_SERVER\s+= "https://dls.photoprintit.com";')"
+ local mentionDownloadServer="$(sed '0,/AB HIER SOLLTE NICHTS MEHR GEAENDERT WERDEN/p;d' "$src"install.pl | grep -Po '.*\$DOWNLOAD_SERVER[^\r]*')"
+ # for body of script, after parameters set:
+ local md5sum=$(md5sum <(sed '0,/AB HIER SOLLTE NICHTS MEHR GEAENDERT WERDEN/d' "$src"install.pl) | grep -Po '^[^ ]*')
+
+ # only mention of server variable in parameter section should be to set correct server;
+ # md5sum of script body should match package version unless a setup file was provided:
+ local index=${pkgver%.*}
+ [ $index = 7.4 -a ${pkgver#$index.} -gt 2 ] && index=7.4a
+ [ "$mentionDownloadServer" == "$setRightDownloadServer" ] && [ "${_scriptTailMd5sums[$index]}" == $md5sum -o -n "$_SETUP_FILE" ]
}
package() {
@@ -45,13 +123,15 @@ package() {
# don't show EULA/ask for confirmation (EULA is addressed in install script)
update='--update'
# keep packages unless updating from within application
- [[ -z "$_UPDATING" ]] && keepPackages='-k' || update='--upgrade'
+ [ -z "$_UPDATING" ] && keepPackages='-k' || update='--upgrade'
+
+ ./install.pl $update $keepPackages --installDir="$_installDir" -v
- ./install.pl $update $keepPackages --installDir=$_installDir -v
install -m644 -b updater.pl $_installDir/updater.pl
+ sed -i "s/APPLICATION NAME/$_productRename/" $_installDir/updater.pl
+ rm $_installDir/uninstall.pl
+
install -D -m644 $srcdir/EULA.txt $pkgdir/usr/share/licenses/$pkgname/EULA.txt
- # pixmap for legacy customised mimetypes
- install -D -m644 $_installDir/Resources/keyaccount/32.xpm $pkgdir/usr/share/pixmaps/$pkgname.xpm
# create startup script and desktop file
cat > $pkgdir/usr/bin/$pkgname <<-EOF
@@ -59,7 +139,7 @@ package() {
cd ${_installDir#$pkgdir}
# nouveau bug with QT web engine: https://bugreports.qt.io/browse/QTBUG-41242
lsmod | grep nouveau && export QT_XCB_FORCE_SOFTWARE_OPENGL=1
- exec ./"${_productUrname/_/.}" "\$@"
+ exec ./"${_productUrname/_/ }" "\$@"
EOF
cat > $pkgdir/usr/share/applications/$pkgname.desktop <<-EOF
[Desktop Entry]
@@ -72,7 +152,8 @@ package() {
Categories=Graphics;Photography;
MimeType=application/x-hps-mcf
EOF
- chmod 755 $pkgdir/usr/bin/$pkgname $pkgdir/usr/share/applications/$pkgname.desktop
+ # make executables executable and resources available to all users
+ chmod 755 $pkgdir/usr/bin/$pkgname $pkgdir/usr/share/applications/$pkgname.desktop $(find $_installDir -type d)
# adjust product name in mimetype comment
sed -i "s/$_productUrname/$_productRename/" $pkgdir/usr/share/mime/packages/*
@@ -81,4 +162,3 @@ package() {
$_installDir/.log/* $_installDir/.log &> /dev/null || true
echo
}
-# template end;