WIP: continue going /bin-less

This commit is contained in:
Alexander Sosedkin 2023-03-19 03:29:48 +01:00
parent fdd0de537f
commit 3c50256346
3 changed files with 32 additions and 18 deletions

View file

@ -6,6 +6,7 @@ with lib;
let let
cfg = config.environment; cfg = config.environment;
inherit (config.build) installationDir;
in in
{ {
@ -36,11 +37,13 @@ in
config = { config = {
build.activationBefore = { build.activationBefore = {
#linkBinSh = '' linkBinSh = ''
# $DRY_RUN_CMD mkdir $VERBOSE_ARG --parents /bin $DRY_RUN_CMD mkdir $VERBOSE_ARG --parents ${installationDir}/bin
# $DRY_RUN_CMD ln $VERBOSE_ARG --symbolic --force ${cfg.binSh} /bin/.sh.tmp $DRY_RUN_CMD ln $VERBOSE_ARG --symbolic --force \
# $DRY_RUN_CMD mv $VERBOSE_ARG /bin/.sh.tmp /bin/sh ${cfg.binSh} ${installationDir}/bin/.sh.tmp
#''; $DRY_RUN_CMD mv $VERBOSE_ARG \
${installationDir}/bin/.sh.tmp ${installationDir}/bin/sh
'';
linkUsrBinEnv = '' linkUsrBinEnv = ''
$DRY_RUN_CMD mkdir $VERBOSE_ARG --parents /usr/bin $DRY_RUN_CMD mkdir $VERBOSE_ARG --parents /usr/bin

View file

@ -7,8 +7,9 @@ with lib;
let let
cfg = config.environment.files; cfg = config.environment.files;
login = pkgs.callPackage ./login.nix { inherit config; }; inherit (config.build) installationDir;
login = pkgs.callPackage ./login.nix { inherit config; };
loginInner = pkgs.callPackage ./login-inner.nix { inherit config initialPackageInfo; }; loginInner = pkgs.callPackage ./login-inner.nix { inherit config initialPackageInfo; };
in in
@ -50,11 +51,14 @@ in
build.activation = { build.activation = {
installLogin = '' installLogin = ''
if ! diff /bin/login ${login} > /dev/null; then if ! diff ${installationDir}/bin/login ${login} > /dev/null; then
$DRY_RUN_CMD mkdir $VERBOSE_ARG --parents /bin $DRY_RUN_CMD mkdir $VERBOSE_ARG --parents ${installationDir}/bin
$DRY_RUN_CMD cp $VERBOSE_ARG ${login} /bin/.login.tmp $DRY_RUN_CMD cp $VERBOSE_ARG ${login} \
$DRY_RUN_CMD chmod $VERBOSE_ARG u+w /bin/.login.tmp ${installationDir}/bin/.login.tmp
$DRY_RUN_CMD mv $VERBOSE_ARG /bin/.login.tmp /bin/login $DRY_RUN_CMD chmod $VERBOSE_ARG u+w \
${installationDir}/bin/.login.tmp
$DRY_RUN_CMD mv $VERBOSE_ARG \
${installationDir}/bin/.login.tmp ${installationDir}/bin/login
fi fi
''; '';
@ -69,12 +73,20 @@ in
''; '';
installProotStatic = '' installProotStatic = ''
if (test -e /bin/.proot-static.new && ! diff /bin/.proot-static.new ${cfg.prootStatic}/bin/proot-static > /dev/null) || \ if (test -e ${installationDir}/bin/.proot-static.new && \
(! test -e /bin/.proot-static.new && ! diff /bin/proot-static ${cfg.prootStatic}/bin/proot-static > /dev/null); then ! diff ${installationDir}/bin/.proot-static.new \
$DRY_RUN_CMD mkdir $VERBOSE_ARG --parents /bin ${cfg.prootStatic}/bin/proot-static > /dev/null) || \
$DRY_RUN_CMD cp $VERBOSE_ARG ${cfg.prootStatic}/bin/proot-static /bin/.proot-static.tmp (! test -e ${installationDir}/bin/.proot-static.new && \
$DRY_RUN_CMD chmod $VERBOSE_ARG u+w /bin/.proot-static.tmp ! diff ${installationDir}/bin/proot-static \
$DRY_RUN_CMD mv $VERBOSE_ARG /bin/.proot-static.tmp /bin/.proot-static.new ${cfg.prootStatic}/bin/proot-static > /dev/null); then
$DRY_RUN_CMD mkdir $VERBOSE_ARG --parents ${installationDir}/bin
$DRY_RUN_CMD cp $VERBOSE_ARG ${cfg.prootStatic}/bin/proot-static \
${installationDir}/bin/.proot-static.tmp
$DRY_RUN_CMD chmod $VERBOSE_ARG u+w \
${installationDir}/bin/.proot-static.tmp
$DRY_RUN_CMD mv $VERBOSE_ARG \
${installationDir}/bin/.proot-static.tmp \
${installationDir}/bin/.proot-static.new
fi fi
''; '';
}; };

View file

@ -52,7 +52,6 @@ PROOT_ARGS=(
"-q" "$QEMU" "-q" "$QEMU"
"-w" "$TARGET_HOME" "-w" "$TARGET_HOME"
"-b" "$ENV_DIR/$INSTALLATION_DIR/nix:/nix" "-b" "$ENV_DIR/$INSTALLATION_DIR/nix:/nix"
"-b" "$ENV_DIR/$INSTALLATION_DIR/bin:/bin"
"-b" "$ENV_DIR/$INSTALLATION_DIR/etc:/etc" "-b" "$ENV_DIR/$INSTALLATION_DIR/etc:/etc"
"-b" "$ENV_DIR/$INSTALLATION_DIR/tmp:/tmp" "-b" "$ENV_DIR/$INSTALLATION_DIR/tmp:/tmp"
"-b" "$ENV_DIR/$INSTALLATION_DIR/usr:/usr" "-b" "$ENV_DIR/$INSTALLATION_DIR/usr:/usr"