<commit_before>#!/bin/bash

# SaltStack Configuration
# <NAME> (<EMAIL>)

# This script configures the saltstack minion

# Some informations
# http://docs.saltstack.com/en/latest/ref/configuration/minion.html

# Needs:
# sudo aptitude install salt-minion -y

key="$1"

install_cmd()
{
	echo "  - Configuring salt minion"

	# BACKUP
	if [ ! -f /etc/salt/minion.bkp ]; then
		if [ -f /etc/salt/minion ]; then
			cp /etc/salt/minion /etc/salt/minion.bkp
		fi
	else
		cp /etc/salt/minion.bkp /etc/salt/minion
	fi

	if [ ! -f /etc/salt/minion_id.bkp ]; then
		if [ -f /etc/salt/minion_id ]; then
			cp /etc/salt/minion_id /etc/salt/minion_id.bkp
		fi
	else
		cp /etc/salt/minion_id.bkp /etc/salt/minion_id
	fi

	service salt-master stop 2> /dev/null

	# Update the master address
	sed -i "s/^[#]*master:.*/master: rodos/g" /etc/salt/minion

	service salt-master start 2> /dev/null
}

remove_cmd()
{
	echo "  - Reverting salt minion configs"

	service salt-master stop 2> /dev/null

	if [ -f /etc/salt/minion.bkp ]; then
		mv /etc/salt/minion.bkp /etc/salt/minion
	fi

	if [ -f /etc/salt/minion_id.bkp ]; then
		mv /etc/salt/minion_id.bkp /etc/salt/minion_id
	fi

	service salt-master start 2> /dev/null
}

case $key in

	-i|--install)<commit_msg>Update saltstack-config.sh<commit_after>#!/bin/bash

# SaltStack Configuration
# <NAME> (<EMAIL>)

# This script configures the saltstack minion

# Some informations
# http://docs.saltstack.com/en/latest/ref/configuration/minion.html

# Needs:
# sudo aptitude install salt-minion -y

key="$1"

install_cmd()
{
	echo "  - Configuring salt minion"

	# BACKUP
	if [ ! -f /etc/salt/minion.bkp ]; then
		if [ -f /etc/salt/minion ]; then
			cp /etc/salt/minion /etc/salt/minion.bkp
		fi
	else
		cp /etc/salt/minion.bkp /etc/salt/minion
	fi

	if [ ! -f /etc/salt/minion_id.bkp ]; then
		if [ -f /etc/salt/minion_id ]; then
			cp /etc/salt/minion_id /etc/salt/minion_id.bkp
		fi
	else
		cp /etc/salt/minion_id.bkp /etc/salt/minion_id
	fi

	service salt-master stop 2> /dev/null

	# Update the master address
	if [ -f /etc/salt/minion ]; then
		sed -i "s/^[#]*master:.*/master: rodos/g" /etc/salt/minion
	fi

	service salt-master start 2> /dev/null
}

remove_cmd()
{
	echo "  - Reverting salt minion configs"

	service salt-master stop 2> /dev/null

	if [ -f /etc/salt/minion.bkp ]; then
		mv /etc/salt/minion.bkp /etc/salt/minion
	fi

	if [ -f /etc/salt/minion_id.bkp ]; then
		mv /etc/salt/minion_id.bkp /etc/salt/minion_id
	fi

	service salt-master start 2> /dev/null
}

case $key in

	-i|--install)
{'fraction_non_alphanumeric': 0.14877663772691396, 'fraction_numerical': 0.003946329913180742, 'mean_word_length': 2.888036809815951, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 15, 'https://': 0, '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': '2856054', 'n_tokens_mistral': 1177, 'n_tokens_neox': 1049, 'n_words': 237}