summarylogtreecommitdiffstats
path: root/PKGBUILD
diff options
context:
space:
mode:
authorRafael Cruz2020-09-03 22:05:00 -0300
committerRafael Cruz2020-09-03 22:05:00 -0300
commite05d00bf572216eaf24fa9731cb75224edef7bf6 (patch)
tree2baec6cea4a6259764b5f13ef01a131ef674df6e /PKGBUILD
parent251682513a5ef99764d0e139c43522b1217fd436 (diff)
downloadaur-e05d00bf572216eaf24fa9731cb75224edef7bf6.tar.gz
update
Diffstat (limited to 'PKGBUILD')
-rw-r--r--PKGBUILD34
1 files changed, 31 insertions, 3 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 53136a249274..c13827c773cb 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,7 +2,7 @@
pkgname=fightcade2
pkgver=2.0.77
-pkgrel=5
+pkgrel=6
pkgdesc='The best way to play your favorite retro games with or against any other player in the world.'
url='https://www.fightcade.com/'
arch=('any')
@@ -16,17 +16,45 @@ _romsPkgname="$pkgname-roms"
createShellFiles() {
cat << 'EOF' > $srcdir/Fightcade/start.sh
#!/bin/bash
+
fightcadeUserFolderName="fightcade2"
fightcadeInstallFolder="/opt/$fightcadeUserFolderName"
fightcadeUserFolderPath="$HOME/.$fightcadeUserFolderName"
fightcadeRomsPath="$fightcadeUserFolderPath/ROMs"
+oldVersionTxt="$fightcadeUserFolderPath/VERSION.txt"
+newVersionTxt="$fightcadeInstallFolder/VERSION.txt"
+oldVersion=0
+newVersion=0
+
+function compareVersion () {
+ #1: requiredver
+ #2: currentver
+ if [ "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$1" ]; then
+ return 0
+ else
+ return 1
+ fi
+}
+
+if [ -f "$oldVersionTxt" ]
+then
+ oldVersion=`cat $fightcadeUserFolderPath/VERSION.txt`
+fi
+
+if [ -f "$newVersionTxt" ]
+then
+ newVersion=`cat $fightcadeInstallFolder/VERSION.txt`
+fi
if [ "$1" = "roms" ]; then
xdg-open "$fightcadeRomsPath"
exit 1
fi
-if [ ! -f "$fightcadeUserFolderPath/Fightcade2.sh" ]
+compareVersion "$newVersion" "$oldVersion"
+hasNewVersion=$?
+
+if [ ! -f "$fightcadeUserFolderPath/Fightcade2.sh" ] || [ "$hasNewVersion" -eq "1" ]
then
mkdir -p "$fightcadeUserFolderPath"
rsync -r --copy-links $fightcadeInstallFolder/* $fightcadeUserFolderPath
@@ -49,6 +77,6 @@ package() {
install -Dm644 "$srcdir/$pkgname.desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"
install -Dm644 "$srcdir/$_romsPkgname.desktop" "$pkgdir/usr/share/applications/$_romsPkgname.desktop"
msg "Copying files..."
- rsync -r --copy-links $srcdir/Fightcade/* $pkgdir/opt/$pkgname/
+ rsync -r -I --copy-links $srcdir/Fightcade/* $pkgdir/opt/$pkgname/
chmod +x $pkgdir/opt/$pkgname/start.sh
}