Server-Dotfiles/install.sh

37 lines
1.2 KiB
Bash
Raw Normal View History

2019-05-15 09:34:36 +02:00
#!/usr/bin/env bash
cd
if hash git 2> /dev/null; then
[[ -a Server-Dotfiles ]] && mv Server-Dotfiles Server-Dotfiles-$(date +%s)
git clone https://git.webionite.com/ceda_ei/Server-Dotfiles
./Server-Dotfiles/deploy.sh
else
echo "git not found. Trying with curl/wget and tar/unzip" >&2
if ! hash tar 2> /dev/null; then
if ! hash unzip; then
echo "tar or unzip not found" >&2
exit 1
else
file_format=".zip"
fi
else
file_format=".tar.gz"
fi
[[ -a Server-Dotfiles$file_format ]] && mv Server-Dotfiles$file_format Server-Dotfiles-$(date +%s)$file_format
[[ -a server-dotfiles ]] && mv server-dotfiles server-dotfiles-$(date +%s)
if hash curl 2> /dev/null; then
curl -o Server-Dotfiles$file_format https://git.webionite.com/ceda_ei/Server-Dotfiles/archive/master$file_format
elif hash wget 2> /dev/null; then
wget -O Server-Dotfiles$file_format https://git.webionite.com/ceda_ei/Server-Dotfiles/archive/master$file_format
else
echo "curl or wget not found" >&2
fi
if [[ $file_format == ".zip" ]]; then
unzip Server-Dotfiles$file_format
elif [[ $file_format == ".tar.gz" ]]; then
tar xzf Server-Dotfiles$file_format
fi
./server-dotfiles/deploy.sh
fi