mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-16 06:45:16 +01:00
chroot-env: add locales, refactor environment
This commit is contained in:
parent
e3ab3df26e
commit
3e395b71da
3 changed files with 16 additions and 9 deletions
|
@ -62,7 +62,7 @@ let
|
|||
chosenGcc
|
||||
bashInteractive coreutils less shadow su
|
||||
gawk diffutils findutils gnused gnugrep
|
||||
gnutar gzip bzip2 xz
|
||||
gnutar gzip bzip2 xz glibcLocales
|
||||
];
|
||||
|
||||
# Compose a global profile for the chroot environment
|
||||
|
@ -72,6 +72,9 @@ let
|
|||
mkdir -p $out/etc
|
||||
cat >> $out/etc/profile << "EOF"
|
||||
export PS1='${name}-chrootenv:\u@\h:\w\$ '
|
||||
export LOCALE_ARCHIVE='/usr/lib${if is64Bit then "64" else ""}/locale/locale-archive'
|
||||
export LD_LIBRARY_PATH=/run/opengl-driver/lib:/run/opengl-driver-32/lib:/lib:/lib32:/lib64
|
||||
export PATH='/bin:/sbin'
|
||||
${profile}
|
||||
EOF
|
||||
'';
|
||||
|
|
|
@ -3,4 +3,10 @@
|
|||
chrootenvDest=/run/chrootenv/@name@
|
||||
|
||||
# Enter the LFS chroot environment
|
||||
sudo chroot --userspec "$USER:${GROUPS[0]}" --groups "${GROUPS[0]}" $chrootenvDest /usr/bin/env -i PS1="$PS1" TERM="$TERM" DISPLAY="$DISPLAY" HOME="$HOME" PATH="/bin:/sbin" XDG_RUNTIME_DIR="$XDG_RUNTIME_DIR" /bin/bash --login
|
||||
sudo chroot --userspec "$USER:${GROUPS[0]}" --groups "${GROUPS[0]}" $chrootenvDest /usr/bin/env -i \
|
||||
TERM="$TERM" \
|
||||
DISPLAY="$DISPLAY" \
|
||||
HOME="$HOME" \
|
||||
XDG_RUNTIME_DIR="$XDG_RUNTIME_DIR" \
|
||||
LANG="$LANG" \
|
||||
/bin/bash --login
|
||||
|
|
|
@ -116,13 +116,11 @@ if $cpid == 0
|
|||
link_swdir.call swdir, Pathname.new('')
|
||||
|
||||
# New environment
|
||||
oldenv = ENV.to_h
|
||||
ENV.replace({ 'PS1' => oldenv['PS1'],
|
||||
'TERM' => oldenv['TERM'],
|
||||
'DISPLAY' => oldenv['DISPLAY'],
|
||||
'HOME' => oldenv['HOME'],
|
||||
'PATH' => '/bin:/sbin',
|
||||
'XDG_RUNTIME_DIR' => oldenv['XDG_RUNTIME_DIR'],
|
||||
ENV.replace({ 'TERM' => ENV['TERM'],
|
||||
'DISPLAY' => ENV['DISPLAY'],
|
||||
'HOME' => ENV['HOME'],
|
||||
'XDG_RUNTIME_DIR' => ENV['XDG_RUNTIME_DIR'],
|
||||
'LANG' => ENV['LANG'],
|
||||
})
|
||||
|
||||
# Finally, exec!
|
||||
|
|
Loading…
Reference in a new issue