mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-12-16 14:01:10 +01:00
Move /etc/{passwd,group} creation to login-inner
This commit is contained in:
parent
57fc985455
commit
0c0f62f604
2 changed files with 17 additions and 14 deletions
|
|
@ -11,8 +11,8 @@ writeTextDir "usr/lib/login-inner" ''
|
|||
[ "$#" -gt 0 ] || echo "If nothing works, use the rescue shell and read ${instDir}/usr/lib/login-inner"
|
||||
[ "$#" -gt 0 ] || echo "If it does not help, report bugs at https://github.com/t184256/nix-on-droid-bootstrap/issues"
|
||||
|
||||
export USER=nix-on-droid
|
||||
export HOME="/data/data/com.termux.nix/files/home"
|
||||
export USER='nix-on-droid'
|
||||
export HOME='/data/data/com.termux.nix/files/home'
|
||||
|
||||
${
|
||||
if initialBuild
|
||||
|
|
@ -33,6 +33,21 @@ writeTextDir "usr/lib/login-inner" ''
|
|||
echo "Setting up dynamic symlinks via nix-on-droid-linker"
|
||||
nix-on-droid-linker
|
||||
|
||||
[ "$#" -gt 0 ] || echo "Sourcing Nix environment..."
|
||||
. $HOME/.nix-profile/etc/profile.d/nix.sh
|
||||
|
||||
if [ ! -e ${instDir}/etc/passwd ]; then
|
||||
[ -n "$@" ] || echo "Creating /etc/passwd..."
|
||||
echo "root:x:0:0:System administrator:${instDir}/root:/bin/sh" > ${instDir}/etc/passwd
|
||||
echo "$USER:x:$(id -u):$USER:/data/data/com.termux.nix/files/home:/bin/sh" >> ${instDir}/etc/passwd
|
||||
fi
|
||||
|
||||
if [ ! -e ${instDir}/etc/group ]; then
|
||||
[ -n "$@" ] || echo "Creating /etc/group..."
|
||||
echo "root:x:0:" > ${instDir}/etc/group
|
||||
echo "$USER:x:$(id -g):$USER" >> ${instDir}/etc/group
|
||||
fi
|
||||
|
||||
echo
|
||||
echo "Congratulations! Now you have Nix installed with some basic packages like"
|
||||
echo "bashInteractive, coreutils, cacert and some scripts provided by nix-on-droid"
|
||||
|
|
|
|||
|
|
@ -11,18 +11,6 @@ writeScriptBin "login" ''
|
|||
export PROOT_TMP_DIR=${instDir}/tmp
|
||||
export PROOT_L2S_DIR=${instDir}/.l2s
|
||||
|
||||
if [ ! -e ${instDir}/etc/passwd ]; then
|
||||
[ -n "$@" ] || echo "Creating /etc/passwd..."
|
||||
echo "root:x:0:0:System administrator:${instDir}/root:/bin/sh" > ${instDir}/etc/passwd
|
||||
echo "$USER:x:$(/system/bin/stat -c '%u:%g' ${instDir}):$USER:/data/data/com.termux.nix/files/home:/bin/sh" >> ${instDir}/etc/passwd
|
||||
fi
|
||||
|
||||
if [ ! -e ${instDir}/etc/group ]; then
|
||||
[ -n "$@" ] || echo "Creating /etc/group..."
|
||||
echo "root:x:0:" > ${instDir}/etc/group
|
||||
echo "$USER:x:$(/system/bin/stat -c '%g' ${instDir}):$USER" >> ${instDir}/etc/group
|
||||
fi
|
||||
|
||||
exec ${instDir}/bin/proot \
|
||||
-b ${instDir}/nix:/nix \
|
||||
-b ${instDir}/bin:/bin \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue