Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting deb's compression type #272

Closed
zadam opened this issue Oct 25, 2021 · 2 comments · Fixed by #342
Closed

Allow setting deb's compression type #272

zadam opened this issue Oct 25, 2021 · 2 comments · Fixed by #342

Comments

@zadam
Copy link

zadam commented Oct 25, 2021

On Ubuntu 21.10 (and later), the default compression type of deb packages created using dpkg-deb is ZStandard (previously it was XZ).

However, Debian doesn't support installing ZStandard compressed packages:

dpkg -i trilium_0.48.3_amd64.deb 
dpkg-deb: error: archive 'trilium_0.48.3_amd64.deb' uses unknown compression for member 'control.tar.zst', giving up
dpkg: error processing archive trilium_0.48.3_amd64.deb (--install):
 dpkg-deb --control subprocess returned error exit status 2
Errors were encountered while processing:
 trilium_0.48.3_amd64.deb

This means that when you use electron-installer-debian to build packages on Ubuntu 21.10 or later, these packages are unusable in debian.

When using dpkg-deb directly it's possible to change the compression type via -Zxz flag but this is not exposed in electron-installer-debian configuration.

@RouR
Copy link

RouR commented Jul 29, 2023

Please, merge a PR!

Workaround, while we're waiting:

forge.config.js

const { exec } = require('child_process')

function run(cmd) {
  return new Promise((resolve, reject) => {
    exec(cmd, (error, stdout, stderr) => {
      if (error) return reject(error)
      if (stderr) return reject(stderr)
      resolve(stdout)
    })
  })
}

...

hooks: {  
	postMake: async (config, makeResults) => {	 
	  console.log("==postMake", makeResults);
	  let deb = makeResults.filter(x => x.platform === 'linux' && x.artifacts.some(y => y.endsWith('.deb')));
	  console.log("== found ", deb);
	  if (deb.length === 1) {
		  let file = deb[0].artifacts[0];
		  console.warn("will repack file", file);
		  let cmdTemplates = ['ar x some-package.deb', 
				'zstd -d < control.tar.zst | xz > control.tar.xz', 
				'zstd -d < data.tar.zst | xz > data.tar.xz',
				'mv some-package.deb some-package.deb.bkp',
				'ar -v -m -c -a sdsd some-package.deb debian-binary control.tar.xz data.tar.xz',
				'rm debian-binary control.tar.xz data.tar.xz control.tar.zst data.tar.zst'
                 ];
		 for (const cmdT of cmdTemplates) {
			let cmd = cmdT.replaceAll('some-package.deb', file);
			console.log('run', cmd);
			await run(cmd);
		 }
	  }
	  return makeResults;	  
	}
	
  }

@VerteDinde
Copy link
Contributor

This should be available in 3.2.0 and higher 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants