How can I determine within a shell script if the script is running:
- On a Ubuntu LiveOS (not necessarily version dependant) -- (already answered here)
- Within a chroot on an Ubuntu LiveOS (already addressed here)
- On a locally installed system (no LiveOS) -- (already answered here)
As all three points seem to be addressed elsewhere, I'm going to vote to close this question. Pointed out in the only answer here, a combination of tests can be used to determine chroot on LiveOS.
Consider combining these checks to determine a live sessions:
Look for live file system being mounted somewhere:
If you find something there is a high chance that it's a live session.
Check root file system:
Or look for existence of special files (ex: ubiquity: Ubuntu installer)
also check it's shortcut at ~/Desktop
Check currently logged in users:
users
you should get:ubuntu
.And they can all be set up to look like a live session to trick you ...
For chroot, I'm not sure how it's possible... I'll check it out.