Subject: misc/1458: Use $(INSTALL) rather than install in *.mk
To: None <gnats-bugs@gnats.netbsd.org>
From: Simon J. Gerraty <sjg@zen.void.oz.au>
List: netbsd-bugs
Date: 09/13/1995 23:29:38
>Number:         1458
>Category:       misc
>Synopsis:       it should be possible to use a different installer
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 13 09:35:01 1995
>Last-Modified:
>Originator:     Simon J. Gerraty
>Organization:
Zen Programming...
>Release:        95-08-18
>Environment:
	
System: NetBSD zen.void.oz.au 1.0A NetBSD 1.0A (ZEN) #0: Fri Aug 18 18:59:14 EST 1995 root@zen.void.oz.au:/f1/usr.src/sys/arch/i386/compile/ZEN i386


>Description:
	
It is often nice to be able to use something other than /usr/bin/install
I usually use my own install.sh which avoids a lot of problems such
as running binaries, and problems installing as non-root:

install: /d2/users/sjg/nhack/testaddr/../bin/testaddr: chown/chgrp:
Operation not permitted

The patch below makes /usr/share/mk/* use $(INSTALL) instead.
It would be NICE if BINOWN etc we defined as:
BINOWN= -oroot

so that non root users could simply put
BINOWN=
in their Makefile and avoid all the errors (forcing them to install as
root or by hand).

If the above is ok, I can easily do the needed patches (to the whole
tree).  Or supply the shell script to do it.

>How-To-Repeat:
	
>Fix:
	
Index: bsd.doc.mk
===================================================================
RCS file: /local/src/master/usr.src/share/mk/bsd.doc.mk,v
retrieving revision 1.1.1.1
diff -c -b -r1.1.1.1 bsd.doc.mk
*** bsd.doc.mk	1995/04/11 08:44:00	1.1.1.1
--- bsd.doc.mk	1995/09/13 13:16:57
***************
*** 42,48 ****
  
  FILES?=	${SRCS}
  install:
! 	install -c -o ${BINOWN} -g ${BINGRP} -m 444 \
  	    Makefile ${FILES} ${EXTRA} ${DESTDIR}${BINDIR}/${DIR}
  
  spell: ${SRCS}
--- 42,48 ----
  
  FILES?=	${SRCS}
  install:
! 	$(INSTALL) -c -o ${BINOWN} -g ${BINGRP} -m 444 \
  	    Makefile ${FILES} ${EXTRA} ${DESTDIR}${BINDIR}/${DIR}
  
  spell: ${SRCS}
Index: bsd.lib.mk
===================================================================
RCS file: /local/src/master/usr.src/share/mk/bsd.lib.mk,v
retrieving revision 1.1.1.5
diff -c -b -r1.1.1.5 bsd.lib.mk
*** bsd.lib.mk	1995/07/10 09:02:31	1.1.1.5
--- bsd.lib.mk	1995/09/13 13:18:34
***************
*** 155,184 ****
  
  realinstall:
  #	ranlib lib${LIB}.a
! 	install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 lib${LIB}.a \
  	    ${DESTDIR}${LIBDIR}
  	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a
  	chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}.a
  .if !defined(NOPROFILE)
  #	ranlib lib${LIB}_p.a
! 	install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \
  	    lib${LIB}_p.a ${DESTDIR}${LIBDIR}
  	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
  	chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
  .endif
  .if !defined(NOPIC)
  #	ranlib lib${LIB}_pic.a
! 	install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \
  	    lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
  	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
  	chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
  .endif
  .if !defined(NOPIC) && defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
! 	install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
  	    lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} ${DESTDIR}${LIBDIR}
  .endif
  .if !defined(NOLINT)
! 	install ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
  	    llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR}
  .endif
  .if defined(LINKS) && !empty(LINKS)
--- 155,184 ----
  
  realinstall:
  #	ranlib lib${LIB}.a
! 	$(INSTALL) ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 lib${LIB}.a \
  	    ${DESTDIR}${LIBDIR}
  	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}.a
  	chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}.a
  .if !defined(NOPROFILE)
  #	ranlib lib${LIB}_p.a
! 	$(INSTALL) ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \
  	    lib${LIB}_p.a ${DESTDIR}${LIBDIR}
  	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
  	chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_p.a
  .endif
  .if !defined(NOPIC)
  #	ranlib lib${LIB}_pic.a
! 	$(INSTALL) ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m 600 \
  	    lib${LIB}_pic.a ${DESTDIR}${LIBDIR}
  	${RANLIB} -t ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
  	chmod ${LIBMODE} ${DESTDIR}${LIBDIR}/lib${LIB}_pic.a
  .endif
  .if !defined(NOPIC) && defined(SHLIB_MAJOR) && defined(SHLIB_MINOR)
! 	$(INSTALL) ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
  	    lib${LIB}.so.${SHLIB_MAJOR}.${SHLIB_MINOR} ${DESTDIR}${LIBDIR}
  .endif
  .if !defined(NOLINT)
! 	$(INSTALL) ${COPY} -o ${LIBOWN} -g ${LIBGRP} -m ${LIBMODE} \
  	    llib-l${LIB}.ln ${DESTDIR}${LINTLIBDIR}
  .endif
  .if defined(LINKS) && !empty(LINKS)
Index: bsd.man.mk
===================================================================
RCS file: /local/src/master/usr.src/share/mk/bsd.man.mk,v
retrieving revision 1.1.1.2
diff -c -b -r1.1.1.2 bsd.man.mk
*** bsd.man.mk	1995/06/27 01:08:32	1.1.1.2
--- bsd.man.mk	1995/09/13 13:16:58
***************
*** 22,28 ****
  MANALL=	${MAN:S/.1$/.cat1/g:S/.2$/.cat2/g:S/.3$/.cat3/g:S/.4$/.cat4/g:S/.5$/.cat5/g:S/.6$/.cat6/g:S/.7$/.cat7/g:S/.8$/.cat8/g}
  .endif
  
! MINSTALL=	install ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
  .if defined(MANZ)
  # chown and chmod are done afterward automatically
  MCOMPRESS=	gzip -cf
--- 22,28 ----
  MANALL=	${MAN:S/.1$/.cat1/g:S/.2$/.cat2/g:S/.3$/.cat3/g:S/.4$/.cat4/g:S/.5$/.cat5/g:S/.6$/.cat6/g:S/.7$/.cat7/g:S/.8$/.cat8/g}
  .endif
  
! MINSTALL=	$(INSTALL) ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
  .if defined(MANZ)
  # chown and chmod are done afterward automatically
  MCOMPRESS=	gzip -cf
Index: bsd.nls.mk
===================================================================
RCS file: /local/src/master/usr.src/share/mk/bsd.nls.mk,v
retrieving revision 1.1.1.1
diff -c -b -r1.1.1.1 bsd.nls.mk
*** bsd.nls.mk	1995/05/02 05:55:58	1.1.1.1
--- bsd.nls.mk	1995/09/13 13:16:58
***************
*** 31,38 ****
  	@for msg in ${NLSALL}; do \
  		NLSLANG=`basename $$msg .cat`; \
  		dir=${DESTDIR}${NLSDIR}/$${NLSLANG}; \
! 		install -d $$dir; \
! 		install ${COPY} -o ${NLSOWN} -g ${NLSGRP} -m ${NLSMODE} $$msg $$dir/${NLSNAME}.cat; \
  	done
  .endif
  
--- 31,38 ----
  	@for msg in ${NLSALL}; do \
  		NLSLANG=`basename $$msg .cat`; \
  		dir=${DESTDIR}${NLSDIR}/$${NLSLANG}; \
! 		$(INSTALL) -d $$dir; \
! 		$(INSTALL) ${COPY} -o ${NLSOWN} -g ${NLSGRP} -m ${NLSMODE} $$msg $$dir/${NLSNAME}.cat; \
  	done
  .endif
  
Index: bsd.own.mk
===================================================================
RCS file: /local/src/master/usr.src/share/mk/bsd.own.mk,v
retrieving revision 1.1.1.4
diff -c -b -r1.1.1.4 bsd.own.mk
*** bsd.own.mk	1995/08/09 09:57:10	1.1.1.4
--- bsd.own.mk	1995/09/13 13:21:42
***************
*** 43,48 ****
--- 43,49 ----
  NLSOWN?=	bin
  NLSMODE?=	${NONBINMODE}
  
+ INSTALL?=	install
  COPY?=		-c
  STRIP?=		-s
  
Index: bsd.prog.mk
===================================================================
RCS file: /local/src/master/usr.src/share/mk/bsd.prog.mk,v
retrieving revision 1.1.1.3
diff -c -b -r1.1.1.3 bsd.prog.mk
*** bsd.prog.mk	1995/06/27 01:08:30	1.1.1.3
--- bsd.prog.mk	1995/09/13 13:19:42
***************
*** 103,109 ****
  .if !target(realinstall)
  realinstall:
  .if defined(PROG)
! 	install ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
  	    ${PROG} ${DESTDIR}${BINDIR}
  .endif
  .if defined(HIDEGAME)
--- 103,109 ----
  .if !target(realinstall)
  realinstall:
  .if defined(PROG)
! 	$(INSTALL) ${COPY} ${STRIP} -o ${BINOWN} -g ${BINGRP} -m ${BINMODE} \
  	    ${PROG} ${DESTDIR}${BINDIR}
  .endif
  .if defined(HIDEGAME)
>Audit-Trail:
>Unformatted: