Lines 4-9
Link Here
|
4 |
|
4 |
|
5 |
inherit eutils toolchain-funcs flag-o-matic games |
5 |
inherit eutils toolchain-funcs flag-o-matic games |
6 |
|
6 |
|
|
|
7 |
# If ${USE_GENTOO_GAMES_POLICY} is set to a non-empty value, the build will |
8 |
# follow the (current as of 2007) Gentoo games policy; otherwise, the build |
9 |
# will assume standard Unix-like games policy. The differences are: |
10 |
# - Under standard (non-Gentoo) policy, the "games" group is assumed to |
11 |
# be protected from users, and NetHack will be installed as group |
12 |
# "games" (actually ${GAMES_GROUP}). Under Gentoo policy, users are |
13 |
# assumed to be in the "games" group, and a separate "nethack" group |
14 |
# will be used for installation in order to protect the data files from |
15 |
# modification by users. |
16 |
# - The "you have to be in the 'games' group" message will only be |
17 |
# displayed when using Gentoo policy. |
18 |
|
19 |
USE_GENTOO_GAMES_POLICY="for now, anyway" |
20 |
|
7 |
MY_PV=${PV//.} |
21 |
MY_PV=${PV//.} |
8 |
DESCRIPTION="The ultimate old-school single player dungeon exploration game" |
22 |
DESCRIPTION="The ultimate old-school single player dungeon exploration game" |
9 |
HOMEPAGE="http://www.nethack.org/" |
23 |
HOMEPAGE="http://www.nethack.org/" |
Lines 31-36
Link Here
|
31 |
)" |
45 |
)" |
32 |
|
46 |
|
33 |
HACKDIR="${GAMES_DATADIR}/${PN}" |
47 |
HACKDIR="${GAMES_DATADIR}/${PN}" |
|
|
48 |
if [ -n "${USE_GENTOO_GAMES_POLICY}" ]; then |
49 |
NETHACK_GROUP="nethack" |
50 |
else |
51 |
NETHACK_GROUP="games" |
52 |
fi |
53 |
|
54 |
pkg_setup() { |
55 |
games_pkg_setup |
56 |
if [ -n "${USE_GENTOO_GAMES_POLICY}" ]; then |
57 |
enewgroup nethack |
58 |
fi |
59 |
} |
34 |
|
60 |
|
35 |
src_unpack() { |
61 |
src_unpack() { |
36 |
unpack ${A} |
62 |
unpack ${A} |
Lines 107-124
Link Here
|
107 |
CC="$(tc-getCC)" \ |
133 |
CC="$(tc-getCC)" \ |
108 |
CFLAGS="${CFLAGS}" \ |
134 |
CFLAGS="${CFLAGS}" \ |
109 |
LFLAGS="-L/usr/X11R6/lib" \ |
135 |
LFLAGS="-L/usr/X11R6/lib" \ |
110 |
GAMEPERM=0755 \ |
136 |
GAMEPERM=2751 \ |
111 |
GAMEUID="${GAMES_USER}" GAMEGRP="${GAMES_GROUP}" \ |
137 |
GAMEUID="${GAMES_USER}" GAMEGRP="${NETHACK_GROUP}" \ |
112 |
PREFIX="${D}/usr" \ |
138 |
PREFIX="${D}/usr" \ |
113 |
GAMEDIR="${D}${HACKDIR}" \ |
139 |
GAMEDIR="${D}${HACKDIR}" \ |
114 |
SHELLDIR="${D}/${GAMES_BINDIR}" \ |
140 |
SHELLDIR="${D}/${GAMES_BINDIR}" \ |
115 |
install \ |
141 |
install \ |
116 |
|| die "make install failed" |
142 |
|| die "make install failed" |
117 |
|
143 |
|
|
|
144 |
# Set permissions on the game data directory--but note that the real |
145 |
# executable is stored here too, so fix it up afterwards. |
146 |
chgrp -R "${NETHACK_GROUP}" "${D}/${HACKDIR}" || die "chgrp hackdir" |
147 |
chmod -R 640 "${D}/${HACKDIR}" || die "chmod hackdir 1" |
148 |
# ${HACKDIR} would be 750 if ${GAMES_BINDIR}/nethack wasn't a shell |
149 |
# script that called the real executable, ${HACKDIR}/nethack |
150 |
chmod 751 "${D}/${HACKDIR}" || die "chmod hackdir 2" |
151 |
chmod 2751 "${D}/${HACKDIR}/nethack" || die "chmod hackdir 3" |
152 |
|
118 |
# We keep this stuff in ${GAMES_STATEDIR} instead so tidy up. |
153 |
# We keep this stuff in ${GAMES_STATEDIR} instead so tidy up. |
119 |
rm -rf "${D}/usr/share/games/nethack/save" |
154 |
rm -rf "${D}/usr/share/games/nethack/save" |
120 |
|
155 |
|
121 |
newgamesbin util/recover recover-nethack || die "newgamesbin failed" |
156 |
newgamesbin util/recover recover-nethack || die "newgamesbin failed" |
|
|
157 |
# FIXME: do we want to let users run this or not? |
158 |
chgrp "${NETHACK_GROUP}" "${D}/${GAMES_BINDIR}/recover-nethack" \ |
159 |
|| die "chgrp recover" |
160 |
chmod 2750 "${D}/${GAMES_BINDIR}/recover-nethack" || die "chmod binaries" |
122 |
|
161 |
|
123 |
# The final nethack is a sh script. This fixes the hard-coded |
162 |
# The final nethack is a sh script. This fixes the hard-coded |
124 |
# HACKDIR directory so it doesn't point to ${D}/usr/share/nethackdir |
163 |
# HACKDIR directory so it doesn't point to ${D}/usr/share/nethackdir |
Lines 172-187
Link Here
|
172 |
mv "${D}/${HACKDIR}/"{record,logfile,perm} "${D}/${statedir}/" |
211 |
mv "${D}/${HACKDIR}/"{record,logfile,perm} "${D}/${statedir}/" |
173 |
make_desktop_entry nethack "Nethack" |
212 |
make_desktop_entry nethack "Nethack" |
174 |
|
213 |
|
175 |
prepgamesdirs |
214 |
# Prevent users from modifying state files (#125902) |
176 |
chmod -R 660 "${D}/${statedir}" |
215 |
chgrp -R "${NETHACK_GROUP}" "${D}/${statedir}" || die "chgrp statedir" |
177 |
chmod 770 "${D}/${statedir}" "${D}/${statedir}/save" |
216 |
chmod -R 660 "${D}/${statedir}" || die "chmod statedir 1" |
|
|
217 |
chmod 770 "${D}/${statedir}" "${D}/${statedir}/save" \ |
218 |
|| die "chmod statedir 2" |
219 |
|
220 |
# We do NOT run prepgamesdirs because it would stomp all over our |
221 |
# carefully set permissions. |
178 |
} |
222 |
} |
179 |
|
223 |
|
180 |
pkg_postinst() { |
224 |
pkg_postinst() { |
181 |
games_pkg_postinst |
225 |
if [ -z "${USE_GENTOO_GAMES_POLICY}" ]; then |
|
|
226 |
gamesenv |
227 |
else |
228 |
games_pkg_postinst |
229 |
fi |
182 |
if use qt3 && has_version '=x11-libs/qt-3.1*' ; then |
230 |
if use qt3 && has_version '=x11-libs/qt-3.1*' ; then |
183 |
ewarn "the qt frontend may be a little unstable with this version of qt" |
231 |
ewarn "the qt frontend may be a little unstable with this version of qt" |
184 |
ewarn "please see Bug 32629 for more information" |
232 |
ewarn "please see Bug 32629 for more information" |
185 |
fi |
233 |
fi |
186 |
elog "You may want to look at /etc/skel/.nethackrc for interesting options" |
234 |
elog "You may want to look at /etc/skel/.nethackrc for interesting options" |
|
|
235 |
|
236 |
# Old installations of nethack may have the wrong group or permissions, |
237 |
# so update them once more here |
238 |
chgrp -R "${NETHACK_GROUP}" "${HACKDIR}" || die "chgrp hackdir" |
239 |
chmod -R 640 "${HACKDIR}" || die "chmod hackdir 1" |
240 |
chmod 751 "${HACKDIR}" || die "chmod hackdir 2" |
241 |
chmod 2751 "${HACKDIR}/nethack" |
242 |
local statedir="${GAMES_STATEDIR}/${PN}" |
243 |
chgrp -R "${NETHACK_GROUP}" "${statedir}" || die "chgrp statedir" |
244 |
chmod -R 660 "${statedir}" || die "chmod statedir 1" |
245 |
chmod 770 "${statedir}" "${statedir}/save" || die "chmod statedir 2" |
187 |
} |
246 |
} |