Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a test for root before copying/extracting files #73

Closed
tasso85 opened this issue Jun 13, 2016 · 6 comments
Closed

Add a test for root before copying/extracting files #73

tasso85 opened this issue Jun 13, 2016 · 6 comments

Comments

@tasso85
Copy link

tasso85 commented Jun 13, 2016

I would like to suggest adding an option to allow to check that the user is "root", either because using "sudo" or actually root, before performing any kind of copying/extracting.

In fact, if the installer requires root privileges, but those are not available, this could save quite some time if the installer is big.

@PhilLehmann
Copy link

I'll second that :-)

@PhilLehmann
Copy link

Here is a piece of code i graciously stole from SO for that use case ;-)

if [ ! $EUID = 0 ]; then
    printf "This script must be run with sudo or as root user.\n\n"
    exit 1
fi

@megastep
Copy link
Owner

This is a good idea and I actually have a use case for this myself. My main worry with the piece of code that @philrykoff posted here is I am not sure that $EUID is a very portable variable we can depend on. Might have to use output from id -u instead.

megastep added a commit that referenced this issue Dec 21, 2016
…ting (bug #73)

Bumping version number to 2.3.0 for next release
@megastep
Copy link
Owner

Just implemented this, let me know how it works for you. I guess I should release a new version soon.

@PhilLehmann
Copy link

Works great - thanks for the extremely short + kind turnaround!

@tasso85
Copy link
Author

tasso85 commented Feb 9, 2017

I've noticed only today that this got implemented, I'll try right away.

I'm happy my advice helped :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants