summaryrefslogtreecommitdiffstats
path: root/x11/gdm2/pkg-install
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2002-01-14 17:37:30 +0000
committersobomax <sobomax@FreeBSD.org>2002-01-14 17:37:30 +0000
commit55de7f7d1640552913207bd7a8b8e5a6e254bd07 (patch)
tree0f7cf7b6f976eaacfa700123f47c7f798805b51d /x11/gdm2/pkg-install
parent113299ddad5b9f216e9cf87ccd5ab77e96099016 (diff)
downloadFreeBSD-ports-55de7f7d1640552913207bd7a8b8e5a6e254bd07.zip
FreeBSD-ports-55de7f7d1640552913207bd7a8b8e5a6e254bd07.tar.gz
When installing package automagically create required user/group if they don't
exist. This should make it possible to do unattented installation of pre-built gdm package and gnome meta-package. Bump PORTREVISION. Submitted by: Joe Marcus Clarke <marcus@marcuscom.com>
Diffstat (limited to 'x11/gdm2/pkg-install')
-rw-r--r--x11/gdm2/pkg-install36
1 files changed, 34 insertions, 2 deletions
diff --git a/x11/gdm2/pkg-install b/x11/gdm2/pkg-install
index 0b1f96f..23dd7d7 100644
--- a/x11/gdm2/pkg-install
+++ b/x11/gdm2/pkg-install
@@ -1,7 +1,39 @@
#!/bin/sh
-if [ "$2" = "POST-INSTALL" -o -n "${PACKAGE_BUILDING}" ]; then
- exit 0
+if [ -n "${PACKAGE_BUILDING}" ]; then
+ exit 0
+fi
+
+if [ "$2" = "POST-INSTALL" ]; then
+ USER=gdm
+ GROUP=${USER}
+ UID=91
+ GID=${UID}
+
+ if pw group show "${GROUP}" 2>/dev/null; then
+ echo "You already have a group \"${GROUP}\", so I will use it."
+ else
+ if pw groupadd ${GROUP} -g ${GID}; then
+ echo "Added group \"${GROUP}\"."
+ else
+ echo "Adding group \"${GROUP}\" failed..."
+ exit 1
+ fi
+ fi
+
+ if pw user show "${USER}" 2>/dev/null; then
+ echo "You already have a user \"${USER}\", so I will use it."
+ else
+ if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \
+ -d "/nonexistent" -s /sbin/nologin -c "GNOME Display Manager"
+ then
+ echo "Added user \"${USER}\"."
+ else
+ echo "Adding user \"${USER}\" failed..."
+ exit 1
+ fi
+ fi
+ exit 0
fi
/usr/bin/dialog --yesno "GDM may contain vulnerabilities leading local root compromise, and it is reported widely with various security sites and groups. It is not recommended that this port be installed in public environment. Do you wish to accept the security risk and build GDM anyway?" 10 60 || /usr/bin/false
OpenPOWER on IntegriCloud