-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathfunctions.sh
More file actions
executable file
·40 lines (34 loc) · 918 Bytes
/
functions.sh
File metadata and controls
executable file
·40 lines (34 loc) · 918 Bytes
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
#!/bin/bash
set -e
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# dot_files=(gitconfig vimrc)
dot_files=$(find ${DIR}/dot_files -type f)
scripts=$(find ${DIR}/scripts -type f)
if [ ! -z ${LINUX_CONFIG_PLUGIN_DIR} ]; then
if [ -d ${LINUX_CONFIG_PLUGIN_DIR}/dot_files ]; then
dot_files+=($(find ${LINUX_CONFIG_PLUGIN_DIR}/dot_files -type f))
fi
if [ -d ${LINUX_CONFIG_PLUGIN_DIR}/scripts ]; then
scripts+=($(find ${LINUX_CONFIG_PLUGIN_DIR}/scripts -type f))
fi
fi
function install_files() {
if command -v tmux >/dev/null; then
ln -sf ${DIR}/tmux.conf ~/.tmux.conf
fi
for f in ${dot_files[@]}; do
ln -sf ${f} ~/.$(basename ${f})
done
mkdir -p ~/scripts
for f in ${scripts[@]}; do
ln -sf ${f} ~/scripts/$(basename ${f})
done
}
function remove_files() {
for f in ${dot_files[@]}; do
rm -f ~/.$(basename ${f})
done
for f in ${scripts[@]}; do
rm -f ~/scripts/$(basename ${f})
done
}