You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
711 B
Bash

4 months ago
#!/bin/bash
required_progs=('zsh' 'vim' 'xxd' 'dig' 'curl' 'wezterm')
files_to_link=('.vimrc' '.zsh' '.zshrc' '.wezterm' '.wezterm.lua')
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
check_and_backup() {
filepath="$1"
if [[ -f "$filepath" ]]; then
echo "Found existing $filepath, will backup to ~/shell_backup/$filepath"
mkdir -p ~/shell_backup/
cp "$filepath" ~/shell_backup/
fi
}
for prog in "${required_progs[@]}" ; do
if ! command -v "$prog" > /dev/null ; then
echo "WARN: $prog not installed or not in PATH."
fi
done
for file in "${files_to_link[@]}"; do
check_and_backup "$HOME/$file"
echo "ln -s $SCRIPT_DIR/$file $HOME/$file"
done