annotate setup.sh @ 170:95e349996727

Add a script for setting up the shell environment on a naked home. Use a global .hgrc that has a hook for local includes per machine.
author Dirk Olmes <dirk.olmes@codedo.de>
date Sat, 04 Apr 2020 03:53:18 +0200
parents
children efce15db2915
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
170
95e349996727 Add a script for setting up the shell environment on a naked home.
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
1 #!/bin/bash
95e349996727 Add a script for setting up the shell environment on a naked home.
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
2 #
95e349996727 Add a script for setting up the shell environment on a naked home.
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
3 # setup the shell env on a new, naked host
95e349996727 Add a script for setting up the shell environment on a naked home.
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
4 #
95e349996727 Add a script for setting up the shell environment on a naked home.
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
5 cd $HOME
95e349996727 Add a script for setting up the shell environment on a naked home.
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
6
95e349996727 Add a script for setting up the shell environment on a naked home.
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
7 replace_with_link() {
95e349996727 Add a script for setting up the shell environment on a naked home.
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
8 local target="$1"
95e349996727 Add a script for setting up the shell environment on a naked home.
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
9 local source="$2"
95e349996727 Add a script for setting up the shell environment on a naked home.
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
10
95e349996727 Add a script for setting up the shell environment on a naked home.
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
11 if [[ -f $target ]]; then
95e349996727 Add a script for setting up the shell environment on a naked home.
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
12 rm $target
95e349996727 Add a script for setting up the shell environment on a naked home.
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
13 fi
95e349996727 Add a script for setting up the shell environment on a naked home.
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
14 ln -s $source $target
95e349996727 Add a script for setting up the shell environment on a naked home.
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
15 }
95e349996727 Add a script for setting up the shell environment on a naked home.
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
16
95e349996727 Add a script for setting up the shell environment on a naked home.
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
17 replace_with_link .zshrc .zsh-env/zshrc
95e349996727 Add a script for setting up the shell environment on a naked home.
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
18 replace_with_link .hgrc .zsh-env/hgrc
95e349996727 Add a script for setting up the shell environment on a naked home.
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
19 replace_with_link .nanorc .zsh-env/.nanorc
95e349996727 Add a script for setting up the shell environment on a naked home.
Dirk Olmes <dirk.olmes@codedo.de>
parents:
diff changeset
20 replace_with_link .screenrc .zsh-env/.screenrc