[Pkg-erlang-commits] r1724 - in yaws/trunk/debian: . conf

sgolovan at alioth.debian.org sgolovan at alioth.debian.org
Wed Aug 19 08:39:34 UTC 2015


Author: sgolovan
Date: 2015-08-19 08:39:34 +0000 (Wed, 19 Aug 2015)
New Revision: 1724

Modified:
   yaws/trunk/debian/changelog
   yaws/trunk/debian/conf/yaws.conf
   yaws/trunk/debian/yaws.dirs
   yaws/trunk/debian/yaws.postinst
   yaws/trunk/debian/yaws.postrm
   yaws/trunk/debian/yaws.preinst
Log:
[yaws]
  * Fixed moving custom appmods under /usr/local/lib.


Modified: yaws/trunk/debian/changelog
===================================================================
--- yaws/trunk/debian/changelog	2015-08-18 08:10:45 UTC (rev 1723)
+++ yaws/trunk/debian/changelog	2015-08-19 08:39:34 UTC (rev 1724)
@@ -9,9 +9,9 @@
     installs Yaws binaries into /usr/lib/yaws-<version> instead of
     /usr/lib/yaws.
   * Moved the directory for custom Yaws modules from /usr/lib/yaws/custom to
-    /usr/local/lib/yaws.
+    /usr/local/lib/yaws-appmods.
 
- -- Sergei Golovan <sgolovan at debian.org>  Tue, 18 Aug 2015 11:02:13 +0300
+ -- Sergei Golovan <sgolovan at debian.org>  Wed, 19 Aug 2015 10:12:25 +0300
 
 yaws (1.98-5) unstable; urgency=medium
 

Modified: yaws/trunk/debian/conf/yaws.conf
===================================================================
--- yaws/trunk/debian/conf/yaws.conf	2015-08-18 08:10:45 UTC (rev 1723)
+++ yaws/trunk/debian/conf/yaws.conf	2015-08-19 08:39:34 UTC (rev 1724)
@@ -8,18 +8,18 @@
 logdir = /var/log/yaws
 
 
-# These are the paths to directories where additional
+# These are the paths to directories where additional custom
 # beam code can be placed. The daemon will add these
 # directories to its search path.
 
-ebin_dir = /usr/local/lib/yaws/ebin
+ebin_dir = /usr/local/lib/yaws-appmods/ebin
 
 
-# This is a directory where application specific .hrl
+# This is a directory where custom application specific .hrl
 # files can be placed. Application-specific .yaws code can
 # then include these .hrl files.
 
-include_dir = /usr/local/lib/yaws/include
+include_dir = /usr/local/lib/yaws-appmods/include
 
 
 # Set this to an integer value to control

Modified: yaws/trunk/debian/yaws.dirs
===================================================================
--- yaws/trunk/debian/yaws.dirs	2015-08-18 08:10:45 UTC (rev 1723)
+++ yaws/trunk/debian/yaws.dirs	2015-08-19 08:39:34 UTC (rev 1724)
@@ -2,6 +2,6 @@
 etc/yaws/conf.avail
 etc/yaws/conf.d
 usr/bin
-usr/local/lib/yaws/ebin
-usr/local/lib/yaws/include
+usr/local/lib/yaws-appmods/ebin
+usr/local/lib/yaws-appmods/include
 usr/share/yaws

Modified: yaws/trunk/debian/yaws.postinst
===================================================================
--- yaws/trunk/debian/yaws.postinst	2015-08-18 08:10:45 UTC (rev 1723)
+++ yaws/trunk/debian/yaws.postinst	2015-08-19 08:39:34 UTC (rev 1724)
@@ -74,6 +74,37 @@
 	chmod 750 /var/cache/yaws
 
 	install -o yaws -g adm  -m 750 -d /var/log/yaws
+
+	# Finish moving /usr/lib/yaws/custom/* to /usr/local/lib/yaws-appmods/
+	dira=/usr/lib/yaws-custom.dpkg-backup
+	dirb=/usr/local/lib/yaws-appmods
+	if [ -d $dira ] ; then
+	    # If the /usr/lib/yaws/custom.dpkg-backup directory exists then we
+	    # are upgrading from an older version and have to move it to
+	    # /usr/local/lib/yaws-appmods
+
+	    echo "Relocating /usr/lib/yaws/custom into $dirb..."
+
+	    (
+		while read line; do
+		    set -- $line
+		    dir="$1"; mode="$2"; user="$3"; group="$4"
+		    if [ ! -e "$dir" ]; then
+			if mkdir "$dir" 2>/dev/null; then
+			    chown "$user":"$group" "$dir"
+			    chmod "$mode" "$dir"
+			fi
+		    fi
+		done
+	    ) << DATA
+/usr/local/lib 2775 root staff
+/usr/local/lib/yaws-appmods 2775 root staff
+DATA
+	    for f in $(ls -A $dira) ; do
+		mv -f $dira/$f $dirb/
+	    done
+	    rmdir $dira
+	fi
     ;;
 
     abort-upgrade|abort-remove|abort-deconfigure)

Modified: yaws/trunk/debian/yaws.postrm
===================================================================
--- yaws/trunk/debian/yaws.postrm	2015-08-18 08:10:45 UTC (rev 1723)
+++ yaws/trunk/debian/yaws.postrm	2015-08-19 08:39:34 UTC (rev 1724)
@@ -17,7 +17,7 @@
 # for details, see /usr/doc/packaging-manual/
 
 case "$1" in
-    remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    remove|failed-upgrade|disappear)
     ;;
 
     purge)
@@ -48,6 +48,31 @@
 	userdel --force --remove yaws 2>/dev/null || true
     ;;
 
+    upgrade)
+	# Move /usr/local/lib/yaws-appmods back into /usr/lib/yaws/custom if
+	# it's a downgrade
+	if dpkg --compare-versions "$2" lt-nl "1.99" ; then
+	    dir=/usr/local/lib/yaws-appmods
+	    if [ -d $dir ] ; then
+		if [ -d $dir/ebin -a -d $dir/include -a $(find $dir | wc -l) = 3 ] ; then
+		    true
+		else
+		    for f in $(ls -A $dir) ; do
+			mv -f $dir/$f /usr/lib/yaws/custom/
+		    done
+		    rmdir $f
+		fi
+	    fi
+	fi
+    ;;
+
+    abort-install|abort-upgrade)
+	# Abort moving /usr/lib/yaws/custom/* to /usr/local/lib/yaws-appmods/
+	if [ -d /usr/lib/yaws-custom.dpkg-backup ] ; then
+	    mv /usr/lib/yaws-custom.dpkg-backup /usr/lib/yaws/custom
+	fi
+    ;;
+
     *)
         echo "postrm called with unknown argument \`$1'" >&2
         exit 0

Modified: yaws/trunk/debian/yaws.preinst
===================================================================
--- yaws/trunk/debian/yaws.preinst	2015-08-18 08:10:45 UTC (rev 1723)
+++ yaws/trunk/debian/yaws.preinst	2015-08-19 08:39:34 UTC (rev 1724)
@@ -27,6 +27,19 @@
 		fi
 	    fi
 	fi
+	# Prepare to move /usr/lib/yaws/custom/* to /usr/local/lib/yaws-appmods/
+	if dpkg --compare-versions "$2" lt-nl "1.99" ; then
+	    dir=/usr/lib/yaws/custom
+	    if [ -d $dir ] ; then
+		if [ -d $dir/ebin -a -d $dir/include -a $(find $dir | wc -l) = 3 ] ; then
+		    # Don't move /usr/lib/yaws/custom if it has the default structure
+		    # (two empty ebin and include subdirs)
+		    true
+		else
+		    mv -f $dir /usr/lib/yaws-custom.dpkg-backup
+		fi
+	    fi
+	fi
     ;;
 
     abort-upgrade)




More information about the Pkg-erlang-commits mailing list