<commit_before>#!/bin/bash
# ----------------------------------------------------------------------------
#	Copyright 2013 <EMAIL>
#
#	Licensed under the Apache License, Version 2.0 (the "License");
#	you may not use this file except in compliance with the License.
#	You may obtain a copy of the License at
#
#		http://www.apache.org/licenses/LICENSE-2.0
#
#	Unless required by applicable law or agreed to in writing, software
#	distributed under the License is distributed on an "AS IS" BASIS,
#	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#	See the License for the specific language governing permissions and
#	limitations under the License.
# ----------------------------------------------------------------------------
#
#	Copyright (c) 2013 <EMAIL>.  All rights reserved.
#
# title			EDCS - Easy Deployment and Configuration Script
# description		Makes deployment and configuration of hosts nice and
#			easy. This script shows an overview of scripts
#			available and calls the subscript chosen. 
# author		<EMAIL>
# date			20130612
# last modified		20130708
# version		0.1
# usage			bash edcs.sh
# notes	
# ----------------------------------------------------------------------------

# GLOBAL CONFIGURATION -------------------------------------------------------
# These variables are true for all subscripts in SCRIPTS_FOLDER
SCRIPTS_FOLDER="scripts"	#Default: "scripts"
TEXT_EDITOR="nano"		#Default: "nano"  e.g. vi, vim, nano ... 

# FUNCTIONS ------------------------------------------------------------------

# PREREQUISITES --------------------------------------------------------------
# Make sure we are root

function checkoperatingsystem {
	# determine system type
        if [[ $(uname -a | grep -E $1) ]]; then
		echo "[$(date --rfc-3339=seconds)] $(uname -a)"
		echo "[$(date --rfc-3339=seconds)] This operating system is supported"
        else
                echo "[$(date --rfc-3339=seconds)] $(uname -a)"
                echo "[$(date --rfc-3339=seconds)] This operating system is NOT supported"
                exit 1
        fi
}

function checkdependencies {
	# Check dependencies
	# Source: http://www.mirkopagliai.it/bash-scripting-check-for-and-install-missing-dependencies/

	IFS=' ' read -a DEPENDENCIES <<< "${1}"

	# What dependencies are missing?
	PKGSTOINSTALL=""
	for (( i=0; i<${tLen=${#DEPENDENCIES[@]}}; i++ )); do
		# Debian, Ubuntu and derivatives (with dpkg)
			if which dpkg &> /dev/null; then
			if [[ ! $(dpkg -l | grep -w "ii  ${DEPENDENCIES[$i]} ") ]]; then
				PKGSTOINSTALL=$PKGSTOINSTALL" "${DEPENDENCIES[$i]}
			fi
		# OpenSuse, Mandriva, Fedora, CentOs, ecc. (with rpm)
		elif which rpm &> /dev/null; then
			if [[ ! $(rpm -qa | grep ${DEPENDENCIES[$i]}) ]]; then
				PKGSTOINSTALL=$PKGSTOINSTALL" "${DEPENDENCIES[$i]}
			fi
		# ArchLinux (with pacman)
		elif which pacman &> /dev/null; then
			if [[ ! $(pacman -Qqe | grep "${DEPENDENCIES[$i]}") ]]; then
				PKGSTOINSTALL=$PKGSTOINSTALL" "${DEPENDENCIES[$i]}
			fi
		# If it's impossible to determine if there are missing dependencies, mark all as missing
		else
			PKGSTOINSTALL=$PKGSTOINSTALL" "${DEPENDENCIES[$i]}
		fi
	done

	# If some dependencies are missing, asks if user wants to install
	if [ "$PKGSTOINSTALL" != "" ]; then
		echo -n "[$(date --rfc-3339=seconds)] Some dependencies are missing. Want to install them? (Y/n): "
		read SURE
		# If user want to install missing dependencies
		if [[ $SURE = "Y" || $SURE = "y" || $SURE = "" ]]; then
			# Debian, Ubuntu and derivatives (with apt-get)
			if which apt-get &> /dev/null; then
				apt-get install $PKGSTOINSTALL
			# OpenSuse (with zypper)
			elif which zypper &> /dev/null; then
				zypper in $PKGSTOINSTALL
			# Mandriva (with urpmi)
			elif which urpmi &> /dev/null; then
				urpmi $PKGSTOINSTALL
			# Fedora and CentOS (with yum)
			elif which yum &> /dev/null; then
				yum install $PKGSTOINSTALL
			# ArchLinux (with pacman)
			elif which pacman &> /dev/null; then
				pacman -Sy $PKGSTOINSTALL
			# Else, if no package manager has been founded
			else
				# Set $NOPKGMANAGER
				NOPKGMANAGER=TRUE<commit_msg>Added debug output to checkdependencies<commit_after>#!/bin/bash
# ----------------------------------------------------------------------------
#	Copyright 2013 <EMAIL>
#
#	Licensed under the Apache License, Version 2.0 (the "License");
#	you may not use this file except in compliance with the License.
#	You may obtain a copy of the License at
#
#		http://www.apache.org/licenses/LICENSE-2.0
#
#	Unless required by applicable law or agreed to in writing, software
#	distributed under the License is distributed on an "AS IS" BASIS,
#	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#	See the License for the specific language governing permissions and
#	limitations under the License.
# ----------------------------------------------------------------------------
#
#	Copyright (c) 2013 <EMAIL>.  All rights reserved.
#
# title			EDCS - Easy Deployment and Configuration Script
# description		Makes deployment and configuration of hosts nice and
#			easy. This script shows an overview of scripts
#			available and calls the subscript chosen. 
# author		<EMAIL>
# date			20130612
# last modified		20130708
# version		0.1
# usage			bash edcs.sh
# notes	
# ----------------------------------------------------------------------------

# GLOBAL CONFIGURATION -------------------------------------------------------
# These variables are true for all subscripts in SCRIPTS_FOLDER
SCRIPTS_FOLDER="scripts"	#Default: "scripts"
TEXT_EDITOR="nano"		#Default: "nano"  e.g. vi, vim, nano ... 

# FUNCTIONS ------------------------------------------------------------------

# PREREQUISITES --------------------------------------------------------------
# Make sure we are root

function checkoperatingsystem {
	# determine system type
        if [[ $(uname -a | grep -E $1) ]]; then
		echo "[$(date --rfc-3339=seconds)] $(uname -a)"
		echo "[$(date --rfc-3339=seconds)] This operating system is supported"
        else
                echo "[$(date --rfc-3339=seconds)] $(uname -a)"
                echo "[$(date --rfc-3339=seconds)] This operating system is NOT supported"
                exit 1
        fi
}

function checkdependencies {
	# Check dependencies
	# Source: http://www.mirkopagliai.it/bash-scripting-check-for-and-install-missing-dependencies/

	IFS=' ' read -a DEPENDENCIES <<< "${1}"
	echo "Checking the following dependencies:"
	echo ${DEPENDENCIES[@]}
	read -p "Press [Enter] to continue..."

	# What dependencies are missing?
	PKGSTOINSTALL=""
	for (( i=0; i<${tLen=${#DEPENDENCIES[@]}}; i++ )); do
		# Debian, Ubuntu and derivatives (with dpkg)
			if which dpkg &> /dev/null; then
			if [[ ! $(dpkg -l | grep -w "ii  ${DEPENDENCIES[$i]} ") ]]; then
				PKGSTOINSTALL=$PKGSTOINSTALL" "${DEPENDENCIES[$i]}
			fi
		# OpenSuse, Mandriva, Fedora, CentOs, ecc. (with rpm)
		elif which rpm &> /dev/null; then
			if [[ ! $(rpm -qa | grep ${DEPENDENCIES[$i]}) ]]; then
				PKGSTOINSTALL=$PKGSTOINSTALL" "${DEPENDENCIES[$i]}
			fi
		# ArchLinux (with pacman)
		elif which pacman &> /dev/null; then
			if [[ ! $(pacman -Qqe | grep "${DEPENDENCIES[$i]}") ]]; then
				PKGSTOINSTALL=$PKGSTOINSTALL" "${DEPENDENCIES[$i]}
			fi
		# If it's impossible to determine if there are missing dependencies, mark all as missing
		else
			PKGSTOINSTALL=$PKGSTOINSTALL" "${DEPENDENCIES[$i]}
		fi
	done

	echo "Found the following missing packages: $PKGSTOINSTALL"
	read -p "Press [Enter] to continue..."

	# If some dependencies are missing, asks if user wants to install
	if [ "$PKGSTOINSTALL" != "" ]; then
		echo -n "[$(date --rfc-3339=seconds)] Some dependencies are missing. Want to install them? (Y/n): "
		read SURE
		# If user want to install missing dependencies
		if [[ $SURE = "Y" || $SURE = "y" || $SURE = "" ]]; then
			# Debian, Ubuntu and derivatives (with apt-get)
			if which apt-get &> /dev/null; then
				apt-get install $PKGSTOINSTALL
			# OpenSuse (with zypper)
			elif which zypper &> /dev/null; then
				zypper in $PKGSTOINSTALL
			# Mandriva (with urpmi)
			elif which urpmi &> /dev/null; then
				urpmi $PKGSTOINSTALL
			# Fedora and CentOS (with yum)
			elif which yum &> /dev/null; then
				yum install $PKGSTOINSTALL
			# ArchLinux (with pacman)
			elif which pacman &> /dev/null; then
				pacman -Sy $PKGSTOINSTALL
			# Else, if no package manager has been founded
			else
				# Set $NOPKGMANAGER
				NOPKGMANAGER=TRUE
{'fraction_non_alphanumeric': 0.20908018867924527, 'fraction_numerical': 0.012735849056603774, 'mean_word_length': 2.3141852286049236, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '7328292', 'n_tokens_mistral': 2942, 'n_tokens_neox': 2607, 'n_words': 863}