Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 125902 | Differences between
and this patch

Collapse All | Expand All

(-)/usr/portage/games-roguelike/nethack/nethack-3.4.3-r1.ebuild (-5 / +67 lines)
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 2008) 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 105-112 Link Here
105
		CC="$(tc-getCC)" \
131
		CC="$(tc-getCC)" \
106
		CFLAGS="${CFLAGS}" \
132
		CFLAGS="${CFLAGS}" \
107
		LFLAGS="-L/usr/X11R6/lib" \
133
		LFLAGS="-L/usr/X11R6/lib" \
108
		GAMEPERM=0755 \
134
		GAMEPERM=2751 \
109
		GAMEUID="${GAMES_USER}" GAMEGRP="${GAMES_GROUP}" \
135
		GAMEUID="${GAMES_USER}" GAMEGRP="${NETHACK_GROUP}" \
110
		PREFIX="${D}/usr" \
136
		PREFIX="${D}/usr" \
111
		GAMEDIR="${D}${HACKDIR}" \
137
		GAMEDIR="${D}${HACKDIR}" \
112
		SHELLDIR="${D}/${GAMES_BINDIR}" \
138
		SHELLDIR="${D}/${GAMES_BINDIR}" \
Lines 171-185 Link Here
171
	make_desktop_entry nethack "Nethack"
197
	make_desktop_entry nethack "Nethack"
172
198
173
	prepgamesdirs
199
	prepgamesdirs
174
	chmod -R 660 "${D}/${statedir}"
200
175
	chmod 770 "${D}/${statedir}" "${D}/${statedir}/save"
201
	# Set permissions on the game data directory--but note that the real
202
	# executable is stored here too, so fix it up afterwards.
203
	chgrp -R "${NETHACK_GROUP}" "${D}/${HACKDIR}" || die "chgrp hackdir"
204
	chmod -R 640 "${D}/${HACKDIR}" || die "chmod hackdir 1"
205
	# ${HACKDIR} would be 750 if ${GAMES_BINDIR}/nethack wasn't a shell
206
	# script that called the real executable, ${HACKDIR}/nethack
207
	chmod 751 "${D}/${HACKDIR}" || die "chmod hackdir 2"
208
	chmod 2751 "${D}/${HACKDIR}/nethack" || die "chmod nethack"
209
210
	# "recover" should only be runnable by the administrator; otherwise,
211
	# ordinary users could mess with other users' save files (see the
212
	# manpage).
213
	chgrp "${NETHACK_GROUP}" "${D}/${GAMES_BINDIR}/recover-nethack" \
214
		|| die "chgrp recover"
215
	chmod 2750 "${D}/${GAMES_BINDIR}/recover-nethack" || die "chmod recover"
216
217
	# Prevent users from modifying state files. (#125902)
218
	chgrp -R "${NETHACK_GROUP}" "${D}/${statedir}" || die "chgrp statedir"
219
	chmod -R 660 "${D}/${statedir}" || die "chmod statedir 1"
220
	chmod 770 "${D}/${statedir}" "${D}/${statedir}/save" \
221
		|| die "chmod statedir 2"
176
}
222
}
177
223
178
pkg_postinst() {
224
pkg_postinst() {
179
	games_pkg_postinst
225
	if [ -z "${USE_GENTOO_GAMES_POLICY}" ]; then
226
		gamesenv
227
	else
228
		games_pkg_postinst
229
	fi
180
	if use qt3 && has_version '=x11-libs/qt-3.1*' ; then
230
	if use qt3 && has_version '=x11-libs/qt-3.1*' ; then
181
		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"
182
		ewarn "please see Bug 32629 for more information"
232
		ewarn "please see Bug 32629 for more information"
183
	fi
233
	fi
184
	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.  FIXME: If we force an unmerge of any
238
	# old ebuild first, the code below can be removed.
239
	chgrp -R "${NETHACK_GROUP}" "${HACKDIR}" || die "chgrp hackdir"
240
	chmod -R 640 "${HACKDIR}" || die "chmod hackdir 1"
241
	chmod 751 "${HACKDIR}" || die "chmod hackdir 2"
242
	chmod 2751 "${HACKDIR}/nethack"
243
	local statedir="${GAMES_STATEDIR}/${PN}"
244
	chgrp -R "${NETHACK_GROUP}" "${statedir}" || die "chgrp statedir"
245
	chmod -R 660 "${statedir}" || die "chmod statedir 1"
246
	chmod 770 "${statedir}" "${statedir}/save" || die "chmod statedir 2"
185
}
247
}

Return to bug 125902