File tree Expand file tree Collapse file tree 3 files changed +73
-2
lines changed Expand file tree Collapse file tree 3 files changed +73
-2
lines changed Original file line number Diff line number Diff line change @@ -256,7 +256,7 @@ func runCommand(container string,
256
256
if entryPoint != "toolbox" {
257
257
var builder strings.Builder
258
258
fmt .Fprintf (& builder , "container %s is too old and no longer supported\n " , container )
259
- fmt .Fprintf (& builder , "Recreate it with Toolbx version 0.0.17 or newer." )
259
+ fmt .Fprintf (& builder , "Recreate it with Toolbx version 0.0.97 or newer." )
260
260
261
261
errMsg := builder .String ()
262
262
return errors .New (errMsg )
@@ -529,6 +529,9 @@ func callFlatpakSessionHelper(container podman.Container) error {
529
529
return nil
530
530
}
531
531
532
+ fmt .Fprintf (os .Stderr , "Warning: container %s uses deprecated features\n " , name )
533
+ fmt .Fprintf (os .Stderr , "Consider recreating it with Toolbox version 0.0.97 or newer.\n " )
534
+
532
535
if _ , err := utils .CallFlatpakSessionHelper (); err != nil {
533
536
return err
534
537
}
Original file line number Diff line number Diff line change @@ -316,6 +316,21 @@ teardown() {
316
316
assert [ ${# stderr_lines[@]} -eq 0 ]
317
317
}
318
318
319
+ @test " run: Ensure that containers using o.fd.Flatpak.SessionHelper are deprecated" {
320
+ local container=" deprecated"
321
+
322
+ create_container_flatpak_session_helper " $container "
323
+
324
+ run --keep-empty-lines --separate-stderr " $TOOLBX " run --container " $container " true
325
+
326
+ assert_success
327
+ assert [ ${# lines[@]} -eq 0 ]
328
+ lines=(" ${stderr_lines[@]} " )
329
+ assert_line --index 0 " Warning: container $container uses deprecated features"
330
+ assert_line --index 1 " Consider recreating it with Toolbox version 0.0.97 or newer."
331
+ assert [ ${# stderr_lines[@]} -eq 2 ]
332
+ }
333
+
319
334
@test " run: Try the non-existent default container with none other present" {
320
335
local default_container_name
321
336
default_container_name=" $( get_system_id) -toolbox-$( get_system_version) "
@@ -860,6 +875,6 @@ teardown() {
860
875
assert [ ${# lines[@]} -eq 0 ]
861
876
lines=(" ${stderr_lines[@]} " )
862
877
assert_line --index 0 " Error: container $container is too old and no longer supported"
863
- assert_line --index 1 " Recreate it with Toolbx version 0.0.17 or newer."
878
+ assert_line --index 1 " Recreate it with Toolbx version 0.0.97 or newer."
864
879
assert [ ${# stderr_lines[@]} -eq 2 ]
865
880
}
Original file line number Diff line number Diff line change @@ -577,3 +577,56 @@ function is_fedora_rawhide() (
577
577
578
578
return 0
579
579
)
580
+
581
+
582
+ # Creates a container with org.freedesktop.Flatpak.SessionHelper D-Bus interface
583
+ #
584
+ # Pulling of an image is taken care of by the function
585
+ #
586
+ # Parameters:
587
+ # ===========
588
+ # - container_name - name of the container
589
+ function create_container_flatpak_session_helper() (
590
+ local container_name=" $1 "
591
+
592
+ local default_image
593
+ default_image=" $( get_default_image) "
594
+
595
+ pull_default_image
596
+
597
+ gdbus call \
598
+ --session \
599
+ --dest org.freedesktop.Flatpak \
600
+ --object-path /org/freedesktop/Flatpak/SessionHelper \
601
+ --method org.freedesktop.Flatpak.SessionHelper.RequestSession
602
+
603
+ podman_cmd=(
604
+ podman create \
605
+ --dns none \
606
+ --env TOOLBOX_PATH=" $TOOLBX " \
607
+ --name " $container_name " \
608
+ --network host \
609
+ --no-hosts \
610
+ --pid host \
611
+ --privileged \
612
+ --userns=keep-id \
613
+ --user root:root \
614
+ --volume " $HOME " :" $HOME " :rslave \
615
+ --volume " $TOOLBX " :/usr/bin/toolbox \
616
+ --volume " $XDG_RUNTIME_DIR " :" $XDG_RUNTIME_DIR " \
617
+ --volume " $XDG_RUNTIME_DIR /.flatpak-helper/monitor" :/run/host/monitor \
618
+ --volume /etc:/run/host/etc \
619
+ --volume /usr:/run/host/usr:rslave \
620
+ " $default_image " \
621
+ toolbox init-container \
622
+ --home " $HOME " \
623
+ --shell " $SHELL " \
624
+ --uid " $( id -ru) " \
625
+ --user " $USER "
626
+ )
627
+
628
+ # Print the full command
629
+ # printf "%q " "${podman_cmd[@]}" >> /tmp/toolbox_podman_command.log
630
+
631
+ " ${podman_cmd[@]} " || fail " Podman couldn't create container '$container_name '"
632
+ )
You can’t perform that action at this time.
0 commit comments