<commit_before>#!/bin/sh

# First argument $1 must be the username (uid)

if [ "$(whoami)" != "root" ]; then
	echo "root/sudo required. Stopping."
	exit 1
fi

USER=$1
MNT_POINT=/mnt/home-drive
PAM_LOCAL_CONF=/home/$USER/.pam_mount.conf.xml
PAM_GLOBAL_CONF=/etc/security/pam_mount.conf.xml

echo "installing required packages"
apt-get install -y libpam_mount cifs-utils

echo "configuing auto-mounting of home-drive"
mkdir $MNT_POINT
touch $PAM_LOCAL_CONF

echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" >> $PAM_LOCAL_CONF
echo "<!DOCTYPE pam_mount SYSTEM \"pam_mount.conf.xml.dtd\">" >> $PAM_LOCAL_CONF
echo "<pam_mount>" >> $PAM_LOCAL_CONF
echo "<volume options=\"user=$USER,workgroup=FHKN,domain=FHKN\" user=\"$USER\" mountpoint=\"/media/home-drive\" path=\"//homedrive.htwg-konstanz.de/home\" fstype=\"cifs\" />" >> $PAM_LOCAL_CONF
echo "</pam_mount>" >> $PAM_LOCAL_CONF

echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" >> $PAM_GLOBAL_CONF
echo "<!DOCTYPE pam_mount SYSTEM \"pam_mount.conf.xml.dtd\">" >> $PAM_GLOBAL_CONF
echo "<pam_mount>" >> $PAM_GLOBAL_CONF<commit_msg>check if username is inserted in script<commit_after>#!/bin/sh

# 
# Before running this script, replace ##INSERT_USERNAME## through the real username.
#

USER="##INSERT_USERNAME##"

if [ "$USER" == "##INSERT_USERNAME##" ]; then
	echo "##INSERT_USERNAME## not replaced by real username. Stopping."
	exit 1
fi

if [ "$(whoami)" != "root" ]; then
	echo "root/sudo required. Stopping."
	exit 1
fi

MNT_POINT=/mnt/home-drive
PAM_LOCAL_CONF=/home/$USER/.pam_mount.conf.xml
PAM_GLOBAL_CONF=/etc/security/pam_mount.conf.xml

echo "installing required packages"
apt-get install -y libpam_mount cifs-utils

echo "configuing auto-mounting of home-drive"
mkdir $MNT_POINT
touch $PAM_LOCAL_CONF

echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" >> $PAM_LOCAL_CONF
echo "<!DOCTYPE pam_mount SYSTEM \"pam_mount.conf.xml.dtd\">" >> $PAM_LOCAL_CONF
echo "<pam_mount>" >> $PAM_LOCAL_CONF
echo "<volume options=\"user=$USER,workgroup=FHKN,domain=FHKN\" user=\"$USER\" mountpoint=\"/media/home-drive\" path=\"//homedrive.htwg-konstanz.de/home\" fstype=\"cifs\" />" >> $PAM_LOCAL_CONF
echo "</pam_mount>" >> $PAM_LOCAL_CONF

echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?>" >> $PAM_GLOBAL_CONF
echo "<!DOCTYPE pam_mount SYSTEM \"pam_mount.conf.xml.dtd\">" >> $PAM_GLOBAL_CONF
echo "<pam_mount>" >> $PAM_GLOBAL_CONF
{'fraction_non_alphanumeric': 0.18319327731092436, 'fraction_numerical': 0.007142857142857143, 'mean_word_length': 5.282321899736147, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 4, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 12}, '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': '1857096', 'n_tokens_mistral': 925, 'n_tokens_neox': 889, 'n_words': 184}