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

Display useful message when Linux post-install script has insufficient permissions #893

Merged
merged 1 commit into from
Jun 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions post_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,19 @@ SUBSYSTEMS=="usb", ATTRS{idVendor}=="0525", MODE:="0666"
EOF
}

if [ "$EUID" -ne 0 ]
then echo "Please run as root"
if [ "$EUID" -ne 0 ]; then
if [ -e "${PWD}/post_install.sh" ]; then
echo
echo "You might need to configure permissions for uploading."
echo "To do so, run the following command from the terminal:"
echo "sudo \"${PWD}/post_install.sh\""
echo
else
# Script was executed from another path. It is assumed this will only occur when user is executing script directly.
# So it is not necessary to provide the command line.
echo "Please run as root"
fi

exit
fi

Expand Down