Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating utility/*.sh scripts from sodar-server
- Loading branch information
Showing
8 changed files
with
56 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,44 @@ | ||
#!/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 | ||
#!/usr/bin/env bash | ||
|
||
echo "***********************************************" | ||
echo "Apt-get update" | ||
echo "***********************************************" | ||
apt-get -y update | ||
|
||
echo "***********************************************" | ||
echo "Installing general OS dependencies" | ||
echo "***********************************************" | ||
apt-get -y install build-essential | ||
apt-get -y install python3-dev | ||
apt-get -y install curl | ||
|
||
echo "***********************************************" | ||
echo "Installing Pillow and pylibmc dependencies" | ||
echo "***********************************************" | ||
apt-get -y install zlib1g-dev | ||
apt-get -y install libtiff5-dev | ||
apt-get -y install libjpeg8-dev | ||
apt-get -y install libfreetype6-dev | ||
apt-get -y install liblcms2-dev | ||
apt-get -y install libwebp-dev | ||
|
||
echo "***********************************************" | ||
echo "Installing Postgresql and psycopg2 dependencies" | ||
echo "***********************************************" | ||
apt-get -y install libpq-dev | ||
|
||
echo "***********************************************" | ||
echo "Installing django-extensions dependencies" | ||
echo "***********************************************" | ||
apt-get -y install graphviz-dev | ||
|
||
echo "***********************************************" | ||
echo "Installing SAML dependencies" | ||
echo "***********************************************" | ||
apt-get -y install xmlsec1 | ||
|
||
echo "***********************************************" | ||
echo "Installing lxml dependencies" | ||
echo "***********************************************" | ||
apt-get -y install libxml2-dev | ||
apt-get -y install libxslt-dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters