File opie-2.4-DESTDIR.patch of Package opie

Index: opie-2.4/Makefile.in
===================================================================
--- opie-2.4.orig/Makefile.in
+++ opie-2.4/Makefile.in
@@ -136,60 +136,60 @@ client: libopie/libopie.a libmissing/lib
 client-install: client
 	@echo "Installing OPIE client software..."
 	@echo "Copying OPIE key-related files"
-	@if test ! -d $(LOCALBIN); then $(MKDIR) $(LOCALBIN); chmod 755 $(LOCALBIN); fi 
-	@cp opiekey $(OPIEAUTO) $(LOCALBIN)
-	@cp opiesu $(OPIEAUTO) $(LOCALBIN)
-	@cp opielogin $(OPIEAUTO) $(LOCALBIN)
-	@cp opieftpd $(OPIEAUTO) $(LOCALBIN)
-	@cp opiegen $(OPIEAUTO) $(LOCALBIN)
-	@$(CHOWN) $(OWNER) $(LOCALBIN)/opiekey
-	@$(CHOWN) $(OWNER) $(LOCALBIN)/opiesu
-	@$(CHOWN) $(OWNER) $(LOCALBIN)/opielogin
-	@$(CHOWN) $(OWNER) $(LOCALBIN)/opieftpd
-	@$(CHOWN) $(OWNER) $(LOCALBIN)/opiegen
-	@if test ! -z "$(OPIEAUTO)"; then $(CHOWN) $(OWNER) $(LOCALBIN)/opieauto; fi
-	@chgrp $(GROUP) $(LOCALBIN)/opiekey
+	@if test ! -d $(DESTDIR)$(LOCALBIN); then $(MKDIR) $(DESTDIR)$(LOCALBIN); chmod 755 $(DESTDIR)$(LOCALBIN); fi 
+	@cp opiekey $(OPIEAUTO) $(DESTDIR)$(LOCALBIN)
+	@cp opiesu $(OPIEAUTO) $(DESTDIR)$(LOCALBIN)
+	@cp opielogin $(OPIEAUTO) $(DESTDIR)$(LOCALBIN)
+	@cp opieftpd $(OPIEAUTO) $(DESTDIR)$(LOCALBIN)
+	@cp opiegen $(OPIEAUTO) $(DESTDIR)$(LOCALBIN)
+	@$(CHOWN) $(OWNER) $(DESTDIR)$(LOCALBIN)/opiekey
+	@$(CHOWN) $(OWNER) $(DESTDIR)$(LOCALBIN)/opiesu
+	@$(CHOWN) $(OWNER) $(DESTDIR)$(LOCALBIN)/opielogin
+	@$(CHOWN) $(OWNER) $(DESTDIR)$(LOCALBIN)/opieftpd
+	@$(CHOWN) $(OWNER) $(DESTDIR)$(LOCALBIN)/opiegen
+	@if test ! -z "$(OPIEAUTO)"; then $(CHOWN) $(OWNER) $(DESTDIR)$(LOCALBIN)/opieauto; fi
+	@chgrp $(GROUP) $(DESTDIR)$(LOCALBIN)/opiekey
 	@echo "Changing file permissions"
-	@chmod 0755 $(LOCALBIN)/opiekey
-	@chmod 0755 $(LOCALBIN)/opieftpd
-	@chmod 0755 $(LOCALBIN)/opiegen
-	@chmod 0755 $(LOCALBIN)/opielogin
-	@chmod 4755 $(LOCALBIN)/opiesu
-	@if test ! -z "$(OPIEAUTO)"; then chmod 0511 $(LOCALBIN)/opieauto; fi
+	@chmod 0755 $(DESTDIR)$(LOCALBIN)/opiekey
+	@chmod 0755 $(DESTDIR)$(LOCALBIN)/opieftpd
+	@chmod 0755 $(DESTDIR)$(LOCALBIN)/opiegen
+	@chmod 0755 $(DESTDIR)$(LOCALBIN)/opielogin
+	@chmod 4755 $(DESTDIR)$(LOCALBIN)/opiesu
+	@if test ! -z "$(OPIEAUTO)"; then chmod 0511 $(DESTDIR)$(LOCALBIN)/opieauto; fi
 	@echo "Symlinking aliases to opiekey"
-	@-ln -s opiekey $(LOCALBIN)/otp-md4
-	@-ln -s opiekey $(LOCALBIN)/otp-md5
+	@-ln -s opiekey $(DESTDIR)$(LOCALBIN)/otp-md4
+	@-ln -s opiekey $(DESTDIR)$(LOCALBIN)/otp-md5
 	@echo "Installing manual pages"
-	@-for i in otp-md4 otp-md5; do ln -s opiekey.1 $(LOCALMAN)/man1/$$i.1; done
-	@if test ! -d $(LOCALMAN)/man1; then $(MKDIR) $(LOCALMAN)/man1; chmod 755 $(LOCALMAN)/man1; fi; cp opiekey.1 $(LOCALMAN)/man1/opiekey.1; $(CHOWN) $(OWNER) $(LOCALMAN)/man1/opiekey.1; chgrp $(GROUP) $(LOCALMAN)/man1/opiekey.1; chmod 644 $(LOCALMAN)/man1/opiekey.1
+	@-for i in otp-md4 otp-md5; do ln -s opiekey.1 $(DESTDIR)$(LOCALMAN)/man1/$$i.1; done
+	@if test ! -d $(DESTDIR)$(LOCALMAN)/man1; then $(MKDIR) $(DESTDIR)$(LOCALMAN)/man1; chmod 755 $(DESTDIR)$(LOCALMAN)/man1; fi; cp opiekey.1 $(DESTDIR)$(LOCALMAN)/man1/opiekey.1; $(CHOWN) $(OWNER) $(DESTDIR)$(LOCALMAN)/man1/opiekey.1; chgrp $(GROUP) $(DESTDIR)$(LOCALMAN)/man1/opiekey.1; chmod 644 $(DESTDIR)$(LOCALMAN)/man1/opiekey.1
 
 server:	libopie/libopie.a libmissing/libmissing.a opietest-passed opielogin opiesu opiepasswd opieinfo opieftpd opieserv
 
 server-install: server
 	@echo "Installing OPIE server software..."
 	@echo "Copying OPIE user programs"
-	@if test ! -d $(LOCALBIN); then $(MKDIR) $(LOCALBIN); chmod 755 $(LOCALBIN); fi 
-	@cp opiepasswd opieinfo $(LOCALBIN)
+	@if test ! -d $(DESTDIR)$(LOCALBIN); then $(MKDIR) $(DESTDIR)$(LOCALBIN); chmod 755 $(DESTDIR)$(LOCALBIN); fi 
+	@cp opiepasswd opieinfo $(DESTDIR)$(LOCALBIN)
 	@echo "Changing ownership"
-	@$(CHOWN) $(OWNER) $(LOCALBIN)/opiepasswd $(LOCALBIN)/opieinfo
-	@chgrp $(GROUP) $(LOCALBIN)/opiepasswd $(LOCALBIN)/opieinfo
+	@$(CHOWN) $(OWNER) $(DESTDIR)$(LOCALBIN)/opiepasswd $(DESTDIR)$(LOCALBIN)/opieinfo
+	@chgrp $(GROUP) $(DESTDIR)$(LOCALBIN)/opiepasswd $(DESTDIR)$(LOCALBIN)/opieinfo
 	@echo "Changing file permissions"
-	@chmod 0755 $(LOCALBIN)/opieinfo
-	@chmod 4755 $(LOCALBIN)/opiepasswd
+	@chmod 0755 $(DESTDIR)$(LOCALBIN)/opieinfo
+	@chmod 4755 $(DESTDIR)$(LOCALBIN)/opiepasswd
 
 	@echo "Installing OPIE system programs..."
 	@echo "Making sure OPIE database file exists";
-	@touch $(KEY_FILE)
+	@touch $(DESTDIR)$(KEY_FILE)
 	@echo "Changing permissions of OPIE database file"
-	@chmod 0600 $(KEY_FILE)
+	@chmod 0600 $(DESTDIR)$(KEY_FILE)
 	@echo "Changing ownership of OPIE database file"
-	@$(CHOWN) $(OWNER) $(KEY_FILE)
-	@chgrp $(GROUP) $(KEY_FILE)
-	@-if test ! -z "$(LOCK_DIR)"; then echo "Creating OPIE lock directory"; mkdir $(LOCK_DIR); $(CHOWN) 0 $(LOCK_DIR); chgrp 0 $(LOCK_DIR); chmod 0700 $(LOCK_DIR); fi;
+	@$(CHOWN) $(OWNER) $(DESTDIR)$(KEY_FILE)
+	@chgrp $(GROUP) $(DESTDIR)$(KEY_FILE)
+	@-if test ! -z "$(DESTDIR)$(LOCK_DIR)"; then echo "Creating OPIE lock directory"; mkdir $(DESTDIR)$(LOCK_DIR); $(CHOWN) 0 $(DESTDIR)$(LOCK_DIR); chgrp 0 $(DESTDIR)$(LOCK_DIR); chmod 0700 $(DESTDIR)$(LOCK_DIR); fi;
 	@-if test ! -z "$(ACCESS_FILE)"; then echo "Creating OPIE access file (don't say we didn't warn you)"; touch $(ACCESS_FILE); $(CHOWN) 0 $(ACCESS_FILE); chgrp 0 $(ACCESS_FILE); chmod 0444 $(ACCESS_FILE); fi;
 	@echo "Installing manual pages"
-	@if test ! -d $(LOCALMAN); then $(MKDIR) $(LOCALMAN); chmod 755 $(LOCALMAN); fi
-	@for i in 1 4 5 8; do for j in *.$$i; do if test ! -d $(LOCALMAN)/man$$i; then $(MKDIR) $(LOCALMAN)/man$$i; chmod 755 $(LOCALMAN)/man$$i; fi; cp $$j $(LOCALMAN)/man$$i/$$j; $(CHOWN) $(OWNER) $(LOCALMAN)/man$$i/$$j; chgrp $(GROUP) $(LOCALMAN)/man$$i/$$j; chmod 644 $(LOCALMAN)/man$$i/$$j; done; done
+	@if test ! -d $(DESTDIR)$(LOCALMAN); then $(MKDIR) $(DESTDIR)$(LOCALMAN); chmod 755 $(DESTDIR)$(LOCALMAN); fi
+	@for i in 1 4 5 8; do for j in *.$$i; do if test ! -d $(DESTDIR)$(LOCALMAN)/man$$i; then $(MKDIR) $(DESTDIR)$(LOCALMAN)/man$$i; chmod 755 $(DESTDIR)$(LOCALMAN)/man$$i; fi; cp $$j $(DESTDIR)$(LOCALMAN)/man$$i/$$j; $(CHOWN) $(OWNER) $(DESTDIR)$(LOCALMAN)/man$$i/$$j; chgrp $(GROUP) $(DESTDIR)$(LOCALMAN)/man$$i/$$j; chmod 644 $(DESTDIR)$(LOCALMAN)/man$$i/$$j; done; done
 	@echo "REMEMBER to run opiepasswd on your users immediately."
 
 install: client-install server-install
@@ -197,12 +197,12 @@ install: client-install server-install
 uninstall:
 	@echo "Un-installing OPIE..."
 	@echo "Removing symlinks"
-	@-for i in otp-md4 otp-md5; do rm $(LOCALBIN)/$$i; done
+	@-for i in otp-md4 otp-md5; do rm $(DESTDIR)$(LOCALBIN)/$$i; done
 	@echo "Removing OPIE programs"
-	@-for i in opiekey opiepasswd opieinfo; do rm $(LOCALBIN)/$$i; done
+	@-for i in opiekey opiepasswd opieinfo; do rm $(DESTDIR)$(LOCALBIN)/$$i; done
 	@echo "Removing OPIE manual pages"
-	@-for i in 1 4 5 8; do for j in *.$$i; do rm $(LOCALMAN)/man$$i/$$j; done; done
-	@-rm $(LOCALMAN)/man1/otp-md4.1 $(LOCALMAN)/man1/otp-md5.1
+	@-for i in 1 4 5 8; do for j in *.$$i; do rm $(DESTDIR)$(LOCALMAN)/man$$i/$$j; done; done
+	@-rm $(DESTDIR)$(LOCALMAN)/man1/otp-md4.1 $(DESTDIR)$(LOCALMAN)/man1/otp-md5.1
 	@echo "Restoring old binaries"
 	@-for i in $(SU) $(ALT_SU) $(LOGIN) $(FTPD); do FILE=`basename $$i`; if test ! $(EXISTS) $$i.$(BACKUP); then echo "No $$i.$(BACKUP)! Aborting."; exit 1; else echo "Removing $$FILE"; rm $$i || true; echo "Restoring old $$FILE"; mv $$i.$(BACKUP) $$i; fi; done
 	@echo "Resetting permissions"
@@ -216,7 +216,7 @@ opietest-passed:	opietest
 	-./opietest && touch opietest-passed
 
 libopie/libopie.a: libopie/*.c *.h
-	(cd libopie ; $(MAKE) libopie.a CFL='$(CFLAGS) -DKEY_FILE=\"$(KEY_FILE)\"')
+	(cd libopie ; $(MAKE) libopie.a CFL='$(CFLAGS) -DKEY_FILE=\"$(DESTDIR)$(KEY_FILE)\"')
 
 libmissing/libmissing.a: libmissing/*.c
 	(cd libmissing ; $(MAKE) libmissing.a CFL='$(CFLAGS)')