-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.bash
executable file
·72 lines (67 loc) · 1.27 KB
/
setup.bash
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
PACKINSTALL=""
installpackages () {
SUDO=""
if [[ $EUID -ne 0 ]]; then
printf "Not running as root, trying sudo\n"
SUDO="sudo"
fi
${SUDO} apt update
${SUDO} apt install --yes \
vim \
stow \
iperf3 \
tree \
ncdu \
git \
dnsutils \
stow \
man
}
while [ "$1" != "" ] ; do
case $1 in
-i) shift; PACKINSTALL="true";;
-?) echo "Error: Invalid option '${1}'" && exit;;
esac
shift
done
if [ "${PACKINSTALL}" == "true" ]; then
echo "Installing packages"
installpackages
else
echo "Not installing packages"
fi
DATE=$(date "+%Y-%m-%d_%H%M%S-%Z")
if [ ! -d ~/bak.dotfiles ]; then
mkdir ~/bak.dotfiles
echo 'created bak.dotfiles'
fi
declare -a arr=(".bashrc"
".bash_aliases"
".inputrc"
".screenrc"
".toprc"
".vimrc"
".vim"
".digrc"
".config/youtube-dl/config"
)
for i in "${arr[@]}"
do
if [ -L ~/$i ]; then
rm ~/$i
echo "removed symlink $i"
elif [ -f ~/$i ] ; then
mv ~/$i ~/bak.dotfiles
echo "moved file $i"
fi
done
stow -d ~/dotfiles/ -t ~/ \
bash \
screen \
top \
vim \
dig \
youtube-dl
echo 'stowed dotfiles'
source ~/.bashrc