I have a shell script that can only be run from a live session (LiveCD or Live USB) because it shrinks the root filesystem of an actual installation, which can only be done when the filesystem is not mounted.
If the script is run from the live session, it should pursue its execution. If not, it should fail.
I cannot find a way to differentiate the live session and a "normal" user session, as the live session has a look-and-feel very close to the installed system sessions. The only thing I can tell so far is that live sessions always have ubuntu
as the hostname, but I cannot rely on that since the user can choose this when installing Ubuntu.
Is there a way of identifying this in a shell script / command line?
(I hesitated between posting on Ask Ubuntu or Stack Overflow, I can delete the post and re-post on Stack Overflow if more appropriate)