[Lunar-commits] <moonbase> xz: unpack plugin

Zbigniew Luszpinski zbiggy at lunar-linux.org
Fri Oct 9 04:33:29 CEST 2009


commit 9ef6e3d3c94bffa9fca81891445c36c29a90fb1a
Author: Zbigniew Luszpinski <zbiggy at lunar-linux.org>
Date:   Fri Oct 9 04:33:29 2009 +0200

    xz: unpack plugin
---
 archive/xz/DETAILS                   |    6 +-
 archive/xz/plugin.d/unpack-xz.plugin |   70 ++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 3 deletions(-)

diff --git a/archive/xz/DETAILS b/archive/xz/DETAILS
index 75720c3..122259c 100644
--- a/archive/xz/DETAILS
+++ b/archive/xz/DETAILS
@@ -1,11 +1,11 @@
          MODULE=xz
         VERSION=4.999.9beta
-         SOURCE=$MODULE-$VERSION.tar.gz
+         SOURCE=$MODULE-$VERSION.tar.bz2
    SOURCE_URL[0]=http://tukaani.org/xz/
-      SOURCE_VFY=sha1:9627de3997ddcdb02f8d327e84b2cf1941ecd230
+      SOURCE_VFY=sha1:67cd2598b5149da9b3c126f3483fd632e06b3d48
         WEB_SITE=http://tukaani.org/xz/
          ENTERED=20090224
-         UPDATED=20090902
+         UPDATED=20091009
            SHORT="Utils for XZ archive format"
 cat << EOF
 XZ Utils (new name for the improved format/tools) is the successor to lzma.
diff --git a/archive/xz/plugin.d/unpack-xz.plugin b/archive/xz/plugin.d/unpack-xz.plugin
new file mode 100644
index 0000000..2b0aab2
--- /dev/null
+++ b/archive/xz/plugin.d/unpack-xz.plugin
@@ -0,0 +1,70 @@
+#!/bin/bash
+####################################################################
+#                                                                  #
+# unpack-xz.plugin - generic plugin that unpacks:                  #
+# tar.xz, tar.lzma, xz and lzma files                              #
+#                                                                  #
+####################################################################
+#                                                                  #
+# Copyright 2009 by Zbigniew Luszpinski zbiggy(a)o2,pl under GPLv2 #
+#                                                                  #
+# Parts of code of this plugin are "borrowed" from                 #
+# unpack-*.plugin by Auke Kok                                      #
+####################################################################
+
+
+plugin_unpack_xz() {
+  case $1 in
+    *.tar.xz)
+      if [ ! -x /bin/tar ]; then
+        message "${PROBLEM_COLOR}! Cannot unpack tar.xz file without ${MODULE_COLOR}tar${DEFAULT_COLOR}${PROBLEM_COLOR} installed${DEFAULT_COLOR}";
+        exit 1
+      fi
+      if [ ! -x /usr/bin/xz ]; then
+        message "${PROBLEM_COLOR}! Cannot unpack tar.xz file without ${MODULE_COLOR}xz${DEFAULT_COLOR}${PROBLEM_COLOR} installed${DEFAULT_COLOR}";
+        exit 1
+      fi
+      debug_msg "Unpacking xz file \"$1\""
+      tar Jxf $1 --no-same-owner --no-same-permissions || return 1
+      ;;
+    *.tar.lzma)
+      if [ ! -x /bin/tar ]; then
+        message "${PROBLEM_COLOR}! Cannot unpack tar.lzma file without ${MODULE_COLOR}tar${DEFAULT_COLOR}${PROBLEM_COLOR} installed${DEFAULT_COLOR}";
+        exit 1
+      fi
+      if [ ! -x /usr/bin/xz ]; then
+        message "${PROBLEM_COLOR}! Cannot unpack tar.lzma file without ${MODULE_COLOR}xz${DEFAULT_COLOR}${PROBLEM_COLOR} installed${DEFAULT_COLOR}";
+        exit 1
+      fi
+      debug_msg "Unpacking xz file \"$1\""
+      tar Jxf $1 --no-same-owner --no-same-permissions || return 1
+      ;;
+    *.xz)
+      if [ ! -x /usr/bin/xz ]; then
+        message "${PROBLEM_COLOR}! Cannot unpack xz file without ${MODULE_COLOR}xz${DEFAULT_COLOR}${PROBLEM_COLOR} installed${DEFAULT_COLOR}";
+        exit 1
+      fi
+      debug_msg "Unpacking xz file \"$1\""
+      cp $1 . || return 1
+      xz $1   || return 1
+      ;;
+    *.lzma)
+      if [ ! -x /usr/bin/xz ]; then
+        message "${PROBLEM_COLOR}! Cannot unpack lzma file without ${MODULE_COLOR}xz${DEFAULT_COLOR}${PROBLEM_COLOR} installed${DEFAULT_COLOR}";
+        exit 1
+      fi
+      debug_msg "Unpacking xz file \"$1\""
+      cp $1 . || return 1
+      xz $1   || return 1
+      ;;
+    *)
+      # fallback: we don't know what to do!
+      return 2
+      ;;
+  esac
+  # return success!
+  return 0
+}
+
+
+plugin_register SOURCE_UNPACK plugin_unpack_xz


More information about the Lunar-commits mailing list