#!/bin/sh if [ $(id -u) -ne 0 ] ; then echo 'this script should be run as root instead!' exit 1 fi USER_NAME='loek' HOST_NAME='drvo' KERNEL_VERSION='6.6.15-ti-rt-arm32-r1' # latest i could find for ti # fail ok fok() { "$@" 1> /dev/null 2> /dev/null ; } echo "setting hostname to $HOST_NAME..." hostname $HOST_NAME hostname > /etc/hostname sed -i 's/\/'"$HOST_NAME"'/g' /etc/hosts echo "creating user $USER_NAME..." fok userdel debian rm -rf /home/debian fok id -u $USER_NAME || fok adduser $USER_NAME echo "removing all security..." rm -f /etc/sudoers.d/admin cat << "EOF" > /etc/sudoers.d/nopasswd %sudo ALL=(ALL:ALL) NOPASSWD: ALL EOF usermod -aG sudo $USER_NAME cat << "EOF" > /etc/ssh/sshd_config.d/rice.conf PasswordAuthentication yes PermitEmptyPasswords yes PermitRootLogin yes PrintLastLog no EOF systemctl restart ssh fok passwd -d root fok passwd -d $USER_NAME echo "fixing terminal colors & default editor..." cat << "EOF" > /etc/profile.d/rice.sh export TERM="xterm-256color" export EDITOR="nvim" EOF echo "removing bloatware..." fok apt remove -y --allow-change-held-packages \ libruby2.7 libgl1-mesa-dri python3-numpy mesa-vulkan-drivers \ bb-beagle-config libflite1 firmware-libertas python3-mypy libgtk-3-common \ adwaita-icon-theme firmware-atheros firmware-misc-nonfree \ pocketsphinx-en-us scratch libwebkit2gtk-4.0-37 firmware-iwlwifi \ bb-node-red-installer firefox-esr bb-code-server plymouth xserver-xorg-core \ xserver-xorg xserver-xorg-legacy x11-common x11-server-utils x11-utils \ lightdm-gtk-greeter lightdm xfce4-session xfce4-panel xfce4-settings \ xfce4-helpers fonts-dejavu-core nodejs nodejs-doc nginx-core nginx-common \ nginx mesa-va-drivers bluetooth bluez pipewire-bin pipewire pulseaudio-utils \ pulseaudio gtk-update-icon-cache wpasupplicant fontconfig-config fontconfig \ hostapd adwaita-icon-theme hicolor-icon-theme polkitd whiptail echo "removing more bloatware..." fok apt autoremove -y echo "cleaning up trash..." fok apt clean -y echo "updating system..." fok apt-get update fok apt-get upgrade -y echo "preparing for debian sid update..." export DEBIAN_FRONTEND=noninteractive echo "usrmerge usrmerge/autoconvert boolean true" | debconf-set-selections fok apt-get install usrmerge -y cat << "EOF" > /etc/apt/sources.list deb http://deb.debian.org/debian sid main contrib non-free deb [arch=armhf signed-by=/usr/share/keyrings/rcn-ee-archive-keyring.gpg] http://repos.rcn-ee.com/debian/ sid main EOF fok apt-get update echo "updating to debian sid..." apt-get dist-upgrade -y echo "removing noisy banners..." rm -f /etc/motd /etc/issue /etc/issue.net /etc/dogtag echo "install newer linux kernel..." fok apt-get install -y linux-image-$KERNEL_VERSION linux-headers-$KERNEL_VERSION echo "install based software..." fok apt-get install -y neovim zsh git systemd-resolved fok chsh -s /bin/zsh $USER_NAME fok chsh -s /bin/zsh root cp /etc/zsh/newuser.zshrc.recommended "/home/$USER_NAME/.zshrc" chown "$USER_NAME:$USER_NAME" "/home/$USER_NAME/.zshrc" cat << "EOF" > /root/.zshrc # Set up the prompt autoload -Uz promptinit promptinit prompt redhat setopt histignorealldups sharehistory # Use emacs keybindings even if our EDITOR is set to vi bindkey -e # Keep 1000 lines of history within the shell and save it to ~/.zsh_history: HISTSIZE=1000 SAVEHIST=1000 HISTFILE=~/.zsh_history # Use modern completion system autoload -Uz compinit compinit zstyle ':completion:*' auto-description 'specify: %d' zstyle ':completion:*' completer _expand _complete _correct _approximate zstyle ':completion:*' format 'Completing %d' zstyle ':completion:*' group-name '' zstyle ':completion:*' menu select=2 zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*' zstyle ':completion:*' menu select=long zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s zstyle ':completion:*' use-compctl false zstyle ':completion:*' verbose true zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd' EOF echo "emulate sh -c 'source /etc/profile'" >> /etc/zsh/zprofile echo "cleaning up trash..." fok apt clean -y echo "all done!"