diff options
author | amdmi3 <amdmi3@FreeBSD.org> | 2014-05-12 08:27:51 +0800 |
---|---|---|
committer | amdmi3 <amdmi3@FreeBSD.org> | 2014-05-12 08:27:51 +0800 |
commit | 430af7d7c6c9e3d65c49fef71ec30cd10959443d (patch) | |
tree | 1406e7173e572662174f1f28142deacf4ddbaa5f /games | |
parent | ef2448c64ce2b8c5359fd20159d84c121f9d7ae0 (diff) | |
download | freebsd-ports-gnome-430af7d7c6c9e3d65c49fef71ec30cd10959443d.tar.gz freebsd-ports-gnome-430af7d7c6c9e3d65c49fef71ec30cd10959443d.tar.zst freebsd-ports-gnome-430af7d7c6c9e3d65c49fef71ec30cd10959443d.zip |
- Improve highscore file handling
Diffstat (limited to 'games')
-rw-r--r-- | games/pachi/Makefile | 7 | ||||
-rw-r--r-- | games/pachi/files/pkg-deinstall.in | 18 | ||||
-rw-r--r-- | games/pachi/files/pkg-install.in | 13 | ||||
-rw-r--r-- | games/pachi/pkg-install | 16 |
4 files changed, 36 insertions, 18 deletions
diff --git a/games/pachi/Makefile b/games/pachi/Makefile index 9a45ad96062a..c84c4263a46b 100644 --- a/games/pachi/Makefile +++ b/games/pachi/Makefile @@ -3,7 +3,7 @@ PORTNAME= pachi PORTVERSION= 1.0 -PORTREVISION= 5 +PORTREVISION= 6 CATEGORIES= games MASTER_SITES= SF/dragontech/Pachi%20el%20marciano/Pachi%20el%20marciano%20${PORTVERSION} DISTNAME= pachi_source @@ -21,9 +21,12 @@ CPPFLAGS+= -I${LOCALBASE}/include WRKSRC= ${WRKDIR}/Pachi -SCOREDIR= /var/games/pachi +SCOREDIR= /var/games/${PORTNAME} SCOREFILE= ${SCOREDIR}/scores.dat +SUB_FILES= pkg-deinstall pkg-install +SUB_LIST= SCOREDIR="${SCOREDIR}" SCOREFILE="${SCOREFILE}" + PORTDATA= * DESKTOP_ENTRIES="Pachi el marciano" \ diff --git a/games/pachi/files/pkg-deinstall.in b/games/pachi/files/pkg-deinstall.in new file mode 100644 index 000000000000..a289c6f566ce --- /dev/null +++ b/games/pachi/files/pkg-deinstall.in @@ -0,0 +1,18 @@ +#!/bin/sh +# +# $FreeBSD$ + +[ "$2" != "POST-DEINSTALL" ] && exit 0 + +# remove scorefile if it's empty +[ "`md5 -q '%%SCOREFILE%%'`" = 7ba69f4ec41007c035beb73aa29d6b32 ] && rm -f "%%SCOREFILE%%" 2>/dev/null +rmdir "%%SCOREDIR%%" 2>/dev/null + +if [ -e "%%SCOREDIR%%" ]; then + echo + echo "To completely remove the port, please remove the following" + echo "directory manually, if it's no longer needed:" + echo + echo " %%SCOREDIR%%" + echo +fi diff --git a/games/pachi/files/pkg-install.in b/games/pachi/files/pkg-install.in new file mode 100644 index 000000000000..ff18a3208638 --- /dev/null +++ b/games/pachi/files/pkg-install.in @@ -0,0 +1,13 @@ +#!/bin/sh +# +# $FreeBSD$ + +[ "$2" != "POST-INSTALL" ] && exit 0 +[ -e "%%SCOREFILE%%" ] && exit 0 + +mkdir -p "%%SCOREDIR%%" + +# Empty scorefile contains 170 zero bytes +dd if=/dev/zero of="%%SCOREFILE%%" bs=170 count=1 2>/dev/null +chgrp -R games "%%SCOREDIR%%" +chmod g+w "%%SCOREFILE%%" diff --git a/games/pachi/pkg-install b/games/pachi/pkg-install deleted file mode 100644 index b98908372032..000000000000 --- a/games/pachi/pkg-install +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh -# -# $FreeBSD$ - -SCOREDIR="/var/games/pachi" -SCOREFILE="/var/games/pachi/scores.dat" - -[ "$2" != "POST-INSTALL" -o -f "$SCOREFILE" ] && exit 0 - -echo "Creating hiscore file..." -mkdir -p "$SCOREDIR" - -# Empty scorefile seem to contain 170 zero bytes -truncate -s 170 "$SCOREFILE" -chgrp -R games "$SCOREDIR" -chmod g+w "$SCOREFILE" |