Can decompress XZ files
This commit is contained in:
		@@ -284,7 +284,7 @@ impl DiskFileInfo {
 | 
			
		||||
                cmd
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Decompress Raw to not sparse file
 | 
			
		||||
            // Decompress Raw (Gz) to not sparse file
 | 
			
		||||
            (DiskFileFormat::GzCompressedRaw, DiskFileFormat::Raw { is_sparse: false }) => {
 | 
			
		||||
                let mut cmd = Command::new(constants::PROGRAM_GZIP);
 | 
			
		||||
                cmd.arg("--keep")
 | 
			
		||||
@@ -294,13 +294,23 @@ impl DiskFileInfo {
 | 
			
		||||
                    .stdout(File::create(&temp_file)?);
 | 
			
		||||
                cmd
 | 
			
		||||
            }
 | 
			
		||||
            // Decompress Raw (Xz) to not sparse file
 | 
			
		||||
            (DiskFileFormat::XzCompressedRaw, DiskFileFormat::Raw { is_sparse: false }) => {
 | 
			
		||||
                let mut cmd = Command::new(constants::PROGRAM_XZ);
 | 
			
		||||
                cmd.arg("--keep")
 | 
			
		||||
                    .arg("--decompress")
 | 
			
		||||
                    .arg("--to-stdout")
 | 
			
		||||
                    .arg(&self.file_path)
 | 
			
		||||
                    .stdout(File::create(&temp_file)?);
 | 
			
		||||
                cmd
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Decompress Raw to sparse file
 | 
			
		||||
            // Decompress Raw (Gz) to sparse file
 | 
			
		||||
            // https://benou.fr/www/ben/decompressing-sparse-files.html
 | 
			
		||||
            (DiskFileFormat::GzCompressedRaw, DiskFileFormat::Raw { is_sparse: true }) => {
 | 
			
		||||
                let mut cmd = Command::new(constants::PROGRAM_BASH);
 | 
			
		||||
                cmd.arg("-c").arg(format!(
 | 
			
		||||
                    "{} -d -c {} | {} conv=sparse of={}",
 | 
			
		||||
                    "{} --decompress --to-stdout {} | {} conv=sparse of={}",
 | 
			
		||||
                    constants::PROGRAM_GZIP,
 | 
			
		||||
                    self.file_path.display(),
 | 
			
		||||
                    constants::PROGRAM_DD,
 | 
			
		||||
@@ -309,6 +319,20 @@ impl DiskFileInfo {
 | 
			
		||||
                cmd
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Decompress Raw (XZ) to sparse file
 | 
			
		||||
            // https://benou.fr/www/ben/decompressing-sparse-files.html
 | 
			
		||||
            (DiskFileFormat::XzCompressedRaw, DiskFileFormat::Raw { is_sparse: true }) => {
 | 
			
		||||
                let mut cmd = Command::new(constants::PROGRAM_BASH);
 | 
			
		||||
                cmd.arg("-c").arg(format!(
 | 
			
		||||
                    "{} --decompress --to-stdout {} | {} conv=sparse of={}",
 | 
			
		||||
                    constants::PROGRAM_XZ,
 | 
			
		||||
                    self.file_path.display(),
 | 
			
		||||
                    constants::PROGRAM_DD,
 | 
			
		||||
                    temp_file.display()
 | 
			
		||||
                ));
 | 
			
		||||
                cmd
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            // Dumb copy of file
 | 
			
		||||
            (a, b) if a == b => {
 | 
			
		||||
                let mut cmd = Command::new(constants::PROGRAM_COPY);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user