-
Notifications
You must be signed in to change notification settings - Fork 389
/
Copy pathodoo_install_nightly.sh
executable file
·133 lines (121 loc) · 4.95 KB
/
odoo_install_nightly.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
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/bin/bash
#################################################################################
# Script for Installation: odoo nightly builds on Ubuntu 14.04 LTS
# Author: (c) 2016 Martin Brehmer
#--------------------------------------------------------------------------------
#
# This script will install ODOO from the package sources for the nightly builds
# on a clean Ubuntu 14.04 Server
#
#--------------------------------------------------------------------------------
#
# USAGE: (sudo) odoo_install_nightly.sh [8.0|9.0]
#
# EXAMPLE: sudo ./odoo_install_nightly.sh 8.0
#
#################################################################################
# check for root-privileges
if [[ $EUID -ne 0 ]]; then
echo "You need root privileges to do this!" >&2
exit 1
fi
# check for invalid or too many parameters
if ([[ $# -eq 1 ]] && [[ $1 != "8.0" ]] && [[ $1 != "9.0" ]]) || ([[ $# -gt 1 ]]); then
echo "USAGE: $0 [8.0|9.0]"
exit 1
fi
# The Version of odoo you want to install. Default: 8.0
if [[ $# -eq 1 ]]; then
OE_VERSION="$1"
else
OE_VERSION="8.0"
fi
# check for 64 Bit or 32 Bit OS
OS_MACHINE_TYPE=$(uname -m)
#--------------------------------------------------
# Update Server
#--------------------------------------------------
echo -e "\n---- Update Server ----"
apt-get update && apt-get dist-upgrade -y
#--------------------------------------------------
# Install Dependencies
#--------------------------------------------------
echo -e "\n---- Install PostgreSQL ----"
apt-get install postgresql -y
echo -e "\n---- Install and link wkhtml as needed for odoo ----"
if [[ $OE_VERSION == "9.0" ]]; then
if [[ $OS_MACHINE_TYPE == "x86_64" ]]; then
wget -c http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-amd64.deb && \
dpkg -i wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
if [[ $? -ne 0 ]];then
apt-get install -f -y && \
dpkg -i wkhtmltox-0.12.2.1_linux-trusty-amd64.deb
fi
else
wget -c http://download.gna.org/wkhtmltopdf/0.12/0.12.2.1/wkhtmltox-0.12.2.1_linux-trusty-i386.deb && \
dpkg -i wkhtmltox-0.12.2.1_linux-trusty-i386.deb
if [[ $? -ne 0 ]];then
apt-get install -f -y && \
dpkg -i wkhtmltox-0.12.2.1_linux-trusty-i386.deb
fi
fi
elif [[ $OE_VERSION == "8.0" ]]; then
if [[ $OS_MACHINE_TYPE == "x86_64" ]]; then
wget -c http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb && \
dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb
if [[ $? -ne 0 ]]; then
apt-get install -f -y && \
dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb
fi
else
wget -c http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-i386.deb && \
dpkg -i wkhtmltox-0.12.1_linux-trusty-i386.deb
if [[ $? -ne 0 ]]; then
apt-get install -f -y && \
dpkg -i wkhtmltox-0.12.1_linux-trusty-i386.deb
fi
fi
else
echo -e "\n Unsopported version number for odoo" >&2
echo "USAGE: $0 [8.0|9.0]"
exit 1
fi
if [[ $? -eq 0 ]]; then
ln -s /usr/local/bin/wkhtmltopdf /usr/bin/wkhtmltopdf
ln -s /usr/local/bin/wkhtmltoimage /usr/bin/wkhtmltoimage
else
echo -e "\nThe installation of wkhtml was not successful!" >&2
exit 1
fi
#--------------------------------------------------
# Add the package source to the list or change it
#--------------------------------------------------
echo -e "\n---- Add package source ----"
if [[ $OE_VERSION == "8.0" ]]; then
if [[ $(grep -c 'deb http://nightly.odoo.com/9.0/nightly/deb/ ./' /etc/apt/sources.list) -eq 1 ]]; then
apt-get remove odoo -y
sed -i 's!deb http://nightly.odoo.com/9.0/nightly/deb/ ./!deb http://nightly.odoo.com/8.0/nightly/deb/ ./!' /etc/apt/sources.list
elif [[ $(grep -c 'deb http://nightly.odoo.com/8.0/nightly/deb/ ./' /etc/apt/sources.list) -eq 0 ]]; then
wget -O - https://nightly.odoo.com/odoo.key | apt-key add -
echo "deb http://nightly.odoo.com/8.0/nightly/deb/ ./" >> /etc/apt/sources.list
fi
elif [[ $OE_VERSION == "9.0" ]]; then
if [[ $(grep -c 'deb http://nightly.odoo.com/8.0/nightly/deb/ ./' /etc/apt/sources.list) -eq 1 ]]; then
apt-get remove odoo -y
sed -i 's!deb http://nightly.odoo.com/8.0/nightly/deb/ ./!deb http://nightly.odoo.com/9.0/nightly/deb/ ./!' /etc/apt/sources.list
elif [[ $(grep -c 'deb http://nightly.odoo.com/9.0/nightly/deb/ ./' /etc/apt/sources.list) -eq 0 ]]; then
wget -O - https://nightly.odoo.com/odoo.key | apt-key add -
echo "deb http://nightly.odoo.com/9.0/nightly/deb/ ./" >> /etc/apt/sources.list
fi
else
echo -e "\n Unsopported version number for odoo" >&2
echo "USAGE: $0 [8.0|9.0]"
exit 1
fi
#--------------------------------------------------
# Install the actual nightly build of odoo
#--------------------------------------------------
echo -e "\n---- Install odoo ----"
apt-get update && apt-get install odoo -y
echo -e "\nDone! The odoo server is installed and should already run."
exit 0