[csw-devel] SF.net SVN: gar:[6154] csw/mgar/pkg/unixodbc/trunk
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Tue Sep 1 20:12:04 CEST 2009
Revision: 6154
http://gar.svn.sourceforge.net/gar/?rev=6154&view=rev
Author: wahwah
Date: 2009-09-01 18:12:04 +0000 (Tue, 01 Sep 2009)
Log Message:
-----------
unixodbc: Postinstall script which helps migrate configuration files to /etc/opt/csw.
Modified Paths:
--------------
csw/mgar/pkg/unixodbc/trunk/Makefile
csw/mgar/pkg/unixodbc/trunk/checksums
Added Paths:
-----------
csw/mgar/pkg/unixodbc/trunk/files/CSWunixodbc.postinstall
Modified: csw/mgar/pkg/unixodbc/trunk/Makefile
===================================================================
--- csw/mgar/pkg/unixodbc/trunk/Makefile 2009-09-01 16:28:18 UTC (rev 6153)
+++ csw/mgar/pkg/unixodbc/trunk/Makefile 2009-09-01 18:12:04 UTC (rev 6154)
@@ -10,33 +10,19 @@
define BLURB
It does stuff with things
endef
-
DL_NAME = unixODBC
-
MASTER_SITES = http://www.unixodbc.org/
DISTFILES = $(DL_NAME)-$(GARVERSION).tar.gz
+DISTFILES += CSWunixodbc.postinstall
WORKSRC = $(WORKDIR)/$(DL_NAME)-$(GARVERSION)
-
-# We define upstream file regex so we can be notifed of new upstream software release
-UFILES_REGEX = $(GARNAME)-(\d+(?:\.\d+)*).tar.gz
-
-SPKG_CLASSES = none cswcpsampleconf
-
+UFILES_REGEX = $(DL_NAME)-(\d+(?:\.\d+)*).tar.gz
REQUIRED_PKGS = CSWiconv
REQUIRED_PKGS += CSWreadline
-REQUIRED_PKGS += CSWcswclassutils
-
sysconfdir = /etc/opt/csw
localstatedir = /var/opt/csw
-
-CONFIGURE_ARGS = $(DIRPATHS) --enable-gui=no
+CONFIGURE_ARGS = $(DIRPATHS) --enable-gui=no
BUILD64 = 1
-
-PROTOTYPE_FILTER = awk ' \
- $$$$3 ~ /\/etc\/opt\/csw\/.*\.CSW$$$$/ { $$$$2 = "cswcpsampleconf" } \
- { print }'
-
-
+SAMPLECONF = /\/etc\/opt\/csw\/.*\.CSW
TEST_SCRIPTS =
post-install-modulated:
@@ -46,5 +32,4 @@
done)
@$(MAKECOOKIE)
-
include gar/category.mk
Modified: csw/mgar/pkg/unixodbc/trunk/checksums
===================================================================
--- csw/mgar/pkg/unixodbc/trunk/checksums 2009-09-01 16:28:18 UTC (rev 6153)
+++ csw/mgar/pkg/unixodbc/trunk/checksums 2009-09-01 18:12:04 UTC (rev 6154)
@@ -1 +1,2 @@
+a3e220ed8b903f2bc8d8ac2654071f9a download/CSWunixodbc.postinstall
f47c2efb28618ecf5f33319140a7acd0 download/unixODBC-2.2.14.tar.gz
Added: csw/mgar/pkg/unixodbc/trunk/files/CSWunixodbc.postinstall
===================================================================
--- csw/mgar/pkg/unixodbc/trunk/files/CSWunixodbc.postinstall (rev 0)
+++ csw/mgar/pkg/unixodbc/trunk/files/CSWunixodbc.postinstall 2009-09-01 18:12:04 UTC (rev 6154)
@@ -0,0 +1,73 @@
+#!/bin/sh
+#
+# $Id$
+#
+# vim:set sw=2 ts=2 sts=2 expandtab:
+#
+# # If old_path exists:
+# # Create a file named {{old_path.THIS_LOCATION_IS_DEPRECATED}} and leave a message inside the file.
+# # If new_path and new_path.CSW files are identical:
+# # Remove new_path (it's only a copy of the .CSW default file, no data loss)
+# # Create a symlink from new_path to old_path
+# # Otherwise:
+# # Create a file named {{old_path.THIS_FILE_IS_PROBABLY_UNUSED}}
+#
+# http://wiki.opencsw.org/configuration-directory-migration
+
+deprecated_info="
+This location (/opt/csw/etc) is deprecated.
+
+Configuration files are currently being placed in /etc/opt/csw. Please make
+sure your new configuration is in /etc/opt/csw and remove the old one from
+/opt/csw/etc.
+"
+deprecated_file_ext="THIS_LOCATION_IS_DEPRECATED"
+
+filepairs="/opt/csw/etc/odbc.ini:/etc/opt/csw/odbc.ini"
+filepairs="${filepairs} /opt/csw/etc/odbcinst.ini:/etc/opt/csw/odbcinst.ini"
+dirpairs="/opt/csw/etc/ODBCDataSources:/etc/opt/csw/ODBCDataSources"
+
+return_code=0
+
+# Generated ../../../ when given a path like /etc/opt/csw/odbc.ini
+gen_dubdots() {
+ echo "$1" \
+ | sed -e 's+[^/]+.+g' \
+ | sed -e 's+\.*$++g' \
+ | tr -s . \
+ | sed -e 's+\.+..+g' \
+ | sed -e 's+^/++'
+}
+
+files_are_identical() {
+ cmp "$1" "$2" > /dev/null
+}
+
+drop_warning() {
+ echo "${deprecated_info}" > "$1.${deprecated_file_ext}"
+}
+
+for ff in ${filepairs} ${dirpairs}; do
+ old_location=`echo ${ff} | awk -F: '{print $1}'`
+ new_location=`echo ${ff} | awk -F: '{print $2}'`
+ abs_old_location="${PKG_INSTSALL_ROOT}${old_location}"
+ abs_new_location="${PKG_INSTSALL_ROOT}${new_location}"
+ old_location_noslash=`echo "${old_location}" | sed -e 's+^/++'`
+ dubdots=`gen_dubdots "${new_location}"`
+ if [ -r "${abs_old_location}" ]; then
+ drop_warning "${abs_old_location}"
+ if [ -r "${abs_new_location}" ]; then
+ if files_are_identical "${abs_new_location}" "${abs_new_location}.CSW"; then
+ rm "${abs_new_location}"
+ ln -s "${dubdots}${old_location_noslash}" "${abs_new_location}"
+ else
+ touch "${abs_old_location}.THIS_FILE_IS_PROBABLY_UNUSED"
+ fi
+ else
+ # The file doesn't exist.
+ ln -s "${dubdots}${old_location_noslash}" "${abs_new_location}"
+ fi
+ fi
+done
+
+exit "${return_code}"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list