feat: New compression logic
This commit is contained in:
		@@ -28,7 +28,6 @@ handler::tar() {
 | 
				
			|||||||
    local dst_path
 | 
					    local dst_path
 | 
				
			||||||
    local opts
 | 
					    local opts
 | 
				
			||||||
    local archive
 | 
					    local archive
 | 
				
			||||||
    local compr
 | 
					 | 
				
			||||||
    local exclude
 | 
					    local exclude
 | 
				
			||||||
    local file_ext
 | 
					    local file_ext
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -68,17 +67,11 @@ handler::tar() {
 | 
				
			|||||||
        exclude=
 | 
					        exclude=
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Overwrite __compression
 | 
					 | 
				
			||||||
    if [ "$compression" ]; then
 | 
					 | 
				
			||||||
        compr="$compression"
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
        compr="$__compression"
 | 
					 | 
				
			||||||
    fi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    # Select filename extension by compression type.
 | 
					    # Select filename extension by compression type.
 | 
				
			||||||
 | 
					    if [ "$compression" ]; then
 | 
				
			||||||
        # Make sure for the `--auto-compress` is enabled in __tar_options
 | 
					        # Make sure for the `--auto-compress` is enabled in __tar_options
 | 
				
			||||||
        # Refference: https://www.gnu.org/software/tar/manual/html_node/gzip.html
 | 
					        # Refference: https://www.gnu.org/software/tar/manual/html_node/gzip.html
 | 
				
			||||||
    case "$compr" in
 | 
					        case "$compression" in
 | 
				
			||||||
            gzip|gz)    file_ext='.tar.gz';;    # gzip
 | 
					            gzip|gz)    file_ext='.tar.gz';;    # gzip
 | 
				
			||||||
            tgz)        file_ext='.tgz';;       # gzip
 | 
					            tgz)        file_ext='.tgz';;       # gzip
 | 
				
			||||||
            taz)        file_ext='.taz';;       # gzip
 | 
					            taz)        file_ext='.taz';;       # gzip
 | 
				
			||||||
@@ -95,8 +88,11 @@ handler::tar() {
 | 
				
			|||||||
            xz)         file_ext='.tar.xz';;    # xz
 | 
					            xz)         file_ext='.tar.xz';;    # xz
 | 
				
			||||||
            zstd|zst)   file_ext='.tar.zst';;   # zstd
 | 
					            zstd|zst)   file_ext='.tar.zst';;   # zstd
 | 
				
			||||||
            tzst)       file_ext='.tzst';;      # zstd
 | 
					            tzst)       file_ext='.tzst';;      # zstd
 | 
				
			||||||
        *)          file_ext='.tar.gz';;    # Force gzip
 | 
					            *)          file_ext='.tar';;       # No compression
 | 
				
			||||||
        esac
 | 
					        esac
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        file_ext='.tar'
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    archive="${dst_path}/$(gen_backup_name "$file_ext")"
 | 
					    archive="${dst_path}/$(gen_backup_name "$file_ext")"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user