-
Notifications
You must be signed in to change notification settings - Fork 20
For sudo that requires a password, this PR takes the pw from a file #37
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
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -120,14 +120,14 @@ run_system_prerequisites_check() { | |
| echo "Updating system package lists..." | ||
| if command -v apt &> /dev/null; then | ||
| echo "Updating package lists using apt Ubuntu..." | ||
| if sudo apt update; then | ||
| if sudo -S apt update < "${BECOME_PASSWORD_FILE}"; then | ||
|
||
| echo -e "${GREEN}Package lists updated successfully${NC}" | ||
| else | ||
| echo -e "${YELLOW}Package list update failed, continuing anyway${NC}" | ||
| fi | ||
| elif command -v dnf &> /dev/null; then | ||
| echo "Updating package lists using dnf (RHEL/CentOS)..." | ||
| if sudo dnf check-update || [ $? -eq 100 ]; then | ||
| if sudo -S dnf check-update < "${BECOME_PASSWORD_FILE}" || [ $? -eq 100 ]; then | ||
|
||
| echo -e "${GREEN} Package lists updated successfully${NC}" | ||
| else | ||
| echo -e "${YELLOW} Package list update failed, continuing anyway${NC}" | ||
|
|
@@ -217,10 +217,10 @@ run_system_prerequisites_check() { | |
| if [ ${#other_deps[@]} -gt 0 ]; then | ||
| if command -v dnf &> /dev/null; then | ||
| echo "Installing dependencies using dnf RHEL..." | ||
| sudo dnf install -y "${other_deps[@]}" | ||
| sudo -S dnf install -y "${other_deps[@]}" < "${BECOME_PASSWORD_FILE}" | ||
|
||
| elif command -v apt &> /dev/null; then | ||
| echo "Installing dependencies using apt Ubuntu..." | ||
| sudo apt update && sudo apt install -y "${other_deps[@]}" | ||
| sudo -S apt update < "${BECOME_PASSWORD_FILE}" && sudo -S apt install -y "${other_deps[@]}" < "${BECOME_PASSWORD_FILE}" | ||
|
||
| else | ||
| echo -e "${RED}Unsupported package manager. This script supports RHEL (dnf) and Ubuntu (apt) only.${NC}" | ||
| echo -e "${YELLOW}Please install manually:${NC}" | ||
|
|
@@ -237,26 +237,26 @@ run_system_prerequisites_check() { | |
| python_version=$($python3_interpreter -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')") | ||
| if [[ "$python_version" == "3.11" ]]; then | ||
| echo "Installing python3.11-pip using dnf (RHEL 9)..." | ||
| if ! sudo dnf install -y python3.11-pip; then | ||
| if ! sudo -S dnf install -y python3.11-pip < "${BECOME_PASSWORD_FILE}"; then | ||
|
||
| echo -e "${RED}Failed to install python3.11-pip using dnf${NC}" | ||
| exit 1 | ||
| fi | ||
| elif [[ "$python_version" == "3.12" ]]; then | ||
| echo "Installing python3.12-pip using dnf (RHEL 9)..." | ||
| if ! sudo dnf install -y python3.12-pip; then | ||
| if ! sudo -S dnf install -y python3.12-pip < "${BECOME_PASSWORD_FILE}"; then | ||
|
||
| echo -e "${RED}Failed to install python3.12-pip using dnf${NC}" | ||
| exit 1 | ||
| fi | ||
| else | ||
| echo "Installing python3-pip using dnf (RHEL 9)..." | ||
| if ! sudo dnf install -y python3-pip; then | ||
| if ! sudo -S dnf install -y python3-pip < "${BECOME_PASSWORD_FILE}"; then | ||
|
||
| echo -e "${RED}Failed to install python3-pip using dnf${NC}" | ||
| exit 1 | ||
| fi | ||
| fi | ||
| elif command -v apt &> /dev/null; then | ||
| echo "Installing python3-pip using apt (Ubuntu 22/24)..." | ||
| if ! sudo apt install -y python3-pip; then | ||
| if ! sudo -S apt install -y python3-pip < "${BECOME_PASSWORD_FILE}"; then | ||
|
||
| echo -e "${RED}Failed to install python3-pip using apt${NC}" | ||
| exit 1 | ||
| fi | ||
|
|
@@ -298,4 +298,4 @@ run_system_prerequisites_check() { | |
|
|
||
| echo -e "${GREEN}System prerequisites check completed successfully.${NC}" | ||
| return 0 | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.