Created
July 26, 2021 14:04
-
-
Save jose1711/8a32194a79d51f5874e22da2bc84a9fb to your computer and use it in GitHub Desktop.
PKGBUILD
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Maintainer: James Crompton DonJaime at freenet de | |
# forked from cewe-fotobuch, originally by Jozef Riha, updated by Manuel Conzelmann | |
declare -a prg_data | |
# leave only a single line uncommented, comment out the rest | |
prg_data=(German 24441 'CEWE Fotowelt' 'CEWE Fotowelt' 'CEWE Fotowelt' de_DE) | |
# prg_data=(Slovak 31916 'CEWE fotosvet' 'CEWE fotosvet' 'CEWE Fotosvet' sk_SK) | |
# prg_data=(Czech 4860 'CEWE fotosvet' 'CEWE fotosvet' 'CEWE fotosvet' cs_CZ) | |
# prg_data=(French 7884 'Logiciel de creation CEWE' 'Logiciel de création CEWE' 'CEWE photo' fr_FR) | |
# prg_data=(Polish 29241 'CEWE Fotoswiat' 'CEWE Fotoswiat' 'CEWE foto' pl_PL) | |
_keyaccount=${prg_data[1]} | |
# what they call their package (e.g. MY CEWE TOO MANY CAPITALS: $APPLICATION_NAME in install.pl) | |
_productUrname=${prg_data[2]} | |
# what is the name of the binary | |
_productBinName=${prg_data[3]} | |
# what I want to call it (e.g. CEWE Sensible Name) | |
_productRename=${prg_data[4]} | |
_lang=${prg_data[5]} | |
conflicts=(cewe-fotobuch cewe-fotoservice) | |
provides=(cewe-fotoservice) | |
pkgdesc='an offline client for creating photobooks and other photo products and ordering them at cewe.de or partners' | |
md5sums=('SKIP' | |
'12ab17737db1c55035b6e7769132f791') | |
pkgname=${_productRename,,} | |
pkgname=${pkgname// /-} | |
pkgver=7.1.3 | |
pkgrel=3 | |
url="http://www.cewe.de/" | |
license=("custom:eula") | |
depends=('libx11' 'libjpeg' 'curl' 'wget' 'snappy') | |
makedepends=('unzip' 'xdg-utils') | |
arch=('i686' 'x86_64') | |
source=("https://dls.photoprintit.com/download/Data/$_keyaccount-$_lang/hps/setup_${_productUrname// /_}.tgz" | |
'updater.pl') | |
install=$pkgname.install | |
_installDir=/usr/share/$pkgname | |
pkgver() { | |
grep 'my $HPS_VER' $srcdir/install.pl | grep -Po '[\d\.]+' | |
} | |
package() { | |
# put icons and mimetype in the right place | |
export XDG_UTILS_INSTALL_MODE=system | |
export XDG_DATA_DIRS="$pkgdir/usr/share:" | |
_installDir=$pkgdir$_installDir | |
mkdir -p $_installDir $pkgdir/usr/{bin,share/icons/hicolor,share/mime/packages,share/applications} | |
cd $srcdir | |
# don't clear screen, fail to update system mime database, install broken desktop file, or burble | |
sed -i 's/^\s*\(system("clear"\|system("update-mime-database \|createDesktopShortcuts(\|printf(\$TRANSLATABLE\).*;//' install.pl | |
# 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' | |
./install.pl $update $keepPackages --installDir=$_installDir -v | |
install -m644 -b updater.pl $_installDir/updater.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 | |
#!/usr/bin/bash | |
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 ./"${_productBinName/_/ }" "\$@" | |
EOF | |
cat > $pkgdir/usr/share/applications/$pkgname.desktop <<-EOF | |
[Desktop Entry] | |
Type=Application | |
Name=$_productRename | |
Comment=Offline client for cewe.de service | |
Exec=$pkgname | |
Icon=hps-$_keyaccount-$pkgver | |
StartupNotify=true | |
Categories=Graphics;Photography; | |
MimeType=application/x-hps-mcf | |
EOF | |
chmod 755 $pkgdir/usr/bin/$pkgname $pkgdir/usr/share/applications/$pkgname.desktop | |
# adjust product name in mimetype comment | |
sed -i "s/$_productUrname/$_productRename/" $pkgdir/usr/share/mime/packages/* | |
# remove unneeded mime cache files and installation logs | |
rm -d $pkgdir/usr/share/mime/application/* $pkgdir/usr/share/mime/* \ | |
$_installDir/.log/* $_installDir/.log &> /dev/null || true | |
echo | |
} | |
# template end; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment