aboutsummaryrefslogtreecommitdiffstats
path: root/utility
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-01-19 15:57:06 +0000
committerMatthew Lemon <lemon@matthewlemon.com>2020-01-19 15:57:06 +0000
commit9d76a3c52b8310726ec09e0262813f0438c21df6 (patch)
tree4acf47dce6c3aa75f8ad7c5cb56fe6486c2d64a7 /utility
init commit - from cookiecutter
Diffstat (limited to 'utility')
-rwxr-xr-xutility/install_os_dependencies.sh96
-rwxr-xr-xutility/install_python_dependencies.sh39
-rw-r--r--utility/requirements-bionic.apt23
-rw-r--r--utility/requirements-buster.apt23
-rw-r--r--utility/requirements-jessie.apt23
-rw-r--r--utility/requirements-stretch.apt23
-rw-r--r--utility/requirements-trusty.apt23
-rw-r--r--utility/requirements-xenial.apt23
8 files changed, 273 insertions, 0 deletions
diff --git a/utility/install_os_dependencies.sh b/utility/install_os_dependencies.sh
new file mode 100755
index 0000000..ec9372f
--- /dev/null
+++ b/utility/install_os_dependencies.sh
@@ -0,0 +1,96 @@
+#!/bin/bash
+
+WORK_DIR="$(dirname "$0")"
+DISTRO_NAME=$(lsb_release -sc)
+OS_REQUIREMENTS_FILENAME="requirements-$DISTRO_NAME.apt"
+
+cd $WORK_DIR
+
+# Check if a requirements file exist for the current distribution.
+if [ ! -r "$OS_REQUIREMENTS_FILENAME" ]; then
+ cat <<-EOF >&2
+ There is no requirements file for your distribution.
+ You can see one of the files listed below to help search the equivalent package in your system:
+ $(find ./ -name "requirements-*.apt" -printf " - %f\n")
+ EOF
+ exit 1;
+fi
+
+# Handle call with wrong command
+function wrong_command()
+{
+ echo "${0##*/} - unknown command: '${1}'" >&2
+ usage_message
+}
+
+# Print help / script usage
+function usage_message()
+{
+ cat <<-EOF
+ Usage: $WORK_DIR/${0##*/} <command>
+ Available commands are:
+ list Print a list of all packages defined on ${OS_REQUIREMENTS_FILENAME} file
+ help Print this help
+
+ Commands that require superuser permission:
+ install Install packages defined on ${OS_REQUIREMENTS_FILENAME} file. Note: This
+ does not upgrade the packages already installed for new versions, even if
+ new version is available in the repository.
+ upgrade Same that install, but upgrade the already installed packages, if new
+ version is available.
+ EOF
+}
+
+# Read the requirements.apt file, and remove comments and blank lines
+function list_packages(){
+ grep -v "#" "${OS_REQUIREMENTS_FILENAME}" | grep -v "^$";
+}
+
+function install_packages()
+{
+ list_packages | xargs apt-get --no-upgrade install -y;
+}
+
+function upgrade_packages()
+{
+ list_packages | xargs apt-get install -y;
+}
+
+function install_or_upgrade()
+{
+ P=${1}
+ PARAN=${P:-"install"}
+
+ if [[ $EUID -ne 0 ]]; then
+ cat <<-EOF >&2
+ You must run this script with root privilege
+ Please do:
+ sudo $WORK_DIR/${0##*/} $PARAN
+ EOF
+ exit 1
+ else
+
+ apt-get update
+
+ # Install the basic compilation dependencies and other required libraries of this project
+ if [ "$PARAN" == "install" ]; then
+ install_packages;
+ else
+ upgrade_packages;
+ fi
+
+ # cleaning downloaded packages from apt-get cache
+ apt-get clean
+
+ exit 0
+ fi
+}
+
+# Handle command argument
+case "$1" in
+ install) install_or_upgrade;;
+ upgrade) install_or_upgrade "upgrade";;
+ list) list_packages;;
+ help|"") usage_message;;
+ *) wrong_command "$1";;
+esac
diff --git a/utility/install_python_dependencies.sh b/utility/install_python_dependencies.sh
new file mode 100755
index 0000000..bdc181a
--- /dev/null
+++ b/utility/install_python_dependencies.sh
@@ -0,0 +1,39 @@
+#!/bin/bash
+
+WORK_DIR="$(dirname "$0")"
+PROJECT_DIR="$(dirname "$WORK_DIR")"
+
+pip --version >/dev/null 2>&1 || {
+ echo >&2 -e "\npip is required but it's not installed."
+ echo >&2 -e "You can install it by running the following command:\n"
+ echo >&2 "wget https://bootstrap.pypa.io/get-pip.py --output-document=get-pip.py; chmod +x get-pip.py; sudo -H python3 get-pip.py"
+ echo >&2 -e "\n"
+ echo >&2 -e "\nFor more information, see pip documentation: https://pip.pypa.io/en/latest/"
+ exit 1;
+}
+
+virtualenv --version >/dev/null 2>&1 || {
+ echo >&2 -e "\nvirtualenv is required but it's not installed."
+ echo >&2 -e "You can install it by running the following command:\n"
+ echo >&2 "sudo -H pip3 install virtualenv"
+ echo >&2 -e "\n"
+ echo >&2 -e "\nFor more information, see virtualenv documentation: https://virtualenv.pypa.io/en/latest/"
+ exit 1;
+}
+
+if [ -z "$VIRTUAL_ENV" ]; then
+ echo >&2 -e "\nYou need activate a virtualenv first"
+ echo >&2 -e 'If you do not have a virtualenv created, run the following command to create and automatically activate a new virtualenv named "venv" on current folder:\n'
+ echo >&2 -e "virtualenv venv --python=\`which python3\`"
+ echo >&2 -e "\nTo leave/disable the currently active virtualenv, run the following command:\n"
+ echo >&2 "deactivate"
+ echo >&2 -e "\nTo activate the virtualenv again, run the following command:\n"
+ echo >&2 "source venv/bin/activate"
+ echo >&2 -e "\nFor more information, see virtualenv documentation: https://virtualenv.pypa.io/en/latest/"
+ echo >&2 -e "\n"
+ exit 1;
+else
+
+ pip install -r $PROJECT_DIR/requirements/local.txt
+
+fi
diff --git a/utility/requirements-bionic.apt b/utility/requirements-bionic.apt
new file mode 100644
index 0000000..1ca82b2
--- /dev/null
+++ b/utility/requirements-bionic.apt
@@ -0,0 +1,23 @@
+##basic build dependencies of various Django apps for Ubuntu Bionic 18.04
+#build-essential metapackage install: make, gcc, g++,
+build-essential
+#required to translate
+gettext
+python3-dev
+
+##shared dependencies of:
+##Pillow, pylibmc
+zlib1g-dev
+
+##Postgresql and psycopg2 dependencies
+libpq-dev
+
+##Pillow dependencies
+libtiff5-dev
+libjpeg8-dev
+libfreetype6-dev
+liblcms2-dev
+libwebp-dev
+
+##django-extensions
+libgraphviz-dev
diff --git a/utility/requirements-buster.apt b/utility/requirements-buster.apt
new file mode 100644
index 0000000..75957f4
--- /dev/null
+++ b/utility/requirements-buster.apt
@@ -0,0 +1,23 @@
+##basic build dependencies of various Django apps for Debian Jessie 10.x
+#build-essential metapackage install: make, gcc, g++,
+build-essential
+#required to translate
+gettext
+python3-dev
+
+##shared dependencies of:
+##Pillow, pylibmc
+zlib1g-dev
+
+##Postgresql and psycopg2 dependencies
+libpq-dev
+
+##Pillow dependencies
+libtiff5-dev
+libjpeg62-turbo-dev
+libfreetype6-dev
+liblcms2-dev
+libwebp-dev
+
+##django-extensions
+libgraphviz-dev
diff --git a/utility/requirements-jessie.apt b/utility/requirements-jessie.apt
new file mode 100644
index 0000000..5c49365
--- /dev/null
+++ b/utility/requirements-jessie.apt
@@ -0,0 +1,23 @@
+##basic build dependencies of various Django apps for Debian Jessie 8.x
+#build-essential metapackage install: make, gcc, g++,
+build-essential
+#required to translate
+gettext
+python3-dev
+
+##shared dependencies of:
+##Pillow, pylibmc
+zlib1g-dev
+
+##Postgresql and psycopg2 dependencies
+libpq-dev
+
+##Pillow dependencies
+libtiff5-dev
+libjpeg62-turbo-dev
+libfreetype6-dev
+liblcms2-dev
+libwebp-dev
+
+##django-extensions
+graphviz-dev
diff --git a/utility/requirements-stretch.apt b/utility/requirements-stretch.apt
new file mode 100644
index 0000000..a2b3a7e
--- /dev/null
+++ b/utility/requirements-stretch.apt
@@ -0,0 +1,23 @@
+##basic build dependencies of various Django apps for Debian Jessie 9.x
+#build-essential metapackage install: make, gcc, g++,
+build-essential
+#required to translate
+gettext
+python3-dev
+
+##shared dependencies of:
+##Pillow, pylibmc
+zlib1g-dev
+
+##Postgresql and psycopg2 dependencies
+libpq-dev
+
+##Pillow dependencies
+libtiff5-dev
+libjpeg62-turbo-dev
+libfreetype6-dev
+liblcms2-dev
+libwebp-dev
+
+##django-extensions
+graphviz-dev
diff --git a/utility/requirements-trusty.apt b/utility/requirements-trusty.apt
new file mode 100644
index 0000000..455f1a8
--- /dev/null
+++ b/utility/requirements-trusty.apt
@@ -0,0 +1,23 @@
+##basic build dependencies of various Django apps for Ubuntu Trusty 14.04
+#build-essential metapackage install: make, gcc, g++,
+build-essential
+#required to translate
+gettext
+python3-dev
+
+##shared dependencies of:
+##Pillow, pylibmc
+zlib1g-dev
+
+##Postgresql and psycopg2 dependencies
+libpq-dev
+
+##Pillow dependencies
+libtiff4-dev
+libjpeg8-dev
+libfreetype6-dev
+liblcms1-dev
+libwebp-dev
+
+##django-extensions
+graphviz-dev
diff --git a/utility/requirements-xenial.apt b/utility/requirements-xenial.apt
new file mode 100644
index 0000000..ba84ef1
--- /dev/null
+++ b/utility/requirements-xenial.apt
@@ -0,0 +1,23 @@
+##basic build dependencies of various Django apps for Ubuntu Xenial 16.04
+#build-essential metapackage install: make, gcc, g++,
+build-essential
+#required to translate
+gettext
+python3-dev
+
+##shared dependencies of:
+##Pillow, pylibmc
+zlib1g-dev
+
+##Postgresql and psycopg2 dependencies
+libpq-dev
+
+##Pillow dependencies
+libtiff5-dev
+libjpeg8-dev
+libfreetype6-dev
+liblcms2-dev
+libwebp-dev
+
+##django-extensions
+graphviz-dev