Replace most install scripts with list in csv file

This commit is contained in:
2025-11-07 14:43:33 -06:00
parent f4baf50cf1
commit f98658f02b
31 changed files with 80 additions and 191 deletions

View File

@@ -24,6 +24,10 @@
- complete manual actions specified in [ref/post-run](ref/post-run.md)
## todo items
see [ref/todo.md](ref/todo.md)
## attribution
### Original pattern/approach and some key config logic
@@ -44,6 +48,10 @@ wanted to give attribution nonetheless.
Author: ThePrimeagen (Michael Paulson)
### Idea of using a list of programs in a file for build/install
The idea of using a file with a list of programs in it to build and/or install was inspired by Luke Smith's [LARBS project](https://github.com/LukeSmithxyz/LARBS/tree/master).
### Some themes and theme-swtiching/setting logic
The theme configuration files in this repository under

View File

@@ -1,34 +1,41 @@
#!/bin/zsh
find_scripts_in_dir() {
echo $(find $1 -maxdepth 1 -mindepth 1 -type f | sort)
}
install_scripts_from_list() {
for script in $@; do
if [[ -x $script ]]; then
echo "executing: $script"
./$script
fi
apply_overrides() {
echo $3 |
sed -E 's/; */\n/g' |
while IFS=$'\n ' read -r override_key override_values; do
[[ -z $override_values ]] && continue
override_key=$(echo $override_key | sed 's/[: ]//g')
[[ $override_key = $BOX_SETUP_OS ]] && eval $override_values
[[ $override_key = $BOX_SETUP_DISTRO ]] && eval $override_values
[[ $4 =~ $override_key ]] && eval $override_values
done
[[ -z $name || -z $kind ]] && echo "zz_skip,zz_skip" || echo "$name,$kind"
}
system_types_list="base"
scripts_from_dir=($(find_scripts_in_dir "./installs_and_builds"))
[[ $1 = "personal" ]] && {
system_types_list+=", personal"
scripts_from_dir+=($(find_scripts_in_dir "./installs_and_builds/personal"))
}
[[ $1 = "studio-music" ]] && {
system_types_list+=", studio-music"
scripts_from_dir+=($(find_scripts_in_dir "./installs_and_builds/studio_music"))
}
[[ $1 = "work-placeholder" ]] && {
system_types_list+=", work-placeholder"
scripts_from_dir+=($(find_scripts_in_dir "./installs_and_builds/work_placeholder"))
}
echo "---- updating package manager / packages"
[[ -n "$BOX_SETUP_UPDATE_PKG_MANAGER_AND_DEFS_CMD" ]] &&
${=BOX_SETUP_UPDATE_PKG_MANAGER_AND_DEFS_CMD}
[[ -n "$BOX_SETUP_UPDATE_PKGS_CMD" ]] && ${=BOX_SETUP_UPDATE_PKGS_CMD}
echo "---- installing programs ---------------"
[[ -z $1 ]] && system_types_list="base" || system_types_list="base,$1"
echo "-------- for system types: $system_types_list"
install_scripts_from_list "${scripts_from_dir[@]}"
sed 1d "installs_and_builds/programs.csv" |
while IFS=, read -r name kind os_overrides distro_overrides system_overrides notes; do
apply_overrides $name $kind $os_overrides '' | IFS=, read -r name kind
apply_overrides $name $kind $distro_overrides '' | IFS=, read -r name kind
apply_overrides $name $kind $system_overrides $system_types_list |
IFS=, read -r name kind
[[ $name = 'zz_skip' || $kind = 'zz_skip' ]] && continue
[[ $kind = 'package_manager' ]] && ${=BOX_SETUP_INSTALL_COMMAND} ${=name} || {
[[ $kind = 'build_custom' ]] && {
target=$(echo "custom_$BOX_SETUP_OS-$BOX_SETUP_DISTRO-$name" | tr '-' '_')
"./installs_and_builds/$target"
}
}
done

View File

@@ -0,0 +1,2 @@
echo 'hello from bitwig custom build!'
echo 'custom script for bitwig is not yet implemented, these echos just here for testing'

View File

@@ -0,0 +1,36 @@
name,kind,os_overrides,distro_overrides,system_type_overrides,notes
mpv,package_manager,,,,
zsh,package_manager,,,,
mutt,package_manager,,,,
docker,package_manager,,,,may need special logic for debian https://docs.docker.com/engine/install/debian/
curl,package_manager,,,,
grep,package_manager,,,,
ripgrep,package_manager,,,,
sed,package_manager,macos: name='',,,
fzf,package_manager,,,,
jq,package_manager,,,,
parallel,package_manager,,,,
make,package_manager,,,,
cmake,package_manager,,,,
gettext,package_manager,,,,
htop,package_manager,,,,
neovim,package_manager,,,,
mpd,package_manager,,,,
ncmpcpp,package_manager,,,,
ffmpeg,package_manager,,,work: name='',
git,package_manager,,,,
tmux,package_manager,,,,
khal,package_manager,,,,
zathura,package_manager,macos: name='',,,
gcc,package_manager,macos: name='',,,
g++,package_manager,macos: name='',,,
clang,package_manager,macos: name='',,,
clang++,package_manager,macos: name='',,,
tenacity,package_manager,macos: name='--cask audacity',,work: name='',tenacity not available via homebrew; use audacity in macos
bitwig-studio,package_manager,macos: name='--cask bitwig-studio',artix: kind='aur'; arch: kind='aur'; alpine: kind='build_custom'; debian: kind='build_custom';,work: name='',
kitty,package_manager,macos: name='--cask kitty',,,
gimp,package_manager,macos: name='--cask gimp',,,
coreutils,package_manager,linux: name='',,,
findutils,package_manager,linux: name='',,,
--cask nikitabobko/tap/aerospace,package_manager,linux: name='',,,
pandoc,package_manager,,arch: name='pandoc-cli'; artix: name='pandoc-bin'; alpine: name='pandoc-cli';,work: name='',
1 name kind os_overrides distro_overrides system_type_overrides notes
2 mpv package_manager
3 zsh package_manager
4 mutt package_manager
5 docker package_manager may need special logic for debian https://docs.docker.com/engine/install/debian/
6 curl package_manager
7 grep package_manager
8 ripgrep package_manager
9 sed package_manager macos: name=''
10 fzf package_manager
11 jq package_manager
12 parallel package_manager
13 make package_manager
14 cmake package_manager
15 gettext package_manager
16 htop package_manager
17 neovim package_manager
18 mpd package_manager
19 ncmpcpp package_manager
20 ffmpeg package_manager work: name=''
21 git package_manager
22 tmux package_manager
23 khal package_manager
24 zathura package_manager macos: name=''
25 gcc package_manager macos: name=''
26 g++ package_manager macos: name=''
27 clang package_manager macos: name=''
28 clang++ package_manager macos: name=''
29 tenacity package_manager macos: name='--cask audacity' work: name='' tenacity not available via homebrew; use audacity in macos
30 bitwig-studio package_manager macos: name='--cask bitwig-studio' artix: kind='aur'; arch: kind='aur'; alpine: kind='build_custom'; debian: kind='build_custom'; work: name=''
31 kitty package_manager macos: name='--cask kitty'
32 gimp package_manager macos: name='--cask gimp'
33 coreutils package_manager linux: name=''
34 findutils package_manager linux: name=''
35 --cask nikitabobko/tap/aerospace package_manager linux: name=''
36 pandoc package_manager arch: name='pandoc-cli'; artix: name='pandoc-bin'; alpine: name='pandoc-cli'; work: name=''

View File

@@ -1,8 +0,0 @@
#!/bin/zsh
[[ -n "$BOX_SETUP_UPDATE_PKG_MANAGER_AND_DEFS_CMD" ]] &&
${=BOX_SETUP_UPDATE_PKG_MANAGER_AND_DEFS_CMD}
[[ -n "$BOX_SETUP_UPDATE_PKGS_CMD" ]] &&
${=BOX_SETUP_UPDATE_PKGS_CMD}

View File

@@ -1,3 +0,0 @@
#!/bin/zsh
# ${=BOX_SETUP_INSTALL_COMMAND} zxcv_placeholder

View File

@@ -1,29 +0,0 @@
#!/bin/zsh
# likely on unix systems already: find, xargs, awk? (maybe get alternative like nawk?)
${=BOX_SETUP_INSTALL_COMMAND} \
curl \
grep \
ripgrep \
sed \
fzf \
jq \
parallel \
make \
cmake \
gettext \
htop
utils_package_name_pandoc="pandoc"
case $BOX_SETUP_DISTRO in
(arch | alpine)
utils_package_name_pandoc="pandoc-cli"
;;
(artix)
utils_package_name_pandoc="pandoc-bin"
;;
esac
${=BOX_SETUP_INSTALL_COMMAND} $utils_package_name_pandoc
[[ "$BOX_SETUP_OS" = "macos" ]] &&
${=BOX_SETUP_INSTALL_COMMAND} coreutils findutils

View File

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

View File

@@ -1,6 +0,0 @@
#!/bin/zsh
install_option_prefix=''
[[ "$BOX_SETUP_OS" = "macos" ]] && install_option_prefix='--cask'
# NOTE: ghostty not currently in debian repos, maybe build from source
${=BOX_SETUP_INSTALL_COMMAND} "$install_option_prefix" ghostty

View File

@@ -1,3 +0,0 @@
#!/bin/zsh
${=BOX_SETUP_INSTALL_COMMAND} tmux

View File

@@ -1,12 +0,0 @@
#!/bin/zsh
linux_wm_and_utils() {
# TODO: pick wm for linux; options: dwm, i3, others?
echo "TODO: linux_wm_and_utils not yet implemented"
}
macos_wm_and_utils() {
brew install --cask nikitabobko/tap/aerospace
}
[[ "$BOX_SETUP_OS" = "macos" ]] && macos_wm_and_utils || linux_wm_and_utils

View File

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

View File

@@ -1,3 +0,0 @@
#!/bin/zsh
${=BOX_SETUP_INSTALL_COMMAND} mutt

View File

@@ -1,3 +0,0 @@
#!/bin/zsh
${=BOX_SETUP_INSTALL_COMMAND} khal

View File

@@ -1,10 +0,0 @@
#!/bin/zsh
# TODO: get browser config and install set up
# current idea: qutebrowser for general, tor for sensitive, brave as a backup option
# install_option_prefix=''
# [[ "$BOX_SETUP_OS" = "macos" ]] && install_option_prefix='--cask'
# firefox_package_name='firefox'
# [[ "$BOX_SETUP_DISTRO" = "debian" ]] && firefox_package_name='firefox-esr'
# ${=BOX_SETUP_INSTALL_COMMAND} "$install_option_prefix" "$firefox_package_name"

View File

@@ -1,4 +0,0 @@
#!/bin/zsh
# TODO: pick rss reader; newsboat? others? option with inbox and separate queues?
# ${=BOX_SETUP_INSTALL_COMMAND} zxcv-placeholder

View File

@@ -1,9 +0,0 @@
#!/bin/zsh
# local music
${=BOX_SETUP_INSTALL_COMMAND} mpd mpc ncmpcpp
# possible mpd clients to consider: ncmpc, inori
# spotify
# TODO: decide if i want to use the package-manager install below, or build from source
# ${=BOX_SETUP_INSTALL_COMMAND} ncspot

View File

@@ -1,3 +0,0 @@
#!/bin/zsh
${=BOX_SETUP_INSTALL_COMMAND} mpv

View File

@@ -1,4 +0,0 @@
#!/bin/zsh
[[ "$BOX_SETUP_OS" = "macos" ]] && exit 0 # TODO: maybe find an option for macos
${=BOX_SETUP_INSTALL_COMMAND} nsxiv

View File

@@ -1,4 +0,0 @@
#!/bin/zsh
[[ "$BOX_SETUP_OS" = "macos" ]] && exit 0 # TODO: maybe find an option for macos
${=BOX_SETUP_INSTALL_COMMAND} zathura

View File

@@ -1,4 +0,0 @@
#!/bin/zsh
# TODO: do i even want a filemanager? if yes, pick one; consider: lf, ranger, others?
# ${=BOX_SETUP_INSTALL_COMMAND} zxcv-placeholder

View File

@@ -1,6 +0,0 @@
#!/bin/zsh
# only audio editor(s) in this file; daws are handled separately
install_option_prefix=''
[[ "$BOX_SETUP_OS" = "macos" ]] && install_option_prefix='--cask'
${=BOX_SETUP_INSTALL_COMMAND} "$install_option_prefix" audacity

View File

@@ -1,4 +0,0 @@
#!/bin/zsh
# TODO: set this up; likely using ffmpeg (work on macos?), maybe others
# ${=BOX_SETUP_INSTALL_COMMAND} zxcv-placeholder

View File

@@ -1,7 +0,0 @@
#!/bin/zsh
install_option_prefix=''
[[ "$BOX_SETUP_OS" = "macos" ]] && install_option_prefix='--cask'
${=BOX_SETUP_INSTALL_COMMAND} "$install_option_prefix" gimp
# ${=BOX_SETUP_INSTALL_COMMAND} imagemagick # TODO: consider this program too

View File

@@ -1,3 +0,0 @@
#!/bin/zsh
${=BOX_SETUP_INSTALL_COMMAND} git

View File

@@ -1,13 +0,0 @@
#!/bin/zsh
setup_docker_on_debian() {
# refer to https://docs.docker.com/engine/install/debian/
# build this function based on that
# in that, could use BOX_SETUP_INSTALL_COMMAND or just apt install
echo "setup_docker_on_debian function not implemented"
}
# TODO: decide on docker vs others
[[ "$BOX_SETUP_DISTRO" = "debian" ]] && setup_docker_on_debian || {
${=BOX_SETUP_INSTALL_COMMAND} docker
}

View File

@@ -1,13 +0,0 @@
#!/bin/zsh
[[ "$BOX_SETUP_OS" != "macos" ]] && {
${=BOX_SETUP_INSTALL_COMMAND} gcc g++ clang clang++
}
# TODO: review and decide if the things below are needed
# install_lua_package="lua5.1"
#[[ "$BOX_SETUP_OS" = "macos" ]] && install_lua_package="lua@5.1"
#${=BOX_SETUP_INSTALL_COMMAND} "$install_lua_package" liblua5.1-0-dev
# TODO: do i want to install luarocks? lazy.nvim plugin manager currently expects it
#luarocks install luacheck

View File

@@ -2,7 +2,7 @@
- config for: terminal (kitty? havoc?)
- config for shell (if keeping zsh, may not need anything beyond what i've already done)
- config for mpd, mpc, ncmpcpp
- config for mpd, and client(s), (mpd clients to consider: mpc, ncmpcpp, ncmpc, inori)
- config for mpv (if any, may not need anything)
- hyprland config and install on linux
- web browsers config and install
@@ -11,11 +11,4 @@
- pick rss reader; newsboat? others? option with inbox and separate queues?
- decide if i even want a filemanager; if yes, pick one and configure
- decide what i'm doing for music streaming; spotify official? web? tui option?
- switch installation approach, use csv file with programs to install, install types,
any extra flags/opts, comments
- regarding the system-types idea i'd started to build in already, maybe have a
column for filtering in the csv file, or just have multiple csv files corresponding
to a base/core install, a music-studio install, a employer/work machine, etc.
- alternate idea: columns for "include_in_systems" and/or "excluded_from_systems"
- if both, likely apply the include column first, then the exclude (priority)