<commit_before>#!/bin/sh

#
# This script will setup the host the script is executed on
# as an ipynbsrv Docker host.
# For that, it installes the Docker environment, creates the
# required directories and configures the system to be an
# LDAP client.
#
# TODO:
#   - detect CentOS/EL version: CentOS 6 has Docker packages in EPEL repo
#
# last updated: 30.11.2014
#

echo "Note: During installation, you'll be prompted with a dialog to configure the LDAP client."
echo "Make sure you enter the correct information for your system."

# detect the package manager
if `which apt-get &> /dev/null`; then
    PS="deb"
    INSTALL="apt-get install -y"
else
    PS="rpm"
    INSTALL="yum install -y"
fi

# install prequisites
$INSTALL curl sed sudo tar
# install docker.io
if $PS == "deb"; then
    $INSTALL docker.io
else
    $INSTALL docker
fi
# install docker-bash/-ssh (optional)
curl --fail -L -O https://github.com/phusion/baseimage-docker/archive/master.tar.gz
tar xzf master.tar.gz
sudo ./baseimage-docker-master/install-tools.sh
rm -rf master.tar.gz baseimage-docker-mages
# pull the base image for our templates
docker pull phusion/baseimage

# create the directories for the users and shares
mkdir -p /srv/homes
mkdir -p /srv/shares

# install the LDAP client tools
# we need to know all LDAP users because the home/share directories will belong to them
$INSTALL libpam-ldapd

# configure that we want to use LDAP for passwd etc.
sed -i 's/compat/compat ldap/' /etc/nsswitch.conf

# TODO:
#  - clone the repository with the Dockerfiles
#  - build the images: LDAP (or NIS), IPython etc.
<commit_msg>root check; sudo not needed anymore; check if yum exists..may be Arch linux or another one; create the public dir<commit_after>#!/bin/sh

#
# This script will setup the host the script is executed on
# as an ipynbsrv Docker host.
# For that, it installes the Docker environment, creates the
# required directories and configures the system to be an
# LDAP client.
#
# TODO:
#   - detect CentOS/EL version: CentOS 6 has Docker packages in EPEL repo
#
# last updated: 30.11.2014
#

if [ "$EUID" -ne 0 ]; then
  echo "This script must be executed as root user."
  exit 1
fi

echo "Note: During installation, you'll be prompted with a dialog to configure the LDAP client."
echo "Make sure you enter the correct information for your system."

# detect the package manager
if [ `which apt-get &> /dev/null` ]; then
    PS="deb"
    INSTALL="apt-get install -y"
elif [ `which yum &> /dev/null` ]; then
    PS="rpm"
    INSTALL="yum install -y"
else
    echo "Your distribution is not supported yet. Aborting the setup."
    exit 1
fi

# install prequisites
$INSTALL curl sed sudo tar
# install docker.io
if [ $PS == "deb" ]; then
    $INSTALL docker.io
else
    $INSTALL docker
fi
# install docker-bash/-ssh (optional)
curl --fail -L -O https://github.com/phusion/baseimage-docker/archive/master.tar.gz
tar xzf master.tar.gz
./baseimage-docker-master/install-tools.sh
rm -rf master.tar.gz baseimage-docker-mages
# pull the base image for our templates
docker pull phusion/baseimage

# create the directories for the users and shares
DATA="/srv/ipynbsrv"
mkdir -p $DATA
mkdir -p $DATA/homes
mkdir -p $DATA/public
mkdir -p $DATA/shares
# ensure secure permissions. just in cast a custom umask is set
chown -R root:root $DATA
chmod -R 755 $DATA

# install the LDAP client tools
# we need to know all LDAP users because the home/share directories will belong to them
$INSTALL libpam-ldapd

# configure that we want to use LDAP for passwd etc.
sed -i 's/compat/compat ldap/' /etc/nsswitch.conf

# TODO:
#  - clone the repository with the Dockerfiles
#  - build the images: LDAP (or NIS), IPython etc.

{'fraction_non_alphanumeric': 0.09287841862984024, 'fraction_numerical': 0.006498781478472786, 'mean_word_length': 3.6059850374064837, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4526325', 'n_tokens_mistral': 1255, 'n_tokens_neox': 1157, 'n_words': 496}