summaryrefslogtreecommitdiff
path: root/acct-group/shadow/shadow-0.ebuild
blob: 8c09eba4ce434ebe6ca6e33953cd9fe9220bf796 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Copyright 2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

inherit acct-group user-info

ACCT_GROUP_ID=42

pkg_postinst() {
	# Look up the gid in ${EROOT}/etc/group.
	# It may differ from the gid in /etc/group.
	local gid=$(egetent group shadow | cut -d: -f3)
	if [[ -z ${gid} ]]; then
		eerror "Unable to determine id for shadow group"
		return
	fi
	local db
	for db in gshadow shadow; do
		[[ -e ${EROOT}/etc/${db} ]] || continue
		chgrp "${gid}" "${EROOT}/etc/${db}"
		chmod g+r "${EROOT}/etc/${db}"
	done
}