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

updater.sh/prefsCleaner.sh: Check for root and abort #1651

Merged
merged 5 commits into from Apr 22, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion updater.sh
Expand Up @@ -10,7 +10,7 @@

# Check if running as root and if any files have the owner/group as root/wheel.
if [ "${EUID:-"$(id -u)"}" -eq 0 ]; then
printf 'You should not run this with elevated privileges (such as with doas/sudo).\n'
printf 'You shouldn't run this with elevated privileges (such as with doas/sudo).\n'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be escaped/quoted, otherwise it is a syntax error breaking the script.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
printf 'You shouldn't run this with elevated privileges (such as with doas/sudo).\n'
printf 'You shouldn'"'"'t run this with elevated privileges (such as with doas/sudo).\n'

exit 1
elif [ -n "$(find ./ -user 0 -o -group 0)" ]; then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This find check will cause issues when you want to run the script in another directory (not the current directory) ie option -p

printf 'It looks like this script was previously run with elevated privileges,
Expand Down