blob: 19bae4c030539ea57896787c0e2f7edbf652400a (
plain)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
#!/bin/sh
as_sudo(){
SUDO=sudo
$@
SUDO=""
}
config_dir="${XDG_CONFIG_HOME:-$HOME/.config}"
home_dir="$HOME"
dotfiles_install() {
[ -d $config_dir ] || mkdir -v $config_dir
COPY ./src/dotfiles/* "$config_dir"
COPY ./src/dotfiles/zsh/zshrc "$home_dir"/.zshrc
COPY ./src/dotfiles/Xresources "$home_dir"/.Xresources
}
scripts_install() {
[ -d /usr/local/bin ] || sudo mkdir -v /usr/local/bin
as_sudo COPY ./src/scripts/* /usr/local/bin/
}
archlinux_install() {
as_sudo COPY ./src/distros/arch-linux/pacman.conf /etc
}
profile_install() {
[ -d /etc/profile.d ] || { sudo mkdir /etc/profile.d && printf "/etc/profile.d directory created" ; }
as_sudo COPY ./src/etc/profile.d/theion.sh /etc/profile.d || echo "Couldn't install to /etc/profile.d"
}
help() {
cat <<EOF
Usage $0:
-d Install dotfiles to .config
-s Install scripts to /usr/local/bin
-ds Install scripts and dotfiles
--profile Install profile files
--archlinux Install Arch linux specific files
--force Overwrite the existing files
--all Install everything (except Arch linux specific files)
EOF
exit 2
}
[ $# = 0 ] && help
for argument in $@;do
if [ $argument = "--force" ];then
COPY(){ $SUDO cp -r $@; }
break
fi
COPY(){ $SUDO cp -nr $@; }
done
for argument in $@;do
case "$argument" in
"-d") dotfiles_install;;
"-s")
scripts_install;;
"-ds")
dotfiles_install
scripts_install
;;
"--profile")
profile_install;;
"--archlinux")
archlinux_install
;;
"--all")
dotfiles_install
scripts_install
profile_install
;;
"--force");;
*) help ;;
esac
done
|