fix uid mapping in squashfs's made from tarballs (#2710)

This commit is contained in:
Aiden McClelland
2024-08-16 13:40:10 -06:00
committed by GitHub
parent f692ebbbb9
commit 6a8d8babce
2 changed files with 14 additions and 7 deletions

View File

@@ -47,6 +47,7 @@ smartmontools
socat socat
sqlite3 sqlite3
squashfs-tools squashfs-tools
squashfs-tools-ng
sudo sudo
systemd systemd
systemd-resolved systemd-resolved

View File

@@ -60,14 +60,20 @@ impl SqfsDir {
.get_or_try_init(|| async move { .get_or_try_init(|| async move {
let guid = Guid::new(); let guid = Guid::new();
let path = self.tmpdir.join(guid.as_ref()).with_extension("squashfs"); let path = self.tmpdir.join(guid.as_ref()).with_extension("squashfs");
let mut cmd = Command::new("mksquashfs");
if self.path.extension().and_then(|s| s.to_str()) == Some("tar") { if self.path.extension().and_then(|s| s.to_str()) == Some("tar") {
cmd.arg("-tar"); Command::new("tar2sqfs")
.arg(&path)
.input(Some(&mut open_file(&self.path).await?))
.invoke(ErrorKind::Filesystem)
.await?;
} else {
Command::new("mksquashfs")
.arg(&self.path)
.arg(&path)
.invoke(ErrorKind::Filesystem)
.await?;
} }
cmd.arg(&self.path)
.arg(&path)
.invoke(ErrorKind::Filesystem)
.await?;
Ok(MultiCursorFile::from( Ok(MultiCursorFile::from(
open_file(&path) open_file(&path)
.await .await
@@ -507,7 +513,7 @@ impl ImageSource {
Command::new(CONTAINER_TOOL) Command::new(CONTAINER_TOOL)
.arg("export") .arg("export")
.arg(container.trim()) .arg(container.trim())
.pipe(Command::new("mksquashfs").arg("-").arg(&dest).arg("-tar")) .pipe(Command::new("tar2sqfs").arg(&dest))
.capture(false) .capture(false)
.invoke(ErrorKind::Docker) .invoke(ErrorKind::Docker)
.await?; .await?;