Add support for different OS package managers; simplify some logic

This commit is contained in:
david 2025-04-04 16:55:39 -05:00
parent 0ee149f9d8
commit fc189d33d3
15 changed files with 42 additions and 42 deletions

View File

@ -17,9 +17,7 @@ while [[ $# > 0 ]]; do
shift
done
local script_dir=$(cd $(dirname "${ZSH_SOURCE[0]}") &> /dev/null && pwd)
log "install_programs // script_dir: $script_dir -- args: $single_script_filter"
cd $script_dir
log "install_programs // single_script_filter: $single_script_filter"
local scripts=(`find ./installs_and_builds -maxdepth 1 -mindepth 1 -type f`)
for script in $scripts; do
if [[ -x $script ]]; then

View File

@ -1,2 +1,2 @@
#!/bin/zsh
brew install fzf
${=BOX_SETUP_INSTALL_COMMAND} fzf

View File

@ -1,2 +1,2 @@
#!/bin/zsh
brew install git
${=BOX_SETUP_INSTALL_COMMAND} git

View File

@ -3,4 +3,4 @@
local lua_package="lua5.1"
[[ "$BOX_SETUP_OS" = "macos" ]] && lua_package="lua@5.1"
$BOX_SETUP_INSTALL_COMMAND cmake gettext "$lua_package" liblua5.1-0-dev
${=BOX_SETUP_INSTALL_COMMAND} cmake gettext "$lua_package" liblua5.1-0-dev

View File

@ -1,3 +1,3 @@
#!/bin/zsh
brew install neovim
${=BOX_SETUP_INSTALL_COMMAND} neovim

View File

@ -9,7 +9,6 @@
# git -C $neovim_dir fetch --all
# git -C $neovim_dir checkout $neovim_version
#
#
# make -C $neovim_dir clean
# make -C $neovim_dir CMAKE_BUILD_TYPE=RelWithDebInfo
# sudo make -C $neovim_dir install

View File

@ -1,2 +1,2 @@
#!/bin/zsh
brew install tmux
${=BOX_SETUP_INSTALL_COMMAND} tmux

View File

@ -2,4 +2,4 @@
# likely on unix systems already: find xargs grep sed awk
brew install jq parallel
${=BOX_SETUP_INSTALL_COMMAND} jq parallel

7
make_config_dirs Executable file
View File

@ -0,0 +1,7 @@
#!/bin/zsh
[[ ! -d $HOME/.config ]] && mkdir $HOME/.config
[[ ! -d $HOME/.local ]] && mkdir $HOME/.local
[[ ! -d $HOME/.local/bin ]] && mkdir $HOME/.local/bin
[[ ! -d $HOME/.local/build ]] && mkdir $HOME/.local/build
[[ ! -d $HOME/.local/tmp ]] && mkdir $HOME/.local/tmp

4
make_desired_dirs Executable file
View File

@ -0,0 +1,4 @@
#!/bin/zsh
[[ ! -d $HOMEBOX ]] && mkdir $HOMEBOX
[[ ! -d $DEVDIR ]] && mkdir $DEVDIR

View File

@ -1,8 +0,0 @@
#!/bin/zsh
mkdirs_after_setting_shell_env_vars() {
[[ ! -d $HOMEBOX ]] && mkdir $HOMEBOX
[[ ! -d $DEVDIR ]] && mkdir $DEVDIR
}
mkdirs_after_setting_shell_env_vars

View File

@ -1,22 +0,0 @@
#!/bin/zsh
mkdirs_before_copying_config_files() {
[[ ! -d $HOME/.config ]] && mkdir $HOME/.config
[[ ! -d $HOME/.local ]] && mkdir $HOME/.local
[[ ! -d $HOME/.local/bin ]] && mkdir $HOME/.local/bin
[[ ! -d $HOME/.local/build ]] && mkdir $HOME/.local/build
[[ ! -d $HOME/.local/tmp ]] && mkdir $HOME/.local/tmp
}
[[ -z $BOX_SETUP_OS ]] && echo "BOX_SETUP_OS must be set" && exit 1
local install_cmd=''
case $BOX_SETUP_OS in
(arch | artix) install_cmd="sudo pacman -S" ;;
(debian) export install_cmd="sudo apt install" ;;
(macos) export install_cmd="brew install" ;;
esac
export BOX_SETUP_INSTALL_COMMAND="$install_cmd"
mkdirs_before_copying_config_files

9
set_env_vars Normal file
View File

@ -0,0 +1,9 @@
[[ -z $BOX_SETUP_OS ]] && echo "BOX_SETUP_OS must be set" && exit 1
local install_cmd=''
case $BOX_SETUP_OS in
(arch | artix) install_cmd="sudo pacman -S" ;;
(debian) export install_cmd="sudo apt install" ;;
(macos) export install_cmd="brew install" ;;
esac
export BOX_SETUP_INSTALL_COMMAND="$install_cmd"

7
setup_this_box Executable file
View File

@ -0,0 +1,7 @@
#!/bin/zsh
source set_env_vars
./install_programs
./make_config_dirs
./copy_configs
./make_desired_dirs

View File

@ -1,5 +1,3 @@
#!/bin/zsh
local omitted_dirs=(
$HOME
$HOMEBOX
@ -13,3 +11,11 @@ local omitted_dirs=(
clear
## example template for custom override
# tmux new-window -d -n cmd
# tmux send-keys -t :cmd "echo 'in cmd'" c-M
# tmux new-window -d -n another
# tmux send-keys -t :another "echo 'in another'" c-M
# tmux rename-window $EDITOR
# $EDITOR .
# clear