68 lines
1.8 KiB
Bash
Executable File
68 lines
1.8 KiB
Bash
Executable File
#!/bin/zsh
|
|
|
|
[[ -z $1 ]] && {
|
|
echo "OS must be passed as an arg, run \`./box_setup.sh --help\` for more info"
|
|
exit 1
|
|
}
|
|
|
|
[[ $1 = "--help" ]] && {
|
|
echo "usage: ./box_setup.sh <OS-name> [system-type]\n"
|
|
echo "OS-name options: arch, artix, debian, macos"
|
|
echo "system-type options: personal, studio-music, work-placeholder\n"
|
|
echo "examples:\n./box_setup.sh arch studio-music\n./box_setup.sh macos\n"
|
|
exit 0
|
|
}
|
|
|
|
|
|
# TODO: test this git stuff, see if it works
|
|
temp_placement_git_dir="no"
|
|
[[ ! -d ".git" && "$(basename $(pwd))" != "box-setup" ]] && {
|
|
temp_placement_git_dir="yes"
|
|
git clone "https://git.drinkingtea.net/david/box-setup.git" || {
|
|
echo "failed to clone box-setup git repo"
|
|
exit 1
|
|
}
|
|
pushd box-setup > /dev/null
|
|
}
|
|
|
|
# set env vars for installs
|
|
install_cmd=''
|
|
update_pkg_manager_and_defs_cmd=''
|
|
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_dirs.sh
|
|
./copy_configs.sh $2
|
|
|
|
# install programs
|
|
source $ZDOTDIR/.zshenv
|
|
source $ZDOTDIR/.zshrc
|
|
./install_programs.sh $2
|
|
|
|
[[ $temp_placement_git_dir == "yes" ]] && {
|
|
popd > /dev/null
|
|
mv "box-setup" "$DIR_GIT_PROJECTS/me/"
|
|
}
|