Commit graph

5 commits

Author SHA1 Message Date
Debarshi Ray
0e38e7d0b3 Retain the PS1 across su(1) and sudo(8)
The shell start-up scripts are where the PS1 is meant to be set. So
far, the absence of a toolbox-specific start-up script was being worked
around by setting the PS1 as part of the 'podman exec' invocation. This
came with certain limitations. eg., using su(1) or sudo(8) to get a
root shell can overwrite the PS1 set during 'podman exec' with a value
set by the operating system's existing start-up scripts depending on
which environment variables were being retained.

Now that the toolbox has it's own /etc/profile.d/toolbox.sh start-up
script, it's time to move the PS1 to its rightful home.

Since the start-up script and /run/.toolboxenv are present in older
toolbox containers, this change should be fully backwards compatible
and lead to a more robust PS1 without breaking older containers.

https://github.com/debarshiray/toolbox/pull/148
2019-05-06 12:48:49 +02:00
Debarshi Ray
f864d67baf Create /run/.toolboxenv in 'toolbox enter' for identification
This is better than setting an environment variable like
TOOLBOX_CONTAINER with 'podman create' because, unlike environment
variables, it can't be unset later by commands like su(1) or sudo(8).
One nice side-effect of doing it inside 'toolbox enter' is that it
will automatically work with older toolbox containers.

A subsequent commit will switch to using the /etc/profile.d/toolbox.sh
start-up script to set the PS1 instead of doing it as part of the
'podman exec' invocation. Having the identification mechanism work with
older toolbox containers is important to avoid breaking the PS1 for
backwards compatibility.

This reverts commit c7b7fa1867

https://github.com/debarshiray/toolbox/pull/148
2019-05-06 12:48:18 +02:00
Debarshi Ray
c7b7fa1867 Set TOOLBOX_CONTAINER in the environment to identify as a toolbox
This is a lot more clear and explicit than TOOLBOX_PATH, which is more
of an implementation detail to bind mount the toolbox script inside the
toolbox container.

https://github.com/debarshiray/toolbox/pull/142
2019-04-29 20:39:23 +02:00
Debarshi Ray
abb2ac6fd4 Show a welcome text on interactive shells running inside a toolbox
The welcome text uses the OSC 8 [1] escape sequence to add a hyperlink
to the Silverblue documentation [2].

Silence a SC1003 [3] because the intention is to print the 'ESC \'
string terminator (or ST), and not escape a single quote.

[1] https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
[2] https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/
[3] https://github.com/koalaman/shellcheck/wiki/SC1003

https://github.com/debarshiray/toolbox/pull/130
2019-04-25 16:21:13 +02:00
Debarshi Ray
79f59b667b Show a welcome text on interactive shells running on Silverblue hosts
The welcome text uses the OSC 8 [1] escape sequence to add a hyperlink
to the Silverblue documentation [2].

Silence a SC1003 [3] because the intention is to print the 'ESC \'
string terminator (or ST), and not escape a single quote.

[1] https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda
[2] https://docs.fedoraproject.org/en-US/fedora-silverblue/toolbox/
[3] https://github.com/koalaman/shellcheck/wiki/SC1003

https://github.com/debarshiray/toolbox/pull/127
2019-04-25 15:52:23 +02:00