71 lines
1.3 KiB
Bash
Executable file
71 lines
1.3 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
# Check for Git
|
|
if ! command -v git &> /dev/null; then
|
|
echo "Git is not installed. Aborting." >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Make sure we have pulled in and updated any submodules
|
|
git submodule init
|
|
git submodule update
|
|
|
|
# What directories should be installable by all users including the root user
|
|
base=(
|
|
zsh
|
|
vim # Added vim to the base directories
|
|
nvim
|
|
tmux
|
|
)
|
|
|
|
# Folders that should, or only need to be installed for a local user
|
|
useronly=(
|
|
git
|
|
skhd
|
|
yabai
|
|
conda
|
|
dask
|
|
gh
|
|
jupyter
|
|
parallel
|
|
tox
|
|
)
|
|
|
|
# Files to ignore during stow
|
|
ignore_files=(
|
|
".DS_Store"
|
|
"__setup"
|
|
"bin"
|
|
"git"
|
|
"setup.sh"
|
|
)
|
|
|
|
# Function to run the stow command for the passed-in directory ($2) in location $1
|
|
stowit() {
|
|
usr=$1
|
|
app=$2
|
|
# -v verbose
|
|
# -R recursive
|
|
# -t target
|
|
# --ignore files to ignore
|
|
stow -v -R -t "${usr}" --ignore "$(IFS="|"; echo "${ignore_files[*]}")" "${app}"
|
|
}
|
|
|
|
echo ""
|
|
echo "Stowing apps for user: ${USER}"
|
|
|
|
# Install apps available to local users and root
|
|
for app in "${base[@]}"; do
|
|
stowit "${HOME}" "${app}"
|
|
done
|
|
|
|
# Install only user space folders
|
|
for app in "${useronly[@]}"; do
|
|
if [[ ! "$(whoami)" = "root" ]]; then
|
|
stowit "${HOME}" "${app}"
|
|
fi
|
|
done
|
|
|
|
echo ""
|
|
echo "##### ALL DONE"
|
|
|