Created
April 18, 2010 14:12
-
-
Save yugui/370232 to your computer and use it in GitHub Desktop.
patch for apcupsd in order to make it a solaris pkg
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/.gitignore b/.gitignorenew file mode 100644 | |
index 0000000..01bee7b | |
--- /dev/null | |
+++ b/.gitignore | |
@@ -0,0 +1,30 @@ | |
+.obj | |
+.deps | |
+*.a | |
+config.log | |
+config.out | |
+config.status | |
+doc/apcaccess.man.txt | |
+doc/apccontrol.man.txt | |
+doc/apctest.man.txt | |
+doc/apcupsd.conf.man.txt | |
+doc/apcupsd.man.txt | |
+examples/safe.apccontrol | |
+include/config.h | |
+platforms/apccontrol | |
+platforms/etc/apcupsd.conf | |
+platforms/etc/changeme | |
+platforms/etc/commfailure | |
+platforms/etc/commok | |
+platforms/etc/offbattery | |
+platforms/etc/onbattery | |
+platforms/sun/.Makefile.swp | |
+platforms/sun/apccontrol | |
+platforms/sun/apcupsd | |
+platforms/sun/rc0.solaris | |
+src/apcaccess | |
+src/apctest | |
+src/apcupsd | |
+src/drivers/usb/generic/libusb.h | |
+src/smtp | |
+src/win32/Makefile | |
diff --git a/autoconf/variables.mak b/autoconf/variables.mak | |
new file mode 100644 | |
index 0000000..f71129a | |
--- /dev/null | |
+++ b/autoconf/variables.mak | |
@@ -0,0 +1,103 @@ | |
+# General rules for Makefile(s) subsystem. | |
+# In this file we will put everything that need to be | |
+# shared betweek all the Makefile(s). | |
+# This file must be included at the beginning of every Makefile | |
+# | |
+# Copyright (C) 1999-2002 Riccardo Facchetti <[email protected]> | |
+ | |
+# | |
+# package version | |
+PACKAGE = apcupsd | |
+DISTNAME = sun | |
+DISTVER = Solaris | |
+VERSION = 3.14.8 | |
+ | |
+# | |
+# programs needed by compilation | |
+CP = /opt/sfw/bin/cp | |
+MV = /opt/sfw/bin/mv | |
+ECHO = /opt/sfw/bin/echo | |
+RM = /opt/sfw/bin/rm | |
+RMF = $(RM) -rf | |
+LN = /opt/sfw/bin/ln | |
+SED = /usr/bin/sed | |
+MAKE = gmake | |
+SHELL = /bin/bash | |
+RANLIB = /usr/ccs/bin/ranlib | |
+AR = /usr/ccs/bin/ar | |
+INSTALL = /opt/csw/bin/ginstall -c | |
+INSTALL_PROGRAM = ${INSTALL} | |
+INSTALL_DATA = ${INSTALL} -m 644 | |
+INSTALL_SCRIPT = ${INSTALL} | |
+MKINSTALLDIRS = /export/home/yugui/src/apcupsd/apcupsd-3.14.8/autoconf/mkinstalldirs | |
+CHKCONFIG = /sbin/chkconfig | |
+RST2HTML := | |
+RST2PDF := | |
+ | |
+# Files and directories (paths) | |
+prefix = /opt/local | |
+exec_prefix = ${prefix} | |
+sysconfdir = ${prefix}/etc/apcupsd | |
+cgibin = ${prefix}/etc/apcupsd | |
+VPATH = /opt/csw/lib:/opt/sfw/lib:/usr/sfw/lib:/usr/lib:/usr/local/lib | |
+srcdir = . | |
+abstopdir = /export/home/yugui/src/apcupsd/apcupsd-3.14.8 | |
+sbindir = ${prefix}/sbin | |
+piddir = ${prefix}/var/run | |
+mandir=/${prefix}/share/man | |
+bindir = ${exec_prefix}/bin | |
+datadir = ${prefix}/share | |
+HALPOLICYDIR = | |
+DISTDIR = sun | |
+PWRFAILDIR = ${prefix}/etc | |
+LOCKDIR = ${prefix}/var/spool/locks | |
+ | |
+# Compilation macros. | |
+CC = gcc | |
+CXX = g++ | |
+OBJC = $(CC) -x objective-c++ | |
+NIB = ibtool | |
+LD = gcc | |
+DEFS = $(LOCALDEFS) | |
+ | |
+# Libraries | |
+APCLIBS = $(topdir)/src/lib/libapc.a | |
+APCDRVLIBS = $(topdir)/src/drivers/libdrivers.a $(topdir)/src/libusbhid/libusbhid.a | |
+DRVLIBS = -lpthread -L/usr/sfw/lib -lusb | |
+X_LIBS = | |
+X_EXTRA_LIBS = | |
+ | |
+CPPFLAGS = -I/usr/local/include -I/usr/sfw/include -I$(topdir)/include $(EXTRAINCS) | |
+CFLAGS = $(CPPFLAGS) -g -O2 -Wall -D_POSIX_PTHREAD_SEMANTICS | |
+CXXFLAGS = $(CPPFLAGS) -g -O2 -fno-exceptions -fno-rtti -Wall -D_POSIX_PTHREAD_SEMANTICS | |
+OBJCFLAGS = $(CPPFLAGS) $(CFLAGS) | |
+LDFLAGS = -L/usr/local/lib64 -L/usr/local/lib -L/usr/sfw/lib | |
+LIBS = -lnsl -lxnet -lrt -lsupc++ | |
+LIBGD = | |
+POWERLIBS = | |
+GAPCMON_CFLAGS = -DHAVE_FUNC_GETHOSTBYNAME_R_5 | |
+GAPCMON_LIBS = | |
+LIBEXTRAOBJ = | |
+RST2HTMLOPTS = --field-name-limit=0 --generator --time --no-footnote-backlinks --record-dependencies=$(df).d | |
+RST2PDFOPTS = --no-footnote-backlinks | |
+NIBFLAGS = | |
+ | |
+# Driver and package enable flags | |
+SMARTDRV := apcsmart | |
+DUMBDRV := dumb | |
+USBDRV := usb | |
+NETDRV := net | |
+PCNETDRV := pcnet | |
+SNMPDRV := | |
+SNMPLTDRV := snmplite | |
+TESTDRV := | |
+USBTYPE := generic | |
+CGIDIR := | |
+USBHIDDIR := libusbhid | |
+GAPCMON := | |
+APCAGENT := | |
+ | |
+OBJDIR = .obj | |
+DEPDIR = .deps | |
+df = $(DEPDIR)/$(*F) | |
+DEVNULL := >/dev/null 2>&1 | |
diff --git a/depend b/depend | |
new file mode 100644 | |
index 0000000..715d5ca | |
--- /dev/null | |
+++ b/depend | |
@@ -0,0 +1,3 @@ | |
+P SUNWlibusb libusb | |
+P SUNWlibusbugen libusb | |
+P SUNWperl584usr perl for postinstall | |
diff --git a/pkginfo b/pkginfo | |
new file mode 100644 | |
index 0000000..7b811d8 | |
--- /dev/null | |
+++ b/pkginfo | |
@@ -0,0 +1,9 @@ | |
+PKG=YUGUIapcupsd | |
+NAME=Apcupsd | |
+ARCH=sparc | |
+CATEGORY=application | |
+VERSION=3.14.8 | |
+VENDOR=http://www.apcupsd.com/ | |
+HOTLINE=on your risk | |
+EMAIL=on your risk | |
+DESC=a daemon for controlling APC UPSes | |
diff --git a/platforms/sun/Makefile b/platforms/sun/Makefile | |
index c8475fd..12c25a4 100644 | |
--- a/platforms/sun/Makefile | |
+++ b/platforms/sun/Makefile | |
@@ -8,14 +8,14 @@ all-uninstall: uninstall-sun $(if $(DESTDIR),,uninstall-$(USBDRV)) | |
install-sun: | |
$(call DISTINST,Sun) | |
- $(call MKDIR,/etc/rc0.d) | |
- $(call MKDIR,/etc/rc1.d) | |
- $(call MKDIR,/etc/rc2.d) | |
- $(call MKDIR,/etc/init.d) | |
- $(call INSTPROG,744,apcupsd,/etc/init.d/apcupsd) | |
- $(call SYMLINK,../init.d/apcupsd,/etc/rc0.d/K21apcupsd) | |
- $(call SYMLINK,../init.d/apcupsd,/etc/rc1.d/S89apcupsd) | |
- $(call SYMLINK,../init.d/apcupsd,/etc/rc2.d/S89apcupsd) | |
+ $(call MKDIR,${prefix}/etc/rc0.d) | |
+ $(call MKDIR,${prefix}/etc/rc1.d) | |
+ $(call MKDIR,${prefix}/etc/rc2.d) | |
+ $(call MKDIR,${prefix}/etc/init.d) | |
+ $(call INSTPROG,744,apcupsd,${prefix}/etc/init.d/apcupsd) | |
+ $(call SYMLINK,../init.d/apcupsd,${prefix}/etc/rc0.d/K21apcupsd) | |
+ $(call SYMLINK,../init.d/apcupsd,${prefix}/etc/rc1.d/S89apcupsd) | |
+ $(call SYMLINK,../init.d/apcupsd,${prefix}/etc/rc2.d/S89apcupsd) | |
@echo "=================================================" | |
@echo "apcupsd script installation for Solaris $(DISTVER) complete." | |
@echo "You should now edit $(sysconfdir)/apcupsd.conf to correspond" | |
diff --git a/postinstall b/postinstall | |
new file mode 100644 | |
index 0000000..a4788c0 | |
--- /dev/null | |
+++ b/postinstall | |
@@ -0,0 +1,27 @@ | |
+#!/bin/sh | |
+ | |
+base=`pkginfo -l YUGUIapcupsd | grep BASEDIR | sed 's/ *//g' | cut -d':' -f 2` | |
+if [ -z "$base" ]; then | |
+ exit 1 | |
+fi | |
+ | |
+perl -i.bak -pe "s!/opt/local!$base!" $base/lib/svc/method/apcupsd | |
+perl -i.bak -pe "s!/opt/local!$base!" $base/var/svc/manifest/system/apcupsd.xml | |
+perl -i.bak -pe "s!/opt/local!$base!" $base/etc/init.d/apcupsd | |
+ | |
+echo "Configuring ugen driver to match APC UPSes..." | |
+echo | |
+add_drv -f -i '"usbif51d,class3"' ugen || update_drv -a -i '"usbif51d,class3"' ugen | |
+echo | |
+echo "NOTE:" | |
+echo " \"(usbif51d,class3) already in use\" and" | |
+echo " \"Driver (ugen) is already installed\"" | |
+echo " errors may be safely ignored." | |
+echo | |
+echo "=================================================" | |
+echo "Driver configured. You must PERFORM A RECONFIGURE" | |
+echo "BOOT \"reboot -- -r\" before running Apcupsd." | |
+echo "=================================================" | |
+ | |
+svccfg import $base/var/svc/manifest/system/apcupsd.xml | |
+svcadm enable apcupsd | |
diff --git a/preuninstall b/preuninstall | |
new file mode 100644 | |
index 0000000..51a7734 | |
--- /dev/null | |
+++ b/preuninstall | |
@@ -0,0 +1,4 @@ | |
+#!/bin/sh | |
+ | |
+svcadm disable apcupsd | |
+svccfg delete apcupsd | |
diff --git a/prototype b/prototype | |
new file mode 100644 | |
index 0000000..058efac | |
--- /dev/null | |
+++ b/prototype | |
@@ -0,0 +1,43 @@ | |
+i pkginfo | |
+i depend | |
+i postinstall | |
+i preuninstall | |
+d none share 0755 root root | |
+d none share/man 0755 root root | |
+d none share/man/man8 0755 root root | |
+f none share/man/man8/apcaccess.8 0644 root root | |
+f none share/man/man8/apctest.8 0644 root root | |
+f none share/man/man8/apccontrol.8 0644 root root | |
+f none share/man/man8/apcupsd.8 0644 root root | |
+d none share/man/man5 0755 root root | |
+f none share/man/man5/apcupsd.conf.5 0644 root root | |
+d none sbin 0755 root root | |
+f none sbin/apcaccess 0755 root root | |
+f none sbin/smtp 0755 root root | |
+f none sbin/apctest 0700 root root | |
+f none sbin/apcupsd 0700 root root | |
+d none var 0755 root root | |
+d none var/svc 0755 root root | |
+d none var/svc/manifest 0755 root root | |
+d none var/svc/manifest/system 0755 root root | |
+f none var/svc/manifest/system/apcupsd.xml 0644 root root | |
+d none etc 0755 root root | |
+f none etc/apccontrol 0744 root root | |
+f none etc/commfailure 0744 root root | |
+f none etc/changeme 0744 root root | |
+f none etc/apcupsd.conf 0644 root root | |
+d none etc/rc0.d 0755 root root | |
+s none etc/rc0.d/K21apcupsd=../init.d/apcupsd | |
+f none etc/onbattery 0744 root root | |
+d none etc/init.d 0755 root root | |
+f none etc/init.d/apcupsd 0744 root root | |
+d none etc/rc1.d 0755 root root | |
+s none etc/rc1.d/S89apcupsd=../init.d/apcupsd | |
+f none etc/commok 0744 root root | |
+f none etc/offbattery 0744 root root | |
+d none etc/rc2.d 0755 root root | |
+s none etc/rc2.d/S89apcupsd=../init.d/apcupsd | |
+d none lib 0755 root root | |
+d none lib/svc 0755 root root | |
+d none lib/svc/method 0755 root root | |
+f none lib/svc/method/apcupsd 0744 root root |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment