Skip to content

Commit

Permalink
WIP: continue going /bin-less
Browse files Browse the repository at this point in the history
  • Loading branch information
t184256 committed Mar 19, 2023
1 parent fdd0de5 commit 3c50256
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 18 deletions.
13 changes: 8 additions & 5 deletions modules/environment/links.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ with lib;

let
cfg = config.environment;
inherit (config.build) installationDir;
in

{
Expand Down Expand Up @@ -36,11 +37,13 @@ in
config = {

build.activationBefore = {
#linkBinSh = ''
# $DRY_RUN_CMD mkdir $VERBOSE_ARG --parents /bin
# $DRY_RUN_CMD ln $VERBOSE_ARG --symbolic --force ${cfg.binSh} /bin/.sh.tmp
# $DRY_RUN_CMD mv $VERBOSE_ARG /bin/.sh.tmp /bin/sh
#'';
linkBinSh = ''
$DRY_RUN_CMD mkdir $VERBOSE_ARG --parents ${installationDir}/bin
$DRY_RUN_CMD ln $VERBOSE_ARG --symbolic --force \
${cfg.binSh} ${installationDir}/bin/.sh.tmp
$DRY_RUN_CMD mv $VERBOSE_ARG \
${installationDir}/bin/.sh.tmp ${installationDir}/bin/sh
'';

linkUsrBinEnv = ''
$DRY_RUN_CMD mkdir $VERBOSE_ARG --parents /usr/bin
Expand Down
36 changes: 24 additions & 12 deletions modules/environment/login/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ with lib;
let
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; };
in

Expand Down Expand Up @@ -50,11 +51,14 @@ in

build.activation = {
installLogin = ''
if ! diff /bin/login ${login} > /dev/null; then
$DRY_RUN_CMD mkdir $VERBOSE_ARG --parents /bin
$DRY_RUN_CMD cp $VERBOSE_ARG ${login} /bin/.login.tmp
$DRY_RUN_CMD chmod $VERBOSE_ARG u+w /bin/.login.tmp
$DRY_RUN_CMD mv $VERBOSE_ARG /bin/.login.tmp /bin/login
if ! diff ${installationDir}/bin/login ${login} > /dev/null; then
$DRY_RUN_CMD mkdir $VERBOSE_ARG --parents ${installationDir}/bin
$DRY_RUN_CMD cp $VERBOSE_ARG ${login} \
${installationDir}/bin/.login.tmp
$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
'';

Expand All @@ -69,12 +73,20 @@ in
'';

installProotStatic = ''
if (test -e /bin/.proot-static.new && ! diff /bin/.proot-static.new ${cfg.prootStatic}/bin/proot-static > /dev/null) || \
(! test -e /bin/.proot-static.new && ! diff /bin/proot-static ${cfg.prootStatic}/bin/proot-static > /dev/null); then
$DRY_RUN_CMD mkdir $VERBOSE_ARG --parents /bin
$DRY_RUN_CMD cp $VERBOSE_ARG ${cfg.prootStatic}/bin/proot-static /bin/.proot-static.tmp
$DRY_RUN_CMD chmod $VERBOSE_ARG u+w /bin/.proot-static.tmp
$DRY_RUN_CMD mv $VERBOSE_ARG /bin/.proot-static.tmp /bin/.proot-static.new
if (test -e ${installationDir}/bin/.proot-static.new && \
! diff ${installationDir}/bin/.proot-static.new \
${cfg.prootStatic}/bin/proot-static > /dev/null) || \
(! test -e ${installationDir}/bin/.proot-static.new && \
! diff ${installationDir}/bin/proot-static \
${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
'';
};
Expand Down
1 change: 0 additions & 1 deletion tests/fakedroid.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ PROOT_ARGS=(
"-q" "$QEMU"
"-w" "$TARGET_HOME"
"-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/tmp:/tmp"
"-b" "$ENV_DIR/$INSTALLATION_DIR/usr:/usr"
Expand Down

0 comments on commit 3c50256

Please sign in to comment.