check for root earlier when not in debug mode #617

Closed
opened 2026-01-19 18:34:43 +00:00 by michael · 4 comments
Owner

Originally created by @SmithersJr on GitHub.

When testing a new label, I test locally in debug mode first. If everything looks good there, I test locally with debug mode off before loading it up in Jamf. If I forget to run as root, I have to wait for the whole download, verification, etc. before the error, ERROR: not running as root, exiting.

It would be helpful to get that error at the beginning of the process, so I don't have to wait another 8 minutes to test. :-/

(And, also, because I'm a goober that can't remember to run it with sudo.) :-P

Originally created by @SmithersJr on GitHub. When testing a new label, I test locally in debug mode first. If everything looks good there, I test locally with debug mode off before loading it up in Jamf. If I forget to run as root, I have to wait for the whole download, verification, etc. before the error, `ERROR: not running as root, exiting`. It would be helpful to get that error at the beginning of the process, so I don't have to wait another 8 minutes to test. :-/ (And, also, because I'm a goober that can't remember to run it with `sudo`.) :-P
michael added the featurehacktoberfest labels 2026-01-19 18:34:43 +00:00
Author
Owner

@samess-flowers commented on GitHub:

Would moving the check forward in the process while adding an additional debug state that does everything but install things resolve this for everyone? DEBUG=0 and DEBUG=1 would work the way they currently do, but a new state DEBUG=2 (which doesn't feel properly idiomatic, but would fit the pattern) could either skip the earlier root check (the easier way to implement) or purposefully terminate where the current root check is even if the program is being run as root (which feels "cleaner" to me).

@samess-flowers commented on GitHub: Would moving the check forward in the process while adding an additional debug state that does everything but install things resolve this for everyone? `DEBUG=0` and `DEBUG=1` would work the way they currently do, but a new state `DEBUG=2` (which doesn't feel properly idiomatic, but would fit the pattern) could either skip the earlier root check (the easier way to implement) or purposefully terminate where the current root check is even if the program is being run as root (which feels "cleaner" to me).
Author
Owner

@Theile commented on GitHub:

I love that the root check is so late, as I do a lot of testing with downloading, when not in DEBUG mode, just by running it without root access.

@Theile commented on GitHub: I love that the root check is so late, as I do a lot of testing with downloading, when not in DEBUG mode, just by running it without root access.
Author
Owner

@Theile commented on GitHub:

I like that I can test a label for download and comparison of version and all, and be certain the thing is not installed. When I have Installomator.sh installed on my own system and just checking a label, it's actually very nice.
Sometimes also for testing a manual label where the variables are sent as part of the script.
I can understand it's annoying to forget to be root if you intended an installation, but at least it didn't get unintentional installed.
I could use DEBUG=1, but the result is not the same.

@Theile commented on GitHub: I like that I can test a label for download and comparison of version and all, and be certain the thing is not installed. When I have Installomator.sh installed on my own system and just checking a label, it's actually very nice. Sometimes also for testing a manual label where the variables are sent as part of the script. I can understand it's annoying to forget to be root if you intended an installation, but at least it didn't get unintentional installed. I could use DEBUG=1, but the result is not the same.
Author
Owner

@acodega commented on GitHub:

I agree with @SmithersJr here, the root check should be one of the first things the script does.

@acodega commented on GitHub: I agree with @SmithersJr here, the root check should be one of the first things the script does.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Installomator/Installomator#617