summaryrefslogtreecommitdiffstats
path: root/satellit_installer/includes/90-patch_misc_files.inc
blob: 45c220f9d2949740479de140845683b41fafc150 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
patch_bashrc() {
	echo "#"
	echo "# As one of the last things here we will set a new prompt to distinguish"
	echo "# the bwLehrpool satellite server from other servers. To accomplish this"
	echo "# we will set a very classy prompt. This will take effect at next root login."
	local ifname=$( ifconfig | grep -oEm1 '^e\w+' )
	echo "# Setting prompt..."
	if grep -q '^IP=' /root/.bashrc; then
		echo "...already done."
	else
		sed "s/%ifname%/$ifname/g" >> /root/.bashrc <<-"ENDO"
			IP=$( ip -4 a show "%ifname%" 2>/dev/null | grep '^\s*inet\s' | awk -F ' ' '{print $2}' )
			[ -z "$IP" ] && IP=$(ip -4 a | grep '^\s*inet\s'| grep -v '127.0.0' | head -n 1 | awk -F ' ' '{print $2}')
			IP=${IP%/*}
			[ -z "$IP" ] && IP="noip???"
			PS1="\[\033[01;31m\]\u\[\033[00m\]@\[\033[01;32m\]\h \[\033[00m\]($IP)
			\[\033[01;34m\]\w\[\033[00m\] # "
		ENDO
	fi

	# aliases, dircolors
	sed -i -r 's/# *(alias|export LS|eval ")/\1/' /root/.bashrc
}

patch_vim() {
	sed -i -r 's/" *(syntax|set showmatch|set smartcase|set incsearch)/\1/' /etc/vim/vimrc
	echo "set autoindent" >> /etc/vim/vimrc
	echo "set smartindent" >> /etc/vim/vimrc
}

patch_ldapsearch() {
	# Make ldapsearch ignore invalid certificates
	sed -i '/tls_reqcert/Id' /etc/ldap/ldap.conf
	echo "TLS_REQCERT never" >> /etc/ldap/ldap.conf
}

patch_java() {
	# Fix svg renderer:
	# java.awt.AWTError: Assistive Technology not found: org.GNOME.Accessibility.AtkWrapper
	sed -i -e '/^assistive_technologies=/s/^/#/' /etc/java-*-openjdk/accessibility.properties &> /dev/null
}

set_version_string() {
	echo -n "# Setting version string..."
	echo 'VERSION="'$VERSION'"'	>> "$CONFIGDIR"/config
	echo "ok."
}