-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.sh
executable file
·58 lines (48 loc) · 1.37 KB
/
update.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
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
#
# You run this file to copy in any required files.
#
# Terminate script on error
set -e
# Get the source directory
# (This may not be portable.)
src_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# If one argument:
# We symlink "$HOME/$1" to "$src_dir/$1".
# If two arguments:
# We symlink "$HOME/$1/$2" to "$src_dir/$1/$2".
# Intermediate parent directories are also created.
# NOTE: "rm" is used instead of the "ln -T" option for compatibility.
function update_corresponding() {
if [[ "$#" == 1 ]]; then
cp "$HOME/$1" "$src_dir/$1"
elif [[ "$#" == 2 ]]; then
mkdir -p "$HOME/$1"
cp "$HOME/$1/$2" "$src_dir/$1/$2"
else
echo "Wrong number of arguments for update_corresponding()."
exit 1
fi
}
export -f cp_corresponding
################################################################################
echo "Detecting system information..."
# System detection
if [[ "$OSTYPE" == "darwin"* ]]; then
os_type="mac"
utils_flavour="bsd"
else
# Catch-all: Assume everything else is GNU.
os_type="gnu"
utils_flavour="gnu"
fi
echo "OSTYPE = $OSTYPE"
echo "os_type = $os_type"
echo "utils_flavour = $utils_flavour"
printf "\n"
echo "Running the setup scripts..."
printf "\n"
if [[ "$os_type" == "gnu" ]]; then
bash "$src_dir/dotfiles/kde/update.sh"
fi
echo "ALL DONE!"