Skip to content

Commit

Permalink
add funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
Official21A committed Nov 22, 2020
1 parent 8ee6db2 commit 53e9617
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 24 deletions.
25 changes: 25 additions & 0 deletions install/functions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/bash

# this function installs python3
function install_python {
sudo apt-get update
sudo apt-get install python3.6
python3 --version
echo "Python3 is now installed on your system."
}

# this function installs pip3
function install_pip {
sudo apt-get update
sudo apt install python3-pip
pip3 --version
echo "Pip3 is now installed on your system."
}

# this function installs virtualenv
function install_venv {
sudo apt-get update
pip3 install virtualenv
pip3 freeze | grep virtualenv
echo "Virualenv is now installed on your python3."
}
37 changes: 13 additions & 24 deletions install/installer.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,41 +1,30 @@
#!/usr/bin/bash


# this function installs python3
function install_python {
sudo apt-get update
sudo apt-get install python3.6
python3 --version
echo "Python3 is now installed on your system."
}

# this function installs pip3
function install_pip {
sudo apt-get update
sudo apt install python3-pip
pip3 --version
echo "Pip3 is now installed on your system."
}

# this function installs virtualenv
function install_venv {
sudo apt-get update
pip3 install virtualenv
pip3 freeze | grep virtualenv
echo "Virualenv is now installed on your python3."
}
# Load the main functions
source "functions.sh"


# this function checks whats needed for shell script
function check_requirments {
if ! [[ "$(python3 -V)" =~ "Python 3" ]]; then
install_python
else
echo "> Python3 status : OK"
fi
if ! [[ "$(pip3 --version)" =~ "pip 1" ]]; then
install_pip
else
echo "> Pip3 status : OK"
fi
if ! [[ "$(python3 -h venv)" =~ "usage: python3" ]]; then
install_venv
else
echo "> Venv status : OK"
fi
echo "Requirements checked."
}


echo "Running installer ..."
check_requirments
echo "Exit staus : 0"

0 comments on commit 53e9617

Please sign in to comment.