#!/bin/sh ############# Packages to install ######################################## macos_homebrew_essentials="python3 vim-nox tmux nano zsh git autossh mosh sshuttle lynx npm tidy mcfly ack ncdu shfmt" macos_homebrew_other_apps="calibre" raspberrypi_essentials="python3 python3-pip vim-nox python3-venv tmux nano zsh git htop ncdu autossh mosh sshuttle fail2ban avahi-daemon ufw lynx npm ssmtp apticron tidy nmon software-properties-common ack restic unrar cmake" raspberrypi_printer="cups printer-driver-gutenprint" raspberrypi_camera="python3-opencv" ############# Packages install functions ################################# install_python_linters() { pip3 install requests bs4 prospector black isort --break-system-packages } install_npm_linters() { sudo npm install -g jsonlint sudo npm install -g fixjson } ############# MacOS exclusive commands ################################### # Install homebrew system_type=$(uname -s) if [ "$system_type" = "Darwin" ]; then # install homebrew if it's missing if ! command -v brew >/dev/null 2>&1; then echo "Install homebrew? (y/n)" read -r install_homebrew if [ $install_homebrew = "y" ]; then echo "Installing homebrew" /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" fi fi fi ############# Raspberrypi exclusive commands ############################# if [ "$system_type" = "Linux" ]; then install_this_now="" echo "Install the most important packages ($raspberrypi_essentials)? (y/n)" read -r install_raspberrypi_essentials if [ $install_raspberrypi_essentials = "y" ]; then install_this_now="$install_this_now $raspberrypi_essentials" fi echo "Install the packages for printing? (y/n)" read -r install_raspberrypi_printer if [ $install_raspberrypi_printer = "y" ]; then install_this_now="$install_this_now $raspberrypi_printer" fi echo "Install the packages for the camera? (y/n)" read -r install_raspberrypi_camera if [ $install_raspberrypi_camera = "y" ]; then install_this_now="$install_this_now $raspberrypi_camera" fi if [ -n "$install_this_now" ]; then echo "Packages will be installed now!" sudo apt update for i in $install_this_now; do sudo apt-get install -y $i done fi fi if command -v ufw >/dev/null 2>&1; then echo "Enable the firewall (ufw with ssh allowed)? (y/n)" read -r enable_ufw if [ $enable_ufw = "y" ]; then ufw allow ssh ufw enable fi fi ############# Commands for both ########################################## if command -v /bin/zsh >/dev/null 2>&1; then echo "Set zsh as default shell? (y/n)" read -r set_default_shell if [ $set_default_shell = "y" ]; then chsh -s /bin/zsh fi fi echo "Install all linters for vim? (y/n)" read -r install_linters if [ $install_linters = "y" ]; then install_npm_linters install_python_linters fi echo "Install the vim plugins now? (y/n)" read -r install_vim_plugins if [ $install_vim_plugins = "y" ]; then vim +'PlugInstall --sync' +qa fi