1
0
dotfiles/install.sh

39 lines
775 B
Bash
Raw Normal View History

2023-08-28 18:30:23 -06:00
#!/bin/sh
2023-09-05 23:09:06 -06:00
set -e
2024-02-28 19:06:49 -07:00
test -n "$DEBUG" && set -x
2023-08-28 18:30:23 -06:00
if test -z "$1"; then
printf "Usage: %s machine\n" "$0" 1>&2
2023-08-28 18:38:46 -06:00
exit 64 # sysexits.h(3) EX_USAGE
2023-08-28 18:30:23 -06:00
fi
case "$1" in
"carnation")
MACHINE="noire-carnation"
;;
"rose")
MACHINE="noire-rose"
;;
esac
for item in "$MACHINE"/config/*
do
2024-02-28 19:06:49 -07:00
name="$(printf "%s\n" "$item" | sed "s;$MACHINE/config/;;g")"
echo $name
printf "Creating symlink from %s to %s\n" \
"$PWD/$item" "$XDG_CONFIG_HOME/$name" 1>&2
if test -n "$DEBUG"; then continue; fi
2023-08-28 18:30:23 -06:00
2024-02-28 19:06:49 -07:00
rm "$XDG_CONFIG_HOME/$name" || true
ln -s "$PWD/$item" "$XDG_CONFIG_HOME/$name"
2023-08-28 18:30:23 -06:00
done
2023-11-19 14:48:04 -07:00
ln -sf "$PWD/$MACHINE/functions" "$HOME/.functions"
2023-08-28 18:30:23 -06:00
ln -sf "$PWD/$MACHINE/profile" "$HOME/.profile"
2023-11-19 14:48:04 -07:00
ln -sf "$PWD/$MACHINE/zprofile" "$HOME/.zprofile"
ln -sf "$PWD/$MACHINE/zshrc" "$HOME/.zshrc"