-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·77 lines (59 loc) · 1.13 KB
/
deploy.sh
File metadata and controls
executable file
·77 lines (59 loc) · 1.13 KB
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
#!/bin/bash
# Setup output logging:
named_pipe=/tmp/$$.tmp
trap "rm -f $named_pipe" EXIT
mknod $named_pipe p
tee <$named_pipe -a ~/deploy.log &
exec 1>$named_pipe 2>&1
echo
echo
echo "Ubuntu Server Deployment Script"
echo
# Check that this distribution is Ubuntu
if uname -v | grep -qvi ubuntu
then
echo "This script is meant for Ubuntu distributions only."
exit 1
fi
# Check if root
if [[ $UID != 0 ]]
then
echo "You are not root. This script must be run with root permissions."
exit 1
fi
# Filepath
root=$(dirname $(readlink -f $0))
# Run Deployment Scripts
echo
echo "Running deployment scripts $root/deploy.d/*.sh"
echo
for f in $root/deploy.d/*.sh
do
if [[ -x $root/local.d/$(basename $f) ]]
then
$root/local.d/$(basename $f)
else
$f
fi
done
echo
echo "Completed running deployment scripts."
# Run Custom Scripts
echo
echo "Running custom scripts $root/local.d/*.sh"
echo
for f in $root/local.d/*.sh
do
if [[ ! -x $root/deploy.d/$(basename $f) ]]
then
$f
fi
done
echo
echo "Completed running custom scripts."
echo
echo "Removed ~/.bash_login"
rm ~/.bash_login
echo
echo "Deployment complete. Please reboot."
echo