diff --git a/README.md b/README.md index 92920e3..1c69217 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,25 @@ -# dotfiles plus scripts to copy them and also install stuff +# dotfiles, plus scripts for box setup -### script run -- fulfill prerequisites below -- git clone this repo -- from the repo's root directory, run `./box_setup ` +### instructions +- fulfill prerequisites (see below) +- script run options: + - if repo present on system, run from the repo's root: + - ``` + ./box_setup.sh + ``` + - if repo not present, run: + - ``` + curl -LO https://git.drinkingtea.net/david/box-setup/src/branch/master/box_setup.sh + sh box_setup.sh + ``` + - then delete the script file afterwards (repo should have been copied to dev dir) ### prerequisites -- package manager is configured (i.e. source repos, mirrors, etc. configured) - zsh is installed (scripts are written for zsh) -- sudo access is configured for current user (as of 2025-01-27, not needed on macos) - system-specific items below are fulfilled -##### prereqs, os specific, linux-placeholder -- (currently none) +##### prereqs, os specific, linux distros +- sudo access is configured for current user ##### prereqs, os specific, macos - install the package manager, [homebrew](https://brew.sh/) @@ -28,7 +35,6 @@ - `show files on desktop`: enabled ### todo items -- add logic to the main run script to handle cloning of this repo - config for window manager for linux (first, decide which wm to use) - config for terminal emulator (currently ghostty) - config for mpd, mpc, ncmpcpp @@ -36,8 +42,6 @@ - config for gimp, `src_files/.config/GIMP` (dir) - set things in gtkrc only? still need to nest that within a sub dir? - or configure in gimp, copy resulting dir to `src_files/.config/GIMP`, call it a day -- maybe build in flags/logic for skipping certain installs/builds (and maybe configs?) - on a given system (i.e. don't install on a company box, on a server, etc.) - decide on and implement approach for languages and versioning - asdf, or language-specific version managers? - docker? or alternatives like podman? any license concerns? diff --git a/box_setup b/box_setup.sh similarity index 51% rename from box_setup rename to box_setup.sh index b6f7c55..f1015a4 100755 --- a/box_setup +++ b/box_setup.sh @@ -1,9 +1,29 @@ #!/bin/zsh -[[ -z $1 ]] && - echo "OS must be passed as an arg (options: arch, artix, debian, macos)" && - echo "example: ./box_setup arch" && +[[ -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 [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 +local 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 local install_cmd='' @@ -33,10 +53,15 @@ export BOX_SETUP_UPDATE_PKGS_CMD="$update_pkgs_cmd" # make dirs and copy configs/dotfiles source ./src_files/.config/zsh/.zshenv -./make_dirs -./copy_configs +./make_dirs.sh +./copy_configs.sh $2 # install programs source $ZDOTDIR/.zshenv source $ZDOTDIR/.zshrc -./install_programs +./install_programs.sh $2 + +[[ $temp_placement_git_dir == "yes" ]] && { + popd > /dev/null + mv "box-setup" "$DIR_GIT/me/" +} diff --git a/copy_configs b/copy_configs.sh similarity index 83% rename from copy_configs rename to copy_configs.sh index c997961..438391d 100755 --- a/copy_configs +++ b/copy_configs.sh @@ -35,7 +35,7 @@ link_dir() { ln -s $src_dir $link_dir } -echo "---- copying dotfiles -------------------------" +echo "---- copying dotfiles ------------------------------------------------" copy_file src_files/.config/zsh/.zshenv $HOME # duplicate, copy anyway, ensures $ZDOTDIR @@ -43,8 +43,12 @@ copy_dir src_files/.config $XDG_CONFIG_HOME copy_dir src_files/.local/bin $DIR_BIN copy_dir src_files/.local/scripts $DIR_SCRIPTS -[[ "$BOX_SETUP_OS" = "macos" ]] && - # link_dir "$XDG_CONFIG_HOME/REAPER" "$HOME/Library/Application Support/REAPER" && # TODO: get reaper config set up +[[ "$BOX_SETUP_OS" = "macos" ]] && { copy_dir src_files/executable_wrappers_macos $DIR_BIN link_dir "$XDG_CONFIG_HOME/GIMP" "$HOME/Library/Application Support/GIMP" +} + +# [[ $1 = "studio-music" ]] && +# [[ "$BOX_SETUP_OS" = "macos" ]] && +# link_dir "$XDG_CONFIG_HOME/REAPER" "$HOME/Library/Application Support/REAPER" && # TODO: get reaper config set up diff --git a/install_programs b/install_programs deleted file mode 100755 index 60bff91..0000000 --- a/install_programs +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/zsh - -local single_script_filter="" - -while [[ $# > 0 ]]; do - single_script_filter="$1" # if using param, export BOX_SETUP_OS first if needed - shift -done - -echo "---- installing programs ----------------------" - -local scripts=$(find ./installs_and_builds -maxdepth 1 -mindepth 1 -type f | sort) -for script in ${=scripts}; do - if [[ -x $script ]]; then - if echo "$script" | grep -qv "$single_script_filter"; then - continue # $single_script_filter set, ignore others - fi - echo "executing: $script" - ./$script - fi -done - diff --git a/install_programs.sh b/install_programs.sh new file mode 100755 index 0000000..9da83d3 --- /dev/null +++ b/install_programs.sh @@ -0,0 +1,33 @@ +#!/bin/zsh + +install_scripts_from_dir() { + for script in $1; do + if [[ -x $script ]]; then + echo "executing: $script" + ./$script + fi + done +} + +echo "---- installing programs, base ---------------------------------------" +local scripts=$(find ./installs_and_builds -maxdepth 1 -mindepth 1 -type f | sort) +install_scripts_from_dir(${=scripts}) + +[[ $1 = "personal" ]] && { + echo "---- installing programs, personal -----------------------------------" + scripts=$(find ./installs_and_builds/personal -maxdepth 1 -mindepth 1 -type f | sort) + install_scripts_from_dir(${=scripts}) +} + +[[ $1 = "studio-music" ]] && { + echo "---- installing programs, studio-music -------------------------------" + scripts=$(find ./installs_and_builds/studio_music -maxdepth 1 -mindepth 1 -type f | sort) + install_scripts_from_dir(${=scripts}) +} + +[[ $1 = "work-placeholder" ]] && { + echo "---- installing programs, work-placeholder ---------------------------" + scripts=$(find ./installs_and_builds/work_placeholder -maxdepth 1 -mindepth 1 -type f | sort) + install_scripts_from_dir(${=scripts}) +} + diff --git a/installs_and_builds/personal/placeholder-TODO b/installs_and_builds/personal/placeholder-TODO new file mode 100644 index 0000000..e69de29 diff --git a/installs_and_builds/studio_music/placeholder-TODO b/installs_and_builds/studio_music/placeholder-TODO new file mode 100644 index 0000000..e69de29 diff --git a/make_dirs b/make_dirs.sh similarity index 100% rename from make_dirs rename to make_dirs.sh diff --git a/src_files/.config/git/config b/src_files/.config/git/config index 88702b3..6b115bd 100644 --- a/src_files/.config/git/config +++ b/src_files/.config/git/config @@ -2,4 +2,4 @@ defaultBranch = master [user] name = david - email = david@silverwolf.studio + email = placeholder diff --git a/src_files/.config/zsh/.zshenv b/src_files/.config/zsh/.zshenv index 644967d..ac464ed 100644 --- a/src_files/.config/zsh/.zshenv +++ b/src_files/.config/zsh/.zshenv @@ -7,8 +7,8 @@ export DIR_HOME_BOX="$HOME/dbox" export DIR_MUSIC="$DIR_HOME_BOX/media/music" export DIR_DEV="$HOME/dev" export DIR_GIT_PROJECTS="$DIR_DEV/git" -export DIR_SCRATCH_NOTES="$DIR_HOME_BOX/life/scratchpad/notes" -export DIR_SCRATCH_DRAWINGS="$DIR_HOME_BOX/life/scratchpad/drawings" +export DIR_SCRATCH_NOTES="$DIR_HOME_BOX/scratchpad/notes" +export DIR_SCRATCH_DRAWINGS="$DIR_HOME_BOX/scratchpad/drawings" # util dirs; do not change without checking impact on xdg base dirs export DIR_LOCAL="$HOME/.local" diff --git a/src_files/.config/zsh/.zshrc b/src_files/.config/zsh/.zshrc index cb6ca6f..bcf6873 100644 --- a/src_files/.config/zsh/.zshrc +++ b/src_files/.config/zsh/.zshrc @@ -16,9 +16,8 @@ alias nv='nvim' alias n='nvim' alias tms='tmux-session-init' -# executable name overrides +# executable overrides alias ls='ls -F' -alias yt-dlp='yt-dlp --write-info-json' # misc commands alias cal='khal calendar' diff --git a/src_files/.config/zsh/zsh-general-dev b/src_files/.config/zsh/zsh-general-dev index 7d7ec29..2989880 100644 --- a/src_files/.config/zsh/zsh-general-dev +++ b/src_files/.config/zsh/zsh-general-dev @@ -11,7 +11,7 @@ alias gfo='git fetch origin' alias git-push-to-temp='git branch -D temp; git checkout -b temp; git push origin temp -uf; git checkout -' alias gpdev='git-push-to-temp' alias gpo='git pull origin' -git config --global user.email "$EMAIL_PERSONAL_DEV" +git config --global user.email "$EMAIL_PERSONAL_DEV" # TODO: maybe fit this into system-type filters? # code/test/linter run and build commands alias bel='bundle exec standardrb'