#!/bin/bash # Postsetup für Debian # Version 0.4 # Date: 01.11.2022 # Autor: m.soika@info-linux.de ## RunME: ## wget -c -O /tmp/step_one.sh https://ftp.info-linux.de/arbeiten/Debian/PostSetupDebian12.sh.txt && chmod 755 /tmp/step_one.sh && /tmp/step_one.sh NORMAL='\033[0;39m' BLUE='\033[1;34m' GREEN='\033[1;32m' RED='\033[1;31m' YELLOW='\033[1;33m' if [ $UID -ne 0 ]; then echo; echo -e "$RED Sie sind nicht root. $NORMAL Wechseln Sie zu Root und versuchen Sie es erneut!"; echo; rm -rf /tmp/step_one.sh; exit 1; fi if [ -f /usr/sbin/system-update.sh ]; then rm -f /usr/sbin/system-update.sh; fi && wget -c --progress=dot -O /usr/sbin/system-update.sh https://ftp.info-linux.de/arbeiten/Linux/system-update.sh && chmod 755 /usr/sbin/system-update.sh system-update.sh apt install vim htop atop mc nload conntrack iptstate iptraf-ng iftop tmux net-tools ngrep lbzip2 iptables neofetch netcat-traditional btop cmatrix -y ## Change Hostname: function setHostname { echo echo -en "$YELLOW Enter the new FQDN hostname: $NORMAL"; read hname; if [ -z $hname ]; then echo -e $RED; echo -e "\tYou haven't entered a fucking hostname. Why doesn't anyone listen to me?" $NORMAL; echo; setHostname else hostnamectl set-hostname $hname echo -e $YELLOW; echo -e "\t The new hostname is now: $(hostname -f)"; echo -e $NORMAL; fi } #setHostname sed -i 's/"set background=dark/set background=dark/g' /etc/vim/vimrc; sed -i 's/"syntax on/syntax on/g' /etc/vim/vimrc; sed -i 's/GRUB_TIMEOUT=5/GRUB_TIMEOUT=1/g' /etc/default/grub; update-grub2; sed -i 's/FONTFACE="Fixed"/FONTFACE="VGA"/g' /etc/default/console-setup; ## Add some stuff in the bash.rc echo " " >> /etc/bash.bashrc echo "# enable bash completion in interactive shells" >> /etc/bash.bashrc echo "if ! shopt -oq posix; then" >> /etc/bash.bashrc echo " if [ -f /usr/share/bash-completion/bash_completion ]; then" >> /etc/bash.bashrc echo " . /usr/share/bash-completion/bash_completion" >> /etc/bash.bashrc echo " elif [ -f /etc/bash_completion ]; then" >> /etc/bash.bashrc echo " . /etc/bash_completion" >> /etc/bash.bashrc echo " fi" >> /etc/bash.bashrc echo "fi" >> /etc/bash.bashrc echo " " >> /etc/bash.bashrc echo "## Home bin" >> /etc/bash.bashrc #echo "if [ -d '$HOME/bin' ] ; then PATH='$HOME/bin:$PATH'; fi" >> /etc/bash.bashrc echo "if [ ! -d \$HOME/bin ]; then mkdir \$HOME/bin; fi" >> /etc/bash.bashrc echo "if [ -d "\$HOME/bin" ] ; then PATH="\$HOME/bin:\$PATH"; fi" >> /etc/bash.bashrc echo " " >> /etc/bash.bashrc echo "### Optional ####" >> /etc/bash.bashrc echo "if [ "\$UID = 0" ]; then PS1='\A \[\e[0;31m\]\u@\[\e[0;32m\]\h: \$(if [[ \$? == 0 ]]; then echo "✓"; else echo "✗"; fi) \[\e[1;36m\]\w\$\[\e[0m\] '; fi" >> /etc/bash.bashrc echo "if [ ! "\$UID = 0" ]; then PS1='\A \[\e[0;32m\]\u@\[\e[0;32m\]\h: \$(if [[ \$? == 0 ]]; then echo "✓"; else echo "✗"; fi) \[\e[1;36m\]\w\$\[\e[0m\] '; fi" >> /etc/bash.bashrc echo "HISTTIMEFORMAT='%F %T : '" >> /etc/bash.bashrc echo " " >> /etc/bash.bashrc echo "#Alias" >> /etc/bash.bashrc echo "alias ll='ls -lh --color'" >> /etc/bash.bashrc echo "alias l='ls -lha --color'" >> /etc/bash.bashrc echo "alias ls='ls --color'" >> /etc/bash.bashrc echo "alias rm='rm -i'" >> /etc/bash.bashrc echo "alias ..='cd ..'" >> /etc/bash.bashrc echo "alias cd..='cd ..'" >> /etc/bash.bashrc echo "alias ...='cd ../..'" >> /etc/bash.bashrc echo "alias o='less'" >> /etc/bash.bashrc echo "alias links='links2 -language german'" >> /etc/bash.bashrc echo "alias cls='clear'" >> /etc/bash.bashrc echo "alias tailsyslog='tail -f /var/log/syslog'" >> /etc/bash.bashrc echo " " >> /etc/bash.bashrc find / -iname .bashrc -delete > /dev/null 2>&1 update-alternatives --set editor /usr/bin/vim.basic wget -c -O /usr/bin/post_start.sh https://ftp.info-linux.de/arbeiten/Linux/post_start_deb10.sh && chmod 755 /usr/bin/post_start.sh echo "@reboot root /bin/bash --login /usr/bin/post_start.sh" >> /etc/crontab system-update.sh echo -e "$YELLOW Fertig $NORMAL Sie sollten den Computer jetzt neu starten! (reboot or init 6)" rm -rf /tmp/step_one.sh