-
Notifications
You must be signed in to change notification settings - Fork 0
/
home_installer.sh
executable file
·47 lines (42 loc) · 992 Bytes
/
home_installer.sh
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
#!/bin/bash
# The function renames the file from `target` to `target.backup`
# only if the file exists and if it's not a symlink
backup() {
target=$1
if [ -e "$target" ]; then
if [ ! -L "$target" ]; then
mv "$target" "$target.backup"
echo "$target : backup $target to $target.backup"
fi
fi
}
symlink() {
file=$1
link=$2
if [ ! -e "$link" ]; then
echo "Create symlink from $link to $file"
ln -s $file $link
fi
}
## Find dotfiles
files=$(find . -name 'dot_*' | sed 's/^\.\///')
echo "Files found :"
echo "$files"
echo "Creating symlinks..."
for name in $files; do
if [ ! -d "$name" ]; then
new_name=$(echo "$name" | sed 's/dot_//')
target="$HOME/.$new_name"
backup $target
symlink $PWD/$name $target
fi
done
echo "Symlinks created"
echo "Running arkade.sh"
./scripts/arkade.sh
echo "Running autocomplete.sh"
sudo ./scripts/autocomplete.sh
echo "Running apt.sh"
sudo ./scripts/apt.sh
echo "Running other.sh"
./scripts/other.sh