#!/bin/zsh [[ $1 = "--help" ]] && { echo "\nusage: ./box_setup.sh [system-type]" echo "\nsystem-type options: music_studio, programming" echo "\nexamples:\n ./box_setup.sh\n ./box_setup.sh music_studio\n" exit 0 } echo "---- settings vars for system type -----" # determine OS and distro case "$OSTYPE" in (*linux*) setup_os="linux" [[ -f /etc/os-release ]] && . /etc/os-release setup_distro=$(echo "${NAME%% *}" | tr '[:upper:]' '[:lower:]') ;; (*darwin*) setup_os="macos" setup_distro="macos" # just repeat macos, but maybe there is some better value ;; esac # ensure OS and distro are set before proceeding [[ -z "$setup_os" ]] && echo "setup OS not detected" && exit 1 [[ -z "$setup_distro" ]] && echo "setup distro not detected" && exit 1 # set package manager commands for installs case "$setup_os" in (linux) case $setup_distro in (arch | artix) install_cmd="sudo pacman -S --noconfirm" update_pkg_manager_and_defs_cmd='' # don't; update system instead update_pkgs_cmd='sudo pacman -Syu' ;; (debian) install_cmd="sudo apt install" update_pkg_manager_and_defs_cmd='sudo apt update' update_pkgs_cmd='sudo apt upgrade' ;; esac ;; (macos) install_cmd="brew install" update_pkg_manager_and_defs_cmd='brew update' update_pkgs_cmd='brew upgrade' ;; esac # export vars for scripts export BOX_SETUP_OS="$setup_os" export BOX_SETUP_DISTRO="$setup_distro" export BOX_SETUP_INSTALL_COMMAND="$install_cmd" export BOX_SETUP_UPDATE_PKG_MANAGER_AND_DEFS_CMD="$update_pkg_manager_and_defs_cmd" export BOX_SETUP_UPDATE_PKGS_CMD="$update_pkgs_cmd" # make dirs and copy configs/dotfiles . ./src_files/shell/profile ./make_dirs.sh ./copy_dotfiles.sh "--skip-theme-config" # install programs . $ZDOTDIR/.zshrc ./install_programs.sh $1 # configure themes ./theme_config.sh