From 38f5bb7f9ccddfb0ec43425b46378de81ac0c890 Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Thu, 10 Oct 2024 18:16:58 +0100 Subject: [PATCH] Make install.sh work on base 3.2 (for macOS) --- install.sh | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/install.sh b/install.sh index 8917dc2..a02bf20 100755 --- a/install.sh +++ b/install.sh @@ -5,28 +5,11 @@ if [ ! -d $HOME/.local/share/tmux/layouts ]; then echo changed created layouts directory fi -declare -A symlinks=( - [$HOME/.config/tmux/tmux.conf]=$HOME/.tmux.conf -) - -layouts=( - session-config - session-infra - session-main - session-visor - window-auto - window-tall - window-wide-left - window-wide-right -) -for layout in ${layouts[@]}; do - symlinks[$HOME/.config/tmux/layouts/$layout]=$HOME/.local/share/tmux/layouts/$layout -done - -for source in ${!symlinks[@]}; do - dest=${symlinks[${source}]} +symlink() { + local source=$1 + local dest=$2 if [ -L $dest ]; then - target=`readlink $dest` + local target=`readlink $dest` if [ "$target" != "$source" ]; then rm $dest ln -s $source $dest @@ -38,4 +21,23 @@ for source in ${!symlinks[@]}; do ln -s $source $dest echo changed created symlink $dest fi -done +} + +symlink $HOME/.config/tmux/tmux.conf \ + $HOME/.tmux.conf +symlink $HOME/.config/tmux/layouts/session-config \ + $HOME/.local/share/tmux/layouts/session-config +symlink $HOME/.config/tmux/layouts/session-infra \ + $HOME/.local/share/tmux/layouts/session-infra +symlink $HOME/.config/tmux/layouts/session-main \ + $HOME/.local/share/tmux/layouts/session-main +symlink $HOME/.config/tmux/layouts/session-visor \ + $HOME/.local/share/tmux/layouts/session-visor +symlink $HOME/.config/tmux/layouts/window-auto \ + $HOME/.local/share/tmux/layouts/window-auto +symlink $HOME/.config/tmux/layouts/window-tall \ + $HOME/.local/share/tmux/layouts/window-tall +symlink $HOME/.config/tmux/layouts/window-wide-left \ + $HOME/.local/share/tmux/layouts/window-wide-left +symlink $HOME/.config/tmux/layouts/window-wide-right \ + $HOME/.local/share/tmux/layouts/window-wide-right