Subject: #define name for non-root pkg_install tools
To: None <tech-pkg@netbsd.org>
From: Todd Vierling <tv@duh.org>
List: tech-pkg
Date: 03/29/2004 12:20:09
I have some local hacks in my tree that are Interix-specific, but can be
thought of as more general when packages are not assumed to be installed by
one user (where group permissions provide administrative status, rather than
just uid0).
The diff follows. Of course, I'd like to choose a different name for the
symbol and put it into pkgtools/pkg_install/Makefile, rather than potting an
OS-specific symbol there. Is there a preferred naming convention here? I
was thinking "PKG_INSTALL_AS_NONROOT", but that sounds clunky.
Index: files/add/perform.c
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pkg_install/files/add/perform.c,v
retrieving revision 1.17
diff -u -r1.17 perform.c
--- files/add/perform.c 29 Mar 2004 02:25:06 -0000 1.17
+++ files/add/perform.c 29 Mar 2004 17:18:36 -0000
@@ -720,9 +720,13 @@
if (!NoRecord && !Fake) {
char contents[FILENAME_MAX];
+#ifdef __INTERIX
+ umask(002);
+#else
umask(022);
if (getuid() != 0)
warnx("not running as root - trying to record install anyway");
+#endif
if (!PkgName) {
warnx("no package name! can't record package, sorry");
errc = 1;
Index: files/delete/main.c
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/pkg_install/files/delete/main.c,v
retrieving revision 1.12
diff -u -r1.12 main.c
--- files/delete/main.c 29 Mar 2004 02:25:06 -0000 1.12
+++ files/delete/main.c 29 Mar 2004 17:18:36 -0000
@@ -184,9 +184,11 @@
warnx("missing package name(s)");
usage();
}
+#ifndef __INTERIX
if (!Fake && getuid() != 0) {
warnx("not running as root - trying to delete anyways");
}
+#endif
if (OnlyDeleteFromPkgDB) {
/* Only delete the given packages' files from pkgdb, do not
* touch the pkg itself. Used by "make reinstall" in
--
-- Todd Vierling <tv@duh.org> <tv@pobox.com>