All pastes #94783 Raw Edit

robw810-patch

public text v1 · immutable
#94783 ·published 2006-07-21 14:25 UTC
rendered paste body
--- ./platforms/slackware/Makefile.in.orig      2003-09-14 02:57:40.000000000 -0500
+++ ./platforms/slackware/Makefile.in   2006-07-21 09:10:57.000000000 -0500
@@ -16,52 +16,43 @@

 install:
        @echo "Slackware distribution installation"
-       $(INSTALL_PROGRAM) -m 744 apcupsd /etc/rc.d/rc.apcupsd
-       $(INSTALL_PROGRAM) -d -m 755 @LOCKDIR@/subsys
-       @-rcfile=/etc/rc.d/rc.6; \
-       grep -q @sysconfdir@/apccontrol $$rcfile; \
+       mkdir -p $(DESTDIR)/etc/rc.d
+       $(INSTALL_PROGRAM) -m 744 apcupsd $(DESTDIR)/etc/rc.d/rc.apcupsd
+       $(INSTALL_PROGRAM) -d -m 755 $(DESTDIR)/@LOCKDIR@/subsys
+       grep -q @sysconfdir@/apccontrol /etc/rc.d/rc.6; \
        if [ $$? -ne 0 ]; then \
-           echo "Patching $$rcfile"; \
-           cp -p $$rcfile $$rcfile.`date +%Y%m%d%M%S`; \
-           patch -s $$rcfile rc6.patch; \
+           echo "Creating /etc/rc.d/rc.6.new"; \
+           cp -p /etc/rc.d/rc.6 rc.6.new; \
+           patch -s rc.6.new rc6.patch; \
            if [ $$? -ne 0 ]; then \
                echo; \
-               echo "Patches could not be properly applied.  Please check"; \
-               echo "$$rcfile and edit it manually."; \
+               echo "There was a problem creating a modified /etc/rc.d/rc.6 init script."; \
+               echo "Please check /etc/rc.d/rc.6 and edit it manually using information"; \
+               echo "from platforms/slackware/rc6.patch."; \
                echo; \
                exit 1; \
            fi; \
-       else \
-           echo "$$rcfile appears to already have been patched."; \
-           echo "leaving it unchanged"; \
+           $(INSTALL_PROGRAM) -m 744 rc.6.new $(DESTDIR)/etc/rc.d/rc.6.new
        fi
        @( echo ''; \
        echo "The apcupsd boot script has been installed to"; \
-       echo "/etc/rc.d/rc.apcupsd and the halt script /etc/rc.d/rc.6 has"; \
-       echo "been patched.  You must still call /etc/rc.d/rc.apcupsd"; \
+       echo "/etc/rc.d/rc.apcupsd and the halt script /etc/rc.d/rc.6.new"; \
+       echo "has been created.  You will need to manually merge the new"; \
+       echo "config file (/etc/rc.d/rc.6.new) with your existing file if"; \
+       echo "you have made changes to the original which you want to keep;"; \
+       echo "otherwise, you can simply replace the existing rc.6 file with"; \
+       echo "the rc.6.new file.  You must still call /etc/rc.d/rc.apcupsd"; \
        echo "during the boot process after you have tested your"; \
        echo "installation.  One way to do this is from the"; \
        echo "/etc/rc.d/rc.local file."; \
-       echo "See the distributions/slackware/README file."; \
+       echo "See the platforms/slackware/README file."; \
        echo ) | /usr/bin/fmt

 uninstall:
        @echo "Slackware distribution uninstall"
-       rm -f /etc/rc.d/rc.apcupsd
+       @rm -f $(DESTDIR)/etc/rc.d/rc.apcupsd
        @-rcfile=/etc/rc.d/rc.6; \
-       grep -q @sysconfdir@/apccontrol $$rcfile; \
-       if [ $$? -eq 0 ]; then \
-           echo "Unpatching $$rcfile"; \
-           cp -p $$rcfile $$rcfile.`date +%Y%m%d%M%S`; \
-           patch -s -R $$rcfile rc6.patch; \
-           if [ $$? -ne 0 ]; then \
-               echo; \
-               echo "Patches could not be properly removed.  Please check"; \
-               echo "$$rcfile and edit it manually."; \
-               echo; \
-               exit 1; \
-           fi; \
-       fi; \
+       @rm -f $(DESTDIR)/etc/rc.d/rc.6.new
        echo "References to rc.apcupsd (rc.local?) have not been removed."

 clean: