added git support to check dependencies

This commit is contained in:
Josh Ashton
2024-02-12 18:13:02 -07:00
parent eed993baa0
commit 3460799623
3 changed files with 19 additions and 11 deletions
Submodule
+1
Submodule calculator added at 8b9116bcd1
+17 -10
View File
@@ -19,22 +19,22 @@ install() {
DISTRO=$(cat /etc/os-release | grep -oP '(?<=^ID=).+' | tr -d '"')
if [[ $DISTRO == "arch" ]]; then
sudo pacman -S $PACKAGE
yes | sudo pacman -S $PACKAGE
exit 0
elif [[ $DISTRO == "archarm" ]]; then
sudo pacman -S $PACKAGE
yes | sudo pacman -S $PACKAGE
exit 0
elif [[ $DISTRO == "ubuntu" ]]; then
sudo apt-get install $PACKAGE
yes | sudo apt-get install $PACKAGE
exit 0
elif [[ $DISTRO == "fedora" ]]; then
sudo dnf install $PACKAGE
yes | sudo dnf install $PACKAGE
exit 0
elif [[ $DISTRO == "centos" ]]; then
sudo yum install $PACKAGE
yes | sudo yum install $PACKAGE
exit 0
elif [[ $DISTRO == "debian" ]]; then
sudo apt install $PACKAGE
yes | sudo apt install $PACKAGE
exit 0
else
error
@@ -45,11 +45,11 @@ install() {
if command -v "brew" &> /dev/null
then
brew install $PACKAGE
yes | brew install $PACKAGE
elif command -v "port" &> /dev/null
then
sudo port install $PACKAGE
yes | sudo port install $PACKAGE
else
echo "Homebrew or MacPorts not found. Please install one of them before running this script."
@@ -77,14 +77,21 @@ COMMAND=$1
PACKAGE=$2
# If the command is git, we will clone the repository and install it
if $COMMAND == "--git"; then
if [[ "$COMMAND" == "--git" ]]; then
USER=$(echo $PACKAGE | cut -d'/' -f1)
REPO=$(echo $PACKAGE | cut -d'/' -f2)
# If the repository is not installed, we will clone it and install it
if ! command -v $REPO &> /dev/null
then
cd /tmp
THIS_USER=$SUDO_USER
if [ ! -d /home/$THIS_USER/build ]; then
echo "Creating build directory for user $THIS_USER..."
su $THIS_USER -c "mkdir /home/$THIS_USER/build"
fi
cd /home/$THIS_USER/build
git clone https://github.com/$USER/$REPO
cd $REPO
inst
+1 -1
View File
@@ -23,7 +23,7 @@ save_desktop_entry() {
sudo echo "Name=$NAME" >> /usr/share/applications/$NAME.desktop
sudo echo "Exec=$EXECUTABLE" >> /usr/share/applications/$NAME.desktop
sudo echo "Type=Application" >> /usr/share/applications/$NAME.desktop
sudo echo "\n# Auto-generated by the install script" >> /usr/share/applications/$NAME.desktop
sudo echo "# Auto-generated by the install script" >> /usr/share/applications/$NAME.desktop
else
echo "This operating system is not yet supported."
exit 1