-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
executable file
·61 lines (49 loc) · 1.85 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
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
#!/usr/bin/env bash
###############################################################
# DEPLOY SCRIPT #
# #
# Script used for creating the specific #
# tag used for triggering the CI deployment #
# #
# End tag should look like this: #
# internal-all/v1.0.0-1234 #
# #
# Prepared by Jasmin Abou Aldan #
# Copyright (c) 2020 Infinum. All rights reserved. #
###############################################################
bold=$(tput bold)
normal=$(tput sgr0)
echo "==> ${bold}This script will install:${normal}"
echo "/usr/local/bin/app-deploy"
echo
if ! [[ "$0" == "--silent" ]]; then
read -r -p "Do you want to proceed? [y/n] " c
if ! [[ ${c} =~ ^(yes|y|Y) ]] || [ -z ${c} ]; then
exit 1
fi
fi
echo
echo "Fetching script data..."
# Create temp folder
if [ ! -d ".app_deploy_tmp" ]; then
mkdir .app_deploy_tmp
else
trap "rm -rf .app_deploy_tmp" EXIT
fi
# Get install files
git clone --quiet https://github.com/infinum/app-deploy-script.git .app_deploy_tmp
echo "Installing..."
# Move main script to bin folder
cat .app_deploy_tmp/app-deploy.sh > /usr/local/bin/app-deploy
# Move helpers to helpers folder inside bin
if [ ! -d "/usr/local/bin/.app-deploy-sources" ]; then
mkdir /usr/local/bin/.app-deploy-sources/
fi
cp -a .app_deploy_tmp/sources/. /usr/local/bin/.app-deploy-sources/
# Add permission to read files
chmod +rx /usr/local/bin/app-deploy
chmod +rx /usr/local/bin/.app-deploy-sources/
# Remove temp install folder
trap "rm -rf .app_deploy_tmp" EXIT
echo "Done!"
exit 0