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

BASH Installer #9

Open
JustJordanT opened this issue Apr 12, 2023 · 0 comments
Open

BASH Installer #9

JustJordanT opened this issue Apr 12, 2023 · 0 comments

Comments

@JustJordanT
Copy link
Owner

JustJordanT commented Apr 12, 2023

Starting point...

#!/usr/bin/env bash

dirname="foo"

# Create the directory under /usr/local with group ownership set to "admin"
sudo mkdir "/usr/local/$dirname"
sudo chown :admin "/usr/local/$dirname"

# Change the owner of the directory to local user
sudo chown $USER "/usr/local/$dirname"

# Check if the directory was created, group ownership was set, and owner was changed successfully
if [ $? -eq 0 ]; then
  echo "Directory '$dirname' created successfully under /usr/local with group ownership set to 'admin' and owner changed to '$USER'"
else
  echo "Failed to create directory '$dirname', set group ownership to 'admin', or change owner to '$USER'"
fi

In this version of the script, we've used sudo to create the directory "foo" under /usr/local, and then used sudo chown to set the group ownership of the directory to "admin". The rest of the script remains the same, and it will provide feedback on whether the directory was created and group ownership was set successfully or not. Please use caution when using sudo and make sure to understand the implications of running commands with administrative privileges. Additionally, ensure that the "admin" group exists on your system before using it as the group ownership.

@JustJordanT JustJordanT added this to the Initial Functionality milestone Apr 12, 2023
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

1 participant