-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit_dotfiles
More file actions
executable file
·52 lines (42 loc) · 1.29 KB
/
init_dotfiles
File metadata and controls
executable file
·52 lines (42 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
#############################################
# install
# This script installs dotfiles found in
# the dotfile directory by creating symlinks
# from the home directory
#############################################
##############
# Variables
##############
# Get directory of the script
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DOTDIR=$DIR/dotfiles # Dotfiles directory
OLDDIR=$HOME/dotfiles_old # Old dotfiles backup directory
FILES=$DOTDIR/* # Get list of files in dotfile directory
##############
# Create old dotfiles directory in home directory
if [ ! -d "$OLDDIR" ]; then
echo -n "Creating $OLDDIR for backup of any existing dotfiles in ~ ..."
mkdir $OLDDIR
echo "done"
echo ""
fi
for file in $FILES; do
filename=$(basename $file)
# Move old files to old directory
echo -n "Finding any existing dotfiles in home directory ..."
if [ -f $HOME/.$filename ]; then
echo "Found"
echo "Moving $filename from $HOME to $OLDDIR"
mv $HOME/.$filename $OLDDIR
else
echo "Not Found"
fi
# Create new symlinks
echo "Creating symlink to $filename in home directory"
ln -s $DOTDIR/$filename ~/.$filename
echo ""
done
############
# Load other configuration
dconf load /org/gnome/terminal/ < $DIR/config/org.gnome.terminal.conf