@@ -5,11 +5,9 @@ import (
5
5
"encoding/json"
6
6
"errors"
7
7
"fmt"
8
- "io"
9
8
"os"
10
9
"os/exec"
11
10
"path/filepath"
12
- "strings"
13
11
"sync"
14
12
"syscall"
15
13
"time"
@@ -34,19 +32,6 @@ const containerSizeToDiskSizeMultiplier = 2
34
32
const diskSizeMinimum = 10 * 1024 * 1024 * 1024 // 10GB
35
33
const imageMetaXattr = "user.bootc.meta"
36
34
37
- // tempLosetupWrapperContents is a workaround for https://github.com/containers/bootc/pull/487/commits/89d34c7dbcb8a1fa161f812c6ba0a8b49ccbe00f
38
- const tempLosetupWrapperContents = `#!/bin/bash
39
- set -euo pipefail
40
- args=(/usr/sbin/losetup --direct-io=off)
41
- for arg in "$@"; do
42
- case $arg in
43
- --direct-io=*) echo "ignoring: $arg" 1>&2;;
44
- *) args+=("$arg") ;;
45
- esac
46
- done
47
- exec "${args[@]}"
48
- `
49
-
50
35
// DiskImageConfig defines configuration for the
51
36
type DiskImageConfig struct {
52
37
Filesystem string
@@ -293,20 +278,7 @@ func (p *BootcDisk) pullImage() error {
293
278
294
279
// runInstallContainer runs the bootc installer in a container to create a disk image
295
280
func (p * BootcDisk ) runInstallContainer (quiet bool , config DiskImageConfig ) error {
296
- // Create a temporary external shell script with the contents of our losetup wrapper
297
- losetupTemp , err := os .CreateTemp (p .Directory , "losetup-wrapper" )
298
- if err != nil {
299
- return fmt .Errorf ("temp losetup wrapper: %w" , err )
300
- }
301
- defer os .Remove (losetupTemp .Name ())
302
- if _ , err := io .Copy (losetupTemp , strings .NewReader (tempLosetupWrapperContents )); err != nil {
303
- return fmt .Errorf ("temp losetup wrapper copy: %w" , err )
304
- }
305
- if err := losetupTemp .Chmod (0o755 ); err != nil {
306
- return fmt .Errorf ("temp losetup wrapper chmod: %w" , err )
307
- }
308
-
309
- c := p .createInstallContainer (config , losetupTemp .Name ())
281
+ c := p .createInstallContainer (config )
310
282
if err := c .Run (); err != nil {
311
283
return fmt .Errorf ("failed to invoke install: %w" , err )
312
284
}
@@ -316,7 +288,7 @@ func (p *BootcDisk) runInstallContainer(quiet bool, config DiskImageConfig) erro
316
288
// createInstallContainer creates a podman command to run the bootc installer.
317
289
// Note: This code used to use the Go bindings for the podman remote client, but the
318
290
// Attach interface currently leaks goroutines.
319
- func (p * BootcDisk ) createInstallContainer (config DiskImageConfig , tempLosetup string ) * exec.Cmd {
291
+ func (p * BootcDisk ) createInstallContainer (config DiskImageConfig ) * exec.Cmd {
320
292
bootcInstallArgs := []string {
321
293
"bootc" , "install" , "to-disk" , "--via-loopback" , "--generic-image" ,
322
294
"--skip-fetch-check" ,
@@ -334,7 +306,7 @@ func (p *BootcDisk) createInstallContainer(config DiskImageConfig, tempLosetup s
334
306
// - add privileged, pid=host, SELinux config and bind mounts per https://containers.github.io/bootc/bootc-install.html
335
307
podmanArgs := []string {"--remote" , "run" , "--rm" , "-i" , "--pid=host" , "--privileged" , "--security-opt=label=type:unconfined_t" , "--volume=/dev:/dev" , "--volume=/var/lib/containers:/var/lib/containers" }
336
308
// Custom bind mounts
337
- podmanArgs = append (podmanArgs , fmt .Sprintf ("--volume=%s:/output" , p .Directory ), fmt . Sprintf ( "--volume=%s:/usr/local/sbin/losetup:ro" , tempLosetup ) )
309
+ podmanArgs = append (podmanArgs , fmt .Sprintf ("--volume=%s:/output" , p .Directory ))
338
310
if term .IsTerminal (int (os .Stdin .Fd ())) {
339
311
podmanArgs = append (podmanArgs , "-t" )
340
312
}
0 commit comments