Improve install_os_dependencies.sh (#605)

* rename requirements.apt -> requirements-trusty.apt
and requirements.apt.xenial -> requirements-xenial.apt

* improve install_os_dependencies.sh

* remove unused non-python requirements

* rename "install" function to "install_packages" and
"upgrade" function to "upgrade_packages" to solve shellcheck lint errors
This commit is contained in:
Fábio C. Barrionuevo da Luz 2016-06-09 00:15:01 -03:00 committed by Daniel Roy Greenfeld
parent b59d1b1520
commit 1812546e99
4 changed files with 46 additions and 58 deletions

View File

@ -1,14 +1,17 @@
#!/bin/bash #!/bin/bash
WORK_DIR="$(dirname "$0")" WORK_DIR="$(dirname "$0")"
OS_REQUIREMENTS_FILENAME="$WORK_DIR/requirements.apt" DISTRO_NAME=$(lsb_release -sc)
VER=$(lsb_release -sr) OS_REQUIREMENTS_FILENAME="$WORK_DIR/requirements-$DISTRO_NAME.apt"
if [ "$VER" == "16.04" ]; then
OS_REQUIREMENTS_FILENAME="requirements.apt.xenial"
else if [ "$DISTRO_NAME" != "xenial" ] && [ "$DISTRO_NAME" != "trusty" ]; then
OS_REQUIREMENTS_FILENAME="requirements.apt" echo "Only the Ubuntu 14.04 (Trusty) and 16.04 (Xenial) is supported by this script";
echo "You can see requirements-trusty.apt or requirements-xenial.apt file to help search the equivalent package in your system";
exit 1;
fi fi
# Handle call with wrong command # Handle call with wrong command
function wrong_command() function wrong_command()
{ {
@ -31,15 +34,15 @@ function usage_message()
# Read the requirements.apt file, and remove comments and blank lines # Read the requirements.apt file, and remove comments and blank lines
function list_packages(){ function list_packages(){
grep -v "#" ${OS_REQUIREMENTS_FILENAME} | grep -v "^$"; grep -v "#" "${OS_REQUIREMENTS_FILENAME}" | grep -v "^$";
} }
function install() function install_packages()
{ {
list_packages | xargs apt-get --no-upgrade install -y; list_packages | xargs apt-get --no-upgrade install -y;
} }
function upgrade() function upgrade_packages()
{ {
list_packages | xargs apt-get install -y; list_packages | xargs apt-get install -y;
} }
@ -53,7 +56,7 @@ function install_or_upgrade()
if [[ $EUID -ne 0 ]]; then if [[ $EUID -ne 0 ]]; then
echo -e "\nYou must run this with root privilege" 2>&1 echo -e "\nYou must run this with root privilege" 2>&1
echo -e "Please do:\n" 2>&1 echo -e "Please do:\n" 2>&1
echo "sudo ./${0##*/} $PARAN" 2>&1 echo "sudo ./$WORK_DIR/${0##*/} $PARAN" 2>&1
echo -e "\n" 2>&1 echo -e "\n" 2>&1
exit 1 exit 1
@ -63,9 +66,9 @@ function install_or_upgrade()
# Install the basic compilation dependencies and other required libraries of this project # Install the basic compilation dependencies and other required libraries of this project
if [ "$PARAN" == "install" ]; then if [ "$PARAN" == "install" ]; then
install; install_packages;
else else
upgrade; upgrade_packages;
fi fi
# cleaning downloaded packages from apt-get cache # cleaning downloaded packages from apt-get cache
@ -84,5 +87,5 @@ case "$1" in
upgrade) install_or_upgrade "upgrade";; upgrade) install_or_upgrade "upgrade";;
list) list_packages;; list) list_packages;;
help) usage_message;; help) usage_message;;
*) wrong_command $1;; *) wrong_command "$1";;
esac esac

View File

@ -1,4 +1,4 @@
##basic build dependencies of various Django apps for Ubuntu 14.04 ##basic build dependencies of various Django apps for Ubuntu Trusty 14.04
#build-essential metapackage install: make, gcc, g++, #build-essential metapackage install: make, gcc, g++,
build-essential build-essential
#required to translate #required to translate
@ -25,3 +25,4 @@ libwebp-dev
##django-extensions ##django-extensions
graphviz-dev graphviz-dev

View File

@ -0,0 +1,28 @@
##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
{% if cookiecutter.use_python2 == 'n' -%}
python3-dev
{% else %}
python-dev
{%- endif %}
##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

View File

@ -1,44 +0,0 @@
##basic build dependencies of various Django apps for Ubuntu 14.04
#build-essential metapackage install: make, gcc, g++,
build-essential
#required to translate
gettext
python-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
##hitch
python-setuptools
python3-dev
python-virtualenv
python-pip
firefox
automake
libtool
libreadline6
libreadline6-dev
libreadline-dev
libsqlite3-dev
libxml2
libxml2-dev
libssl-dev
libbz2-dev
wget
curl
llvm