Consolidate some scripts; simplify unneeded logic; take OS as arg
This commit is contained in:
43
box_setup
43
box_setup
@@ -1,9 +1,42 @@
|
||||
#!/bin/zsh
|
||||
|
||||
source set_script_env_vars
|
||||
[[ -z $1 ]] &&
|
||||
echo "OS must be passed as an arg (options: arch, artix, debian, macos)" &&
|
||||
echo "example: ./box_setup arch" &&
|
||||
exit 1
|
||||
|
||||
# set env vars for installs
|
||||
local install_cmd=''
|
||||
local update_pkg_manager_and_defs_cmd=''
|
||||
local update_pkgs_cmd=''
|
||||
case $1 in
|
||||
(arch | artix)
|
||||
install_cmd="sudo pacman -S"
|
||||
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'
|
||||
;;
|
||||
(macos)
|
||||
install_cmd="brew install"
|
||||
update_pkg_manager_and_defs_cmd='brew update'
|
||||
update_pkgs_cmd='brew upgrade'
|
||||
;;
|
||||
esac
|
||||
|
||||
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
|
||||
source ./src_files/.config/zsh/.zshenv
|
||||
./make_config_dirs
|
||||
./make_dirs
|
||||
./copy_configs
|
||||
source $ZDOTDIR/.zshenv ; source $ZDOTDIR/.zshrc
|
||||
./make_org_structure_dirs
|
||||
./install_programs # TODO: do installs overwrite configs? if so, fix; worst case, re-copy
|
||||
|
||||
# install programs
|
||||
source $ZDOTDIR/.zshenv
|
||||
source $ZDOTDIR/.zshrc
|
||||
./install_programs
|
||||
|
Reference in New Issue
Block a user