Install login scripts and proot only if needed

This commit is contained in:
Tobias Happ 2019-11-28 16:56:16 +01:00 committed by Alexander Sosedkin
parent eb2fcc80f5
commit ed05a33fc0
3 changed files with 43 additions and 36 deletions

View file

@ -50,15 +50,33 @@ in
config = {
build.activation = {
installLoginScripts = ''
$DRY_RUN_CMD mkdir $VERBOSE_ARG --parents /bin /usr/lib
$DRY_RUN_CMD cp $VERBOSE_ARG ${login} /bin/login
$DRY_RUN_CMD cp $VERBOSE_ARG ${loginInner} /usr/lib/login-inner
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
fi
'';
installLoginInner = ''
if (test -e /usr/lib/.login-inner.new && ! diff /usr/lib/.login-inner.new ${loginInner} > /dev/null) || \
(! test -e /usr/lib/.login-inner.new && ! diff /usr/lib/login-inner ${loginInner} > /dev/null); then
$DRY_RUN_CMD mkdir $VERBOSE_ARG --parents /usr/lib
$DRY_RUN_CMD cp $VERBOSE_ARG ${loginInner} /usr/lib/.login-inner.tmp
$DRY_RUN_CMD chmod $VERBOSE_ARG u+w /usr/lib/.login-inner.tmp
$DRY_RUN_CMD mv $VERBOSE_ARG /usr/lib/.login-inner.tmp /usr/lib/.login-inner.new
fi
'';
installProotStatic = ''
$DRY_RUN_CMD mkdir $VERBOSE_ARG --parents /bin
$DRY_RUN_CMD cp $VERBOSE_ARG ${cfg.prootStatic}/bin/proot-static /bin/.proot-static.new
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
fi
'';
};