diff -uNr dkms-2.0.19/dkms dkms-2.0.19/dkms
--- dkms-2.0.19/dkms	2017-11-12 10:53:11.236206405 +0000
+++ dkms-2.0.19/dkms	2017-11-12 13:23:51.355974294 +0000
@@ -99,6 +99,11 @@ function set_module_suffix ()
     if [ -n "$gz_modules" ]; then
 	[ -z "$delayed_gzip" ] && module_suffix=${module_suffix}.gz
     fi
+    xz_modules=""
+	grep -q '\.xz:' /lib/modules/$kernel_test/modules.dep 2>/dev/null && xz_modules=1
+	if [ -n "$xz_modules" ]; then
+	[ -z "$delayed_xz" ] && module_suffix=${module_suffix}.xz
+    fi
 }
 
 function set_kernel_source_dir ()
@@ -1437,6 +1442,9 @@ function do_build()
 	if [ -n "$gz_modules" ]; then
 	    gzip -9f $dkms_tree/$module/$module_version/${kernelver_array[0]}/${arch_array[0]}/module/${dest_module_name[$count]}$module_suffix
 	fi
+	if [ -n "$xz_modules" ]; then
+	    xz -f $dkms_tree/$module/$module_version/${kernelver_array[0]}/${arch_array[0]}/module/${dest_module_name[$count]}$module_suffix
+	fi	
 	count=$(($count+1))
     done
     if [ -n "$gz_modules" ]; then
@@ -2659,7 +2667,10 @@ load_tarball()
     if `bzip2 -t $archive_location 2>/dev/null`; then
 	tar_options="${tar_options}j"
     fi
-
+    if `xz -t $archive_location 2>/dev/null`; then
+	tar_options="${tar_options}J"
+    fi
+    
     # Untar it into $tmp_location
     local temp_dir_name=`mktemp -d $tmp_location/dkms.XXXXXX`
     tar -${tar_options}xf $archive_location -C $temp_dir_name
@@ -3557,8 +3568,7 @@ for action_to_run in $action; do
 	    remove_module
 	    ;;
 	build)
-	    delayed_gzip=1
-	    build_module
+	    delayed_xz=1 && delayed_gzip=1 && build_module
 	    ;;
 	install)
             # Make sure they're root
