From 748205494760dc7d8cf09a9370d5eaa3c24d1b49 Mon Sep 17 00:00:00 2001 From: PawsFunctions Date: Tue, 19 Nov 2024 23:33:21 -0500 Subject: [PATCH] Added clone in assemble --- distrobox-assemble | 5 +++++ docs/usage/distrobox-assemble.md | 37 ++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/distrobox-assemble b/distrobox-assemble index 0d64e3ee04..6292d2b3cd 100755 --- a/distrobox-assemble +++ b/distrobox-assemble @@ -46,6 +46,7 @@ entry="" home="" hostname="" image="" +clone="" init="" init_hooks="" nvidia="" @@ -272,6 +273,7 @@ run_distrobox() home="" hostname="" image="" + clone="" init="" init_hooks="" nvidia="" @@ -342,6 +344,9 @@ run_distrobox() if [ -n "${image}" ]; then result_command="${result_command} --image $(sanitize_variable "${image}")" fi + if [ -n "${clone}" ]; then + result_command="${result_command} --clone $(sanitize_variable "${clone}")" + fi if [ -n "${init}" ] && [ "${init}" -eq 1 ]; then result_command="${result_command} --init" fi diff --git a/docs/usage/distrobox-assemble.md b/docs/usage/distrobox-assemble.md index dffba3b66e..9d75475ec4 100644 --- a/docs/usage/distrobox-assemble.md +++ b/docs/usage/distrobox-assemble.md @@ -95,6 +95,10 @@ You can always test what distrobox **would do** by using the `--dry-run` flag. This command will only print what commands distrobox would do without actually running them. +**Clone** + +**Disclaimer**: You need to start the container once to ensure it is fully initialized and created before cloning it. The container being copied must also be stopped before the cloning process can proceed. + **Available options** This is a list of available options with the corresponding type: @@ -120,6 +124,7 @@ declared multiple times to be compounded: | additional_packages | string_list | Additional packages to install inside the container | | home | string | Which home directory should the container use | | image | string | Which image should the container use, look [here](../compatibility.md) for a list | +| clone | string | Name of the Distrobox container to use as the base for a new container (the container must be stopped). | | init_hooks | string_list | Commands to run inside the container, after the packages setup | | pre_init_hooks | string_list | Commands to run inside the container, before the packages setup | | volume | string_list | Additional volumes to mount inside the containers | @@ -168,3 +173,35 @@ each option corresponds to one of the `create` flags. exported_apps="htop" exported_bins="/usr/bin/htop /usr/bin/git" exported_bins_path="~/.local/bin" + +**Clone example** + + [ubuntu] + additional_packages="git vim tmux" + image=ubuntu:latest + init=false + nvidia=false + pull=true + root=false + replace=true + start_now=true + + [deno_ubuntu] + clone=ubuntu + init=false + nvidia=false + pull=true + root=false + replace=true + start_now=true + pre_init_hooks=curl -fsSL https://deno.land/install.sh | sh; + + [bun_ubuntu] + clone=ubuntu + init=false + nvidia=false + pull=true + root=false + replace=true + start_now=true + pre_init_hooks=curl -fsSL https://bun.sh/install | bash;