-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·35 lines (28 loc) · 1.03 KB
/
install.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
#!/usr/bin/env bash
_p_repo="0kyn/_p"
_p_repo_url="https://github.com/${_p_repo}"
_p_install_dir="${HOME}/._p"
_p_echo() {
printf "> ${1} \n"
}
install() {
# check if _p is installed
if [[ -d "${_p_install_dir}" ]]; then
_p_echo "_p is already installed in ${_p_install_dir}"
else
_p_echo "Cloning ${_p_repo_url} into ${_p_install_dir}"
git clone -q --depth=1 "${_p_repo_url}" "${_p_install_dir}"
mv "${_p_install_dir}/_p.config.example" "${_p_install_dir}/_p.config"
fi
# check if $_p_install_dir is present in $PATH
if [[ ":${PATH}:" == *":${_p_install_dir}:"* ]]; then
_p_echo "${_p_install_dir} is already present in \$PATH"
else
printf "\n# Add _p install directory to \$PATH}\nexport PATH=\"${_p_install_dir}:${PATH}\"" >>"${HOME}/.bashrc"
_p_echo "Installation done"
_p_echo "Close and reopen your terminal to start using _p or run the following command: "
printf "export PATH=\"${_p_install_dir}:\${PATH}\"\n"
_p_echo "To check if everything is ok, you can run: \n_p"
fi
}
install