Skip to content

Instantly share code, notes, and snippets.

@shadowdevnotreal
Created June 5, 2023 18:18
Show Gist options
  • Select an option

  • Save shadowdevnotreal/f2c04e8732e12fcd36e73b4a881e46dd to your computer and use it in GitHub Desktop.

Select an option

Save shadowdevnotreal/f2c04e8732e12fcd36e73b4a881e46dd to your computer and use it in GitHub Desktop.
cryptreq
#!/bin/bash
# Check if apt-get is installed
if command -v apt-get &>/dev/null; then
echo "Using apt-get"
sudo apt-get install zip python-hashlib python3-tk python3-os
else
# Check if dnf is installed
if command -v dnf &>/dev/null; then
echo "Using dnf"
sudo dnf install zip python3-hashlib python3-tkinter python3-os
else
# Check if pacman is installed
if command -v pacman &>/dev/null; then
echo "Using pacman"
sudo pacman -S zip python-hashlib python3-tk python3-os
else
# Check if yum is installed
if command -v yum &>/dev/null; then
echo "Using yum"
sudo yum install zip python-hashlib python3-tkinter python3-os
else
# Check if zypper is installed
if command -v zypper &>/dev/null; then
echo "Using zypper"
sudo zypper install zip python3-hashlib python3-tk python3-os
else
echo "Package manager not found. Please install the prerequisites manually."
exit 1
fi
fi
fi
fi
fi
# Check if all prerequisites are installed
if ! command -v zip &>/dev/null; then
echo "zip is not installed."
exit 1
fi
if ! command -v hashlib &>/dev/null; then
echo "hashlib is not installed."
exit 1
fi
if ! command -v tkinter &>/dev/null; then
echo "tkinter is not installed."
exit 1
fi
if ! command -v os &>/dev/null; then
echo "os is not installed."
exit 1
fi
echo "All prerequisites are installed."
@shadowdevnotreal
Copy link
Copy Markdown
Author

This bash file will first check if the apt-get command is installed. If it is, the bash file will use apt-get to install the prerequisites. If apt-get is not installed, the bash file will check if the dnf, pacman, yum, or zypper command is installed. If one of these commands is installed, the bash file will use that command to install the prerequisites. If none of these commands are installed, the bash file will print a message stating that the prerequisites cannot be installed automatically and the user will need to install them manually.

Once all of the prerequisites are installed, the bash file will print a message stating that all prerequisites are installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment