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 }