<commit_before>#!/bin/bash

fb="/etc/firstboot"
if [ ! -f $fb ]
then
	exit 0
fi

#stop installed services in stallation process
insserv -r pound
#insserv -r ucarp	
insserv -r gdnsd
systemctl disable gdnsd
/etc/init.d/gdnsd stop
insserv -r networking
#insserv -r nfs-common
#insserv -r atd
insserv -r rsync
insserv -r x11-common
insserv -r exim4
systemctl disable exim4
/etc/init.d/exim4 stop
insserv -r snmpd
systemctl disable snmpd
/etc/init.d/snmpd stop
rm /etc/snmp/snmpd.conf


#change init scripts 
sed  -i 's/$remote_fs $syslog/$remote_fs $syslog zenloadbalancer/g' /etc/init.d/ssh
sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
sed -i 's/X11Forwarding yes/X11Forwarding no/g' /etc/ssh/sshd_config
cp /etc/motd.tail /etc/motd
/etc/init.d/ssh restart

sed -i 's/^\# Required-Start:.*/# Required-Start:\t\$network \$remote_fs \$syslog zenloadbalancer/g' /etc/init.d/snmpd
sed -i 's/^\# Required-Stop:.*/# Required-Stop:\t\$network \$remote_fs \$syslog zenloadbalancer/g' /etc/init.d/snmpd
insserv -r snmpd


#
rm $fb
<commit_msg>fix up networking if we started with DHCP<commit_after>#!/bin/bash

fb="/etc/firstboot"
if [ ! -f $fb ]
then
	exit 0
fi

#stop installed services in stallation process
insserv -r pound
#insserv -r ucarp	
insserv -r gdnsd
systemctl disable gdnsd
/etc/init.d/gdnsd stop
insserv -r networking
#insserv -r nfs-common
#insserv -r atd
insserv -r rsync
insserv -r x11-common
insserv -r exim4
systemctl disable exim4
/etc/init.d/exim4 stop
insserv -r snmpd
systemctl disable snmpd
/etc/init.d/snmpd stop
rm /etc/snmp/snmpd.conf


#change init scripts 
sed  -i 's/$remote_fs $syslog/$remote_fs $syslog zenloadbalancer/g' /etc/init.d/ssh
sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
sed -i 's/X11Forwarding yes/X11Forwarding no/g' /etc/ssh/sshd_config
cp /etc/motd.tail /etc/motd
/etc/init.d/ssh restart

sed -i 's/^\# Required-Start:.*/# Required-Start:\t\$network \$remote_fs \$syslog zenloadbalancer/g' /etc/init.d/snmpd
sed -i 's/^\# Required-Stop:.*/# Required-Stop:\t\$network \$remote_fs \$syslog zenloadbalancer/g' /etc/init.d/snmpd
insserv -r snmpd


# add an interface file if we were installed with DHCP etc.
CDIR=/opt/klb/config
NCONF=/etc/network/interfaces

if ! grep -qi "inet static" $NCONF; then
	EG="`ip route list|awk '/default/ { print $5 " " $3; exit }'`"
	IF="`echo $EG|awk '{ print $1 }'`"
	GW="`echo $EG|awk '{ print $2 }'`"
	IPM="`/sbin/ifconfig $IF | awk '/inet / { print $2 " " $4 }'`"
	IP="`echo $IPM| sed 's/addr:\([^ ]*\).*/\1/'`"
	MASK="`echo \"$IPM\" | sed 's/.*Mask://'`"
	echo "$IF::$IP:$MASK:up::" > $CDIR/if_${IF}_conf
	sed -i "s/defaultgw=.*/defaultgw=$GW" $CDIR/global.conf
	sed -i "s/defaultgwif=.*/defaultgwif=$IF" $CDIR/global.conf
	echo "#zenmodified" > $NCONF
	echo "auto lo" >> $NCONF
	echo "iface lo inet loopback" >> $NCONF
fi


#
rm $fb

{'fraction_non_alphanumeric': 0.16441675320179994, 'fraction_numerical': 0.009345794392523364, 'mean_word_length': 3.729950900163666, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '2399809', 'n_tokens_mistral': 1266, 'n_tokens_neox': 1228, 'n_words': 308}