Subject: Re: packages writing files out of LOCALBASE
To: Perry E. Metzger <perry@piermont.com>
From: Lubomir Sedlacik <salo@Xtrmntr.org>
List: tech-pkg
Date: 11/03/2002 04:02:26
--wULyF7TL5taEdwHz
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
hi,
On Sat, Nov 02, 2002 at 05:04:13PM -0500, Perry E. Metzger wrote:
>=20
> Julio Merino <jmmv@menta.net> writes:
> > > If the bash package doesn't update /etc/shells, and the installer
> > > doesn't notice or act on MESSAGE, ftpd mysteriously denies access
> > > to any user for whom bash is the default shell. It is possible to
> > > chase that relationship down through the man pages
> > > (ftpd(8)->getusershell(3)->shells(5)), but anyone who could do
> > > that would know to update /etc/shells. =20
> >=20
> > The administrator will notice the message. IIRC, if you do not add
> > bash to /etc/shells, chsh will fail if you try to use bash. An
> > administrator must know how to install shells, and if he doesn't,
> > MESSAGE will tell it.
>=20
> I'd very much prefer that the bash package be left alone. I like it
> that it updates /etc/shells for me and would prefer that it not be
> altered in that regard.
the current situation is suboptimal, though.
every shell has it's own home grown way of updating /etc/shells, we
should at least unify the process of registering shells installed from
pkgsrc to /etc/shells (and removing) and make it optional (with default
YES).
what about the following patch?
shell packages would include bsd.pkg.install.mk and set PKG_SHELL to the
full path of the shell binary installed, (un)registration in /etc/shells
would be done by INSTALL/DEINSTALL scripts.
if you don't want to automatically register newly installed shells into
/etc/shells, just set PKG_REGISTER_SHELLS in your /etc/mk.conf to NO.
Index: bsd.pkg.install.mk
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.install.mk,v
retrieving revision 1.38
diff -u -r1.38 bsd.pkg.install.mk
--- bsd.pkg.install.mk 23 Oct 2002 17:43:16 -0000 1.38
+++ bsd.pkg.install.mk 3 Nov 2002 02:58:33 -0000
@@ -213,6 +213,16 @@
FILES_SUBST+=3D PKG_CONFIG=3D${PKG_CONFIG}
FILES_SUBST+=3D PKG_RCD_SCRIPTS=3D${PKG_RCD_SCRIPTS}
=20
+# PKG_REGISTER_SHELLS indicates whether to automatically register shells
+# in /etc/shells. It is either YES or NO and defaults to YES.
+#
+# PKG_SHELL contains the full path of the shell being installed.
+#
+PKG_REGISTER_SHELLS?=3D YES
+PKG_SHELL?=3D # empty
+FILES_SUBST+=3D PKG_REGISTER_SHELLS=3D${PKG_REGISTER_SHELLS:Q}
+FILES_SUBST+=3D PKG_SHELL=3D${PKG_SHELL:Q}
+
# Substitute for various programs used in the DEINSTALL/INSTALL scripts and
# in the rc.d scripts.
#
Index: install/deinstall
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/pkgsrc/mk/install/deinstall,v
retrieving revision 1.14
diff -u -r1.14 deinstall
--- install/deinstall 23 Oct 2002 17:43:17 -0000 1.14
+++ install/deinstall 3 Nov 2002 02:58:33 -0000
@@ -88,6 +88,12 @@
fi
done
fi
+ if [ -n "${PKG_SHELL}" -a "${PKG_REGISTER_SHELLS}" =3D "YES" ]; then
+ ${ECHO} "=3D=3D=3D> Updating /etc/shells"
+ ${CP} /etc/shells /etc/shells.bak
+ (${GREP} -v ${PKG_SHELL} /etc/shells.bak || ${TRUE}) > /etc/shells
+ ${RM} /etc/shells.bak
+ fi
;;
=20
POST-DEINSTALL)
Index: install/header
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/pkgsrc/mk/install/header,v
retrieving revision 1.16
diff -u -r1.16 header
--- install/header 8 Oct 2002 11:32:34 -0000 1.16
+++ install/header 3 Nov 2002 02:58:33 -0000
@@ -65,6 +65,9 @@
PKG_SYSCONFBASE=3D"@PKG_SYSCONFBASE@"
PKG_SYSCONFDIR=3D"@PKG_SYSCONFDIR@"
=20
+PKG_REGISTER_SHELLS=3D"@PKG_REGISTER_SHELLS@"
+PKG_SHELL=3D"@PKG_SHELL@"
+
ALL_USERS=3D
ALL_GROUPS=3D
ALL_FILES=3D
Index: install/install
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/pkgsrc/mk/install/install,v
retrieving revision 1.16
diff -u -r1.16 install
--- install/install 23 Oct 2002 17:43:17 -0000 1.16
+++ install/install 3 Nov 2002 02:58:34 -0000
@@ -318,6 +318,13 @@
EOF
fi
fi
+ if [ -n "${PKG_SHELL}" -a "${PKG_REGISTER_SHELLS}" =3D "YES" ]; then
+ ${ECHO} "=3D=3D=3D> Updating /etc/shells"
+ ${TOUCH} /etc/shells
+ ${CP} /etc/shells /etc/shells.bak
+ (${GREP} -v ${PKG_SHELL} /etc/shells.bak || ${TRUE}; ${ECHO} ${PKG_SHELL=
}) > /etc/shells
+ ${RM} /etc/shells.bak
+ fi
;;
=20
*)
regards,
--=20
-- Lubomir Sedlacik <salo@Xtrmntr.org> ASCII Ribbon campaign against /"\=
--
-- <salo@silcnet.org> e-mail in gratuitous HTML and \ /=
--
-- Microsoft proprietary formats X =
--
-- PGPkey: http://Xtrmntr.org/salo.pgp / \=
--
-- Key Fingerprint: 75B2 2B96 CD75 0385 1C49 39B8 8B08 C30E 54BC 7263 =
--
--wULyF7TL5taEdwHz
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (NetBSD)
iD8DBQE9xJHCiwjDDlS8cmMRArU6AJ0cGMq96XxDPDps9aAKDkITAdt7EACeIJss
UgzoXm8/BJbdIxRC4F5lJ0Q=
=EoTz
-----END PGP SIGNATURE-----
--wULyF7TL5taEdwHz--