View previous topic :: View next topic |
Author |
Message |
st834 n00b
Joined: 23 Jun 2022 Posts: 74
|
Posted: Sun May 12, 2024 9:04 am Post subject: arch-chroot and source /etc/profile |
|
|
I found in the documentation https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Base , that commands
Code: | root #mount --types proc /proc /mnt/gentoo/proc
root #mount --rbind /sys /mnt/gentoo/sys
root #mount --make-rslave /mnt/gentoo/sys
root #mount --rbind /dev /mnt/gentoo/dev
root #mount --make-rslave /mnt/gentoo/dev
root #mount --bind /run /mnt/gentoo/run
root #mount --make-slave /mnt/gentoo/run |
can be replaced by calling Code: | arch-chroot /mnt/gentoo | .
Quote: | Tip
If using Gentoo's install media, this step can be replaced with simply: arch-chroot /mnt/gentoo. | .
After call arch-chroot the system enters a new environment, i.e. an additional command
Code: | chroot /mnt/gento /bin/bash | is called.
Question: Does it (arch-chroot) also call source /etc/profile? Unfortunately I could not find any information about this (only short description on https://packages.gentoo.org/packages/sys-apps/arch-chroot : "Wraps the chroot command while ensuring that important filesystems are mounted").
Thanks a lot |
|
Back to top |
|
|
Leonardo.b Guru
Joined: 10 Oct 2020 Posts: 302
|
Posted: Sun May 12, 2024 10:50 am Post subject: |
|
|
Hello st834.
... this is the same thing as ".", but using bash notation.
If you run:
the commands in specified file are read and executed by the current shell.
For example:
Code: | $ VAR=0
$ cat file
VAR=1
$ . file
$ echo $VAR
1
|
It is very useful to write down defaults enviroment variables (like EDITOR), and aliases (like colorful ls in place of ls) in a file, and source it every time.
This is what /etc/profile does.
When you invoke the shell like:
profile files are automatically sourced.
Otherwise you must manually source them.
I didn't read the arch-chroot script, but you can source /etc/profile file again, it shouldn't matter if you do it several times. |
|
Back to top |
|
|
Hu Administrator
Joined: 06 Mar 2007 Posts: 21856
|
Posted: Sun May 12, 2024 3:00 pm Post subject: |
|
|
As I read the script, it starts a shell for you, and does not execute any commands in that shell on your behalf. Therefore, the answer appears to be that it does not source /etc/profile for you. However, it is possible that the dotfiles present in the chroot might cause the shell to do that on its own. As mentioned above, rerunning it is harmless, so if in doubt, source it. |
|
Back to top |
|
|
st834 n00b
Joined: 23 Jun 2022 Posts: 74
|
Posted: Sun May 12, 2024 7:45 pm Post subject: |
|
|
thank you so much for your replies and for your attention to this post. I understand and will upload the profiles manually again. One last question: is there a command to see if a profile is loaded or not?
Thanks |
|
Back to top |
|
|
Leonardo.b Guru
Joined: 10 Oct 2020 Posts: 302
|
Posted: Tue May 14, 2024 5:59 pm Post subject: |
|
|
No, there isn't. There is nothing special in profile file, shell doesn't keep track of them.
You may guess if it's loaded or not from the environment, though.
|
|
Back to top |
|
|
|