diff options
author | athena | 2015-08-31 11:10:40 +0200 |
---|---|---|
committer | athena | 2015-08-31 11:10:40 +0200 |
commit | 8dec2d6ff3c501a329fcaeb6b939534e6a33069b (patch) | |
tree | 41e912b34f81a58b8e16c1bc8dfa32068959001b | |
parent | 00d1e0229aab347c3c930e3fae554849bb0b0f91 (diff) | |
download | aur-8dec2d6ff3c501a329fcaeb6b939534e6a33069b.tar.gz |
better remove script and getgid is the gid of exec instead for builtin 50
-rw-r--r-- | .SRCINFO | 6 | ||||
-rw-r--r-- | PKGBUILD | 6 | ||||
-rw-r--r-- | texmaster-launcher.c.in | 22 | ||||
-rw-r--r-- | texmaster.install | 20 |
4 files changed, 44 insertions, 10 deletions
@@ -1,7 +1,7 @@ pkgbase = texmaster pkgdesc = Texmaster is a tetris clone developed by Report. pkgver = 2009.3 - pkgrel = 1 + pkgrel = 2 url = http://tetrisconcept.net/threads/texmaster.2/ install = texmaster.install arch = i686 @@ -12,8 +12,8 @@ pkgbase = texmaster source = texmaster-launcher.c.in source = texmaster.install md5sums = afe9c927d145829d3f6c8c47091f7be5 - md5sums = fd1c7428af5fa94a0da404b3b9af7566 - md5sums = 1b5846f9cf3b7755c127ff465672eaeb + md5sums = 2cc37514846c4bdfc8d9d3320ed78353 + md5sums = 67606a2fc7d183852855f97b4919b1d8 pkgname = texmaster @@ -1,6 +1,6 @@ pkgname='texmaster' pkgver='2009.3' -pkgrel='1' +pkgrel='2' pkgdesc='Texmaster is a tetris clone developed by Report.' url='http://tetrisconcept.net/threads/texmaster.2/' source=( @@ -9,8 +9,8 @@ source=( 'texmaster.install' ) md5sums=('afe9c927d145829d3f6c8c47091f7be5' - 'fd1c7428af5fa94a0da404b3b9af7566' - '1b5846f9cf3b7755c127ff465672eaeb') + '2cc37514846c4bdfc8d9d3320ed78353' + '67606a2fc7d183852855f97b4919b1d8') arch=('i686' 'x86_64') depends=('sdl' 'zlib') diff --git a/texmaster-launcher.c.in b/texmaster-launcher.c.in index 7791928760a1..6b9069e6df6e 100644 --- a/texmaster-launcher.c.in +++ b/texmaster-launcher.c.in @@ -1,6 +1,7 @@ #include <stdio.h> #include <sys/stat.h> +#include <sys/types.h> #include <unistd.h> char *dir = "/usr/local/games/Texmaster2009-3"; @@ -11,6 +12,8 @@ char *savfile = "Texmaster2009.ubuntu10.04.sav"; char *texexe = "./Texmaster2009.ubuntu10.04.ARCHSUFFIX"; +char *launcherexe = "texmaster-launcher"; + mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | @@ -23,13 +26,28 @@ int fixfile (char *path) { return 0; } +int getmygid (gid_t *gid) { + struct stat buf; + if (stat (launcherexe, &buf) != 0) { + return -1; + } + *gid = buf.st_gid; + return 0; +} + int main (void) { + gid_t gid; if (chdir (dir) != 0) { fprintf (stderr, "failed to chdir to Texmaster dir\r\n"); return 1; } - if (setgid (50) != 0) { - fprintf (stderr, "failed to setgid games\r\n"); + if (getmygid (&gid) != 0) { + fprintf (stderr, "failed to get group owner\r\n"); + return 1; + } + fprintf (stderr, "gid is %d\r\n", gid); + if (setgid (gid) != 0) { + fprintf (stderr, "failed to setgid to group owner\r\n"); return 1; } if (fixfile (nvfile) != 0) { diff --git a/texmaster.install b/texmaster.install index e76e5d72dcae..616472c00c20 100644 --- a/texmaster.install +++ b/texmaster.install @@ -7,6 +7,22 @@ post_install() { chmod g+s $LAUNCHER } -post_remove() { - rm -Rf "/usr/local/games/Texmaster2009-3" +pre_remove() { + GAMEDIR=/usr/local/games/Texmaster2009-3 + LAUNCHER=$GAMEDIR/texmaster-launcher + + rm -f $GAMEDIR/Texmaster2009.ubuntu10.04.nv + rm -f $GAMEDIR/Texmaster2009.ubuntu10.04.sav + + chmod g-s $LAUNCHER + chmod g-w $GAMEDIR + chgrp root $GAMEDIR $LAUNCHER +} + +pre_upgrade() { + pre_remove +} + +post_upgrade() { + post_install } |