Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
cgi-updater/cgi-updater-payload.sh
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
56 lines (45 sloc)
1.3 KB
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
#!/bin/bash | |
r_pkgs=( DESeq2 grDevices genefilter biomaRt ggplot2 gplots RColorBrewer ) | |
pip_pkgs=( biopython ) | |
if [[ $(id -u) -ne 0 ]]; then | |
echo "Error: run this script as the root user, not EUID $(id -u)." | |
exit 1 | |
fi | |
set -e # Make most errors fatal. | |
ubuntu_update () { | |
apt-get update | |
apt-get -y upgrade | |
} | |
ubuntu_install_r_cran () { | |
cat <<EOF > /etc/apt/sources.list.d/cgi-r-cran.list | |
# Newest R version from CRAN per | |
# https://cran.r-project.org/bin/linux/ubuntu/ | |
deb https://cran.fhcrc.org/bin/linux/ubuntu $(lsb_release -cs)/ | |
EOF | |
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E084DAB9 | |
apt-get update | |
apt-get -y install r-base-dev | |
} | |
python_install_packages() { | |
pip install --upgrade ${pip_pkgs[@]} | |
} | |
r_install_packages() { | |
local pkgs=\"$(sprintf "\",%s\"" "${r_pkgs[@]}")\" | |
R --quiet -vanilla -e <<EOF | |
source("https://bioconductor.org/biocLite.R") | |
biocLite(c(${pkgs:3}) | |
EOF | |
} | |
main () { | |
ubuntu_update | |
ubuntu_install_r_cran | |
python_install_packages | |
# Install R libraries in the user home directory so that updating | |
# the libraries later on does not triggering the "unwritable | |
# directory" warning. | |
export r_pkgs | |
export -f r_install packages | |
su cgi_user -c "bash -c r_install_packages" | |
unset r_pkgs r_install_packages | |
} | |
main |