=== modified file 'zsh-functions/confz_containers_init' --- old/zsh-functions/confz_containers_init 2022-06-22 23:37:10 +0000 +++ new/zsh-functions/confz_containers_init 2022-06-22 23:27:44 +0000 @@ -981,33 +981,29 @@ [[ -f $vars[root]/bin/test ]] } +confz_container_nix_unpacked_check() { + checkvars containers_dir root user filename + local download_dir=$vars[containers_dir]/download-cache + + do_command=( + s6-setuidgid $vars[user] + tar -xpC "$vars[root]" -f "$download_dir/$vars[filename]" + ) + + [[ -f $vars[root]/${vars[filename]%.tar.*}/install ]] +} + confz_container_nix_image_installed_check() { - checkvars containers_dir root user filename uid gid checkvars filename image_name svscan_dir root - require fs_r flags=r filename=$vars[root]/${vars[filename]%.tar.*} - - require fs_d filename="$vars[root]/nix" - require fs_m filename="$vars[root]/nix" mode=0755 - require fs_o filename="$vars[root]/nix" owner=$vars[uid]:$vars[gid] - + do_command=( + $commands[cd] $vars[svscan_dir]/container.$vars[image_name].sysroot + container_sysroot_run + /${vars[filename]%.tar.*}/install + ) [[ -d $vars[root]/nix/store ]] } -confz_container_nix_image_installed_do() { - s6-setuidgid $vars[user] \ - tar -xpC "$vars[root]" -f "$download_dir/$vars[filename]" \ - || die "Unpacking ${(qqq)vars[filename]} failed" - - $commands[cd] $vars[svscan_dir]/container.$vars[image_name].sysroot \ - container_sysroot_run \ - /${vars[filename]%.tar.*}/install \ - || die "Nix installation script failed" - - rm -rf $vars[root]/${vars[filename]%.tar.*} \ - || die "Removing tarball directory failed" -} - confz_container_nix_image_check() { checkvars containers_dir image_name url checksum svscan_dir defvar checksum_algo sha256 @@ -1030,8 +1026,9 @@ require container_nix_bootstrap_utils :user :root :uid :gid :svscan_dir \ :image_name arch=x86_64 # TODO: infer correct arch + require container_nix_unpacked :containers_dir :filename :root :user require container_nix_image_installed :filename :root :image_name \ - :svscan_dir :uid :gid + :svscan_dir } confz_container_nix_packages_installed_check() {