vagrant-salt 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rst +131 -170
- data/example/complete/Vagrantfile +67 -0
- data/example/complete/salt/custom-bootstrap-salt.sh +2425 -0
- data/example/complete/salt/key/master.pem +30 -0
- data/example/complete/salt/key/master.pub +14 -0
- data/example/complete/salt/key/minion.pem +30 -0
- data/example/complete/salt/key/minion.pub +14 -0
- data/example/complete/salt/master +459 -0
- data/example/{salt/minion.conf → complete/salt/minion} +1 -2
- data/example/{salt → complete/salt}/roots/pillar/top.sls +0 -0
- data/example/complete/salt/roots/salt/nginx.sls +5 -0
- data/example/complete/salt/roots/salt/top.sls +3 -0
- data/example/masterless/Vagrantfile +18 -0
- data/example/masterless/salt/minion +219 -0
- data/example/{salt/roots/salt → masterless/salt/roots/pillar}/top.sls +0 -0
- data/example/masterless/salt/roots/salt/nginx.sls +5 -0
- data/example/masterless/salt/roots/salt/top.sls +3 -0
- data/lib/vagrant-salt.rb +16 -3
- data/lib/vagrant-salt/config.rb +103 -0
- data/lib/vagrant-salt/errors.rb +11 -0
- data/lib/vagrant-salt/plugin.rb +31 -0
- data/lib/vagrant-salt/provisioner.rb +211 -104
- data/lib/vagrant-salt/version.rb +5 -0
- data/scripts/.travis.yml +16 -0
- data/scripts/ChangeLog +39 -0
- data/scripts/LICENSE +16 -0
- data/scripts/README.rst +124 -35
- data/scripts/bootstrap-salt-minion.sh +1815 -381
- data/scripts/bootstrap-salt.sh +2425 -0
- data/scripts/salt-bootstrap.sh +2425 -0
- data/scripts/tests/README.rst +38 -0
- data/scripts/tests/bootstrap/__init__.py +11 -0
- data/{example/salt/key/KEYPAIR_GOES_HERE → scripts/tests/bootstrap/ext/__init__.py} +0 -0
- data/scripts/tests/bootstrap/ext/console.py +100 -0
- data/scripts/tests/bootstrap/ext/os_data.py +199 -0
- data/scripts/tests/bootstrap/test_install.py +586 -0
- data/scripts/tests/bootstrap/test_lint.py +27 -0
- data/scripts/tests/bootstrap/test_usage.py +28 -0
- data/scripts/tests/bootstrap/unittesting.py +216 -0
- data/scripts/tests/ext/checkbashisms +640 -0
- data/scripts/tests/install-testsuite-deps.py +99 -0
- data/scripts/tests/runtests.py +207 -0
- data/templates/locales/en.yml +14 -0
- data/vagrant-salt.gemspec +2 -2
- metadata +43 -10
- data/example/Vagrantfile +0 -26
- data/lib/vagrant_init.rb +0 -1
@@ -1,26 +1,112 @@
|
|
1
|
-
#!/bin/
|
1
|
+
#!/bin/sh -
|
2
2
|
#===============================================================================
|
3
3
|
# vim: softtabstop=4 shiftwidth=4 expandtab fenc=utf-8 spell spelllang=en
|
4
4
|
#===============================================================================
|
5
5
|
#
|
6
|
-
# FILE: bootstrap-salt
|
6
|
+
# FILE: bootstrap-salt.sh
|
7
7
|
#
|
8
8
|
# DESCRIPTION: Bootstrap salt installation for various systems/distributions
|
9
9
|
#
|
10
10
|
# BUGS: https://github.com/saltstack/salty-vagrant/issues
|
11
11
|
# AUTHOR: Pedro Algarvio (s0undt3ch), pedro@algarvio.me
|
12
12
|
# Alec Koumjian (akoumjian), akoumjian@gmail.com
|
13
|
+
# Geoff Garside (geoffgarside), geoff@geoffgarside.co.uk
|
14
|
+
# LICENSE: Apache 2.0
|
13
15
|
# ORGANIZATION: Salt Stack (saltstack.org)
|
14
16
|
# CREATED: 10/15/2012 09:49:37 PM WEST
|
15
17
|
#===============================================================================
|
16
18
|
set -o nounset # Treat unset variables as an error
|
17
|
-
ScriptVersion="1.
|
18
|
-
ScriptName="bootstrap-salt
|
19
|
+
ScriptVersion="1.5.2"
|
20
|
+
ScriptName="bootstrap-salt.sh"
|
21
|
+
|
22
|
+
#===============================================================================
|
23
|
+
# Environment variables taken into account.
|
24
|
+
#-------------------------------------------------------------------------------
|
25
|
+
# * BS_COLORS: If 0 disables colour support
|
26
|
+
# * BS_PIP_ALLOWED: If 1 enable pip based installations(if needed)
|
27
|
+
# * BS_ECHO_DEBUG: If 1 enable debug echo which can also be set by -D
|
28
|
+
# * BS_SALT_ETC_DIR: Defaults to /etc/salt
|
29
|
+
# * BS_FORCE_OVERWRITE: Force overriding copied files(config, init.d, etc)
|
30
|
+
#===============================================================================
|
31
|
+
|
19
32
|
|
20
33
|
#===============================================================================
|
21
34
|
# LET THE BLACK MAGIC BEGIN!!!!
|
22
35
|
#===============================================================================
|
23
36
|
|
37
|
+
|
38
|
+
# Bootstrap script truth values
|
39
|
+
BS_TRUE=1
|
40
|
+
BS_FALSE=0
|
41
|
+
|
42
|
+
#--- FUNCTION ----------------------------------------------------------------
|
43
|
+
# NAME: __detect_color_support
|
44
|
+
# DESCRIPTION: Try to detect color support.
|
45
|
+
#-------------------------------------------------------------------------------
|
46
|
+
COLORS=${BS_COLORS:-$(tput colors 2>/dev/null || echo 0)}
|
47
|
+
__detect_color_support() {
|
48
|
+
if [ $? -eq 0 ] && [ "$COLORS" -gt 2 ]; then
|
49
|
+
RC="\033[1;31m"
|
50
|
+
GC="\033[1;32m"
|
51
|
+
BC="\033[1;34m"
|
52
|
+
YC="\033[1;33m"
|
53
|
+
EC="\033[0m"
|
54
|
+
else
|
55
|
+
RC=""
|
56
|
+
GC=""
|
57
|
+
BC=""
|
58
|
+
YC=""
|
59
|
+
EC=""
|
60
|
+
fi
|
61
|
+
}
|
62
|
+
__detect_color_support
|
63
|
+
|
64
|
+
|
65
|
+
#--- FUNCTION ----------------------------------------------------------------
|
66
|
+
# NAME: echoerr
|
67
|
+
# DESCRIPTION: Echo errors to stderr.
|
68
|
+
#-------------------------------------------------------------------------------
|
69
|
+
echoerror() {
|
70
|
+
printf "${RC} * ERROR${EC}: $@\n" 1>&2;
|
71
|
+
}
|
72
|
+
|
73
|
+
#--- FUNCTION ----------------------------------------------------------------
|
74
|
+
# NAME: echoinfo
|
75
|
+
# DESCRIPTION: Echo information to stdout.
|
76
|
+
#-------------------------------------------------------------------------------
|
77
|
+
echoinfo() {
|
78
|
+
printf "${GC} * INFO${EC}: %s\n" "$@";
|
79
|
+
}
|
80
|
+
|
81
|
+
#--- FUNCTION ----------------------------------------------------------------
|
82
|
+
# NAME: echowarn
|
83
|
+
# DESCRIPTION: Echo warning informations to stdout.
|
84
|
+
#-------------------------------------------------------------------------------
|
85
|
+
echowarn() {
|
86
|
+
printf "${YC} * WARN${EC}: %s\n" "$@";
|
87
|
+
}
|
88
|
+
|
89
|
+
#--- FUNCTION ----------------------------------------------------------------
|
90
|
+
# NAME: echodebug
|
91
|
+
# DESCRIPTION: Echo debug information to stdout.
|
92
|
+
#-------------------------------------------------------------------------------
|
93
|
+
echodebug() {
|
94
|
+
if [ $ECHO_DEBUG -eq $BS_TRUE ]; then
|
95
|
+
printf "${BC} * DEBUG${EC}: %s\n" "$@";
|
96
|
+
fi
|
97
|
+
}
|
98
|
+
|
99
|
+
#--- FUNCTION ----------------------------------------------------------------
|
100
|
+
# NAME: pip_not_allowed
|
101
|
+
# DESCRIPTION: Simple function to let the users know that -P needs to be
|
102
|
+
# used.
|
103
|
+
#-------------------------------------------------------------------------------
|
104
|
+
pip_not_allowed() {
|
105
|
+
echoerror "pip based installations were not allowed. Retry using '-P'"
|
106
|
+
usage
|
107
|
+
exit 1
|
108
|
+
}
|
109
|
+
|
24
110
|
#=== FUNCTION ================================================================
|
25
111
|
# NAME: usage
|
26
112
|
# DESCRIPTION: Display usage information.
|
@@ -44,9 +130,23 @@ usage() {
|
|
44
130
|
$ ${ScriptName} git 8c3fadf15ec183e5ce8c63739850d543617e4357
|
45
131
|
|
46
132
|
Options:
|
47
|
-
-h
|
48
|
-
-v
|
49
|
-
-
|
133
|
+
-h Display this message
|
134
|
+
-v Display script version
|
135
|
+
-n No colours.
|
136
|
+
-D Show debug output.
|
137
|
+
-c Temporary configuration directory
|
138
|
+
-M Also install salt-master
|
139
|
+
-S Also install salt-syndic
|
140
|
+
-N Do not install salt-minion
|
141
|
+
-C Only run the configuration function. This option automaticaly
|
142
|
+
bypasses any installation.
|
143
|
+
-P Allow pip based installations. On some distributions the required salt
|
144
|
+
packages or it's dependencies are not available as a package for that
|
145
|
+
distribution. Using this flag allows the script to use pip as a last
|
146
|
+
resort method. NOTE: This works for functions which actually implement
|
147
|
+
pip based installations.
|
148
|
+
-F Allow copied files to overwrite existing(config, init.d, etc)
|
149
|
+
|
50
150
|
EOT
|
51
151
|
} # ---------- end of function usage ----------
|
52
152
|
|
@@ -54,34 +154,73 @@ EOT
|
|
54
154
|
# Handle command line arguments
|
55
155
|
#-----------------------------------------------------------------------
|
56
156
|
TEMP_CONFIG_DIR="null"
|
57
|
-
|
58
|
-
|
157
|
+
INSTALL_MASTER=$BS_FALSE
|
158
|
+
INSTALL_SYNDIC=$BS_FALSE
|
159
|
+
INSTALL_MINION=$BS_TRUE
|
160
|
+
ECHO_DEBUG=${BS_ECHO_DEBUG:-$BS_FALSE}
|
161
|
+
CONFIG_ONLY=$BS_FALSE
|
162
|
+
PIP_ALLOWED=${BS_PIP_ALLOWED:-$BS_FALSE}
|
163
|
+
SALT_ETC_DIR=${BS_SALT_ETC_DIR:-/etc/salt}
|
164
|
+
FORCE_OVERWRITE=${BS_FORCE_OVERWRITE:-$BS_FALSE}
|
165
|
+
|
166
|
+
while getopts ":hvnDc:MSNCP" opt
|
59
167
|
do
|
60
|
-
case $opt in
|
61
|
-
|
62
|
-
h
|
63
|
-
|
64
|
-
v
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
168
|
+
case "${opt}" in
|
169
|
+
|
170
|
+
h ) usage; exit 0 ;;
|
171
|
+
|
172
|
+
v ) echo "$0 -- Version $ScriptVersion"; exit 0 ;;
|
173
|
+
n ) COLORS=0; __detect_color_support ;;
|
174
|
+
D ) ECHO_DEBUG=$BS_TRUE ;;
|
175
|
+
c ) TEMP_CONFIG_DIR="$OPTARG"
|
176
|
+
# If the configuration directory does not exist, error out
|
177
|
+
if [ ! -d "$TEMP_CONFIG_DIR" ]; then
|
178
|
+
echoerror "The configuration directory ${TEMP_CONFIG_DIR} does not exist."
|
179
|
+
exit 1
|
180
|
+
fi
|
181
|
+
;;
|
182
|
+
M ) INSTALL_MASTER=$BS_TRUE ;;
|
183
|
+
S ) INSTALL_SYNDIC=$BS_TRUE ;;
|
184
|
+
N ) INSTALL_MINION=$BS_FALSE ;;
|
185
|
+
C ) CONFIG_ONLY=$BS_TRUE ;;
|
186
|
+
P ) PIP_ALLOWED=$BS_TRUE ;;
|
187
|
+
F ) FORCE_OVERWRITE=$BS_TRUE ;;
|
188
|
+
|
189
|
+
\?) echo
|
190
|
+
echoerror "Option does not exist : $OPTARG"
|
191
|
+
usage
|
192
|
+
exit 1
|
193
|
+
;;
|
69
194
|
|
70
195
|
esac # --- end of case ---
|
71
196
|
done
|
72
197
|
shift $(($OPTIND-1))
|
73
198
|
|
199
|
+
|
74
200
|
__check_unparsed_options() {
|
75
201
|
shellopts="$1"
|
76
202
|
unparsed_options=$( echo "$shellopts" | grep -E '[-]+[[:alnum:]]' )
|
77
203
|
if [ "x$unparsed_options" != "x" ]; then
|
78
204
|
usage
|
79
205
|
echo
|
80
|
-
|
206
|
+
echoerror "options are only allowed before install arguments"
|
81
207
|
echo
|
82
208
|
exit 1
|
83
209
|
fi
|
84
210
|
}
|
211
|
+
|
212
|
+
|
213
|
+
# Check that we're actually installing one of minion/master/syndic
|
214
|
+
if [ $INSTALL_MINION -eq $BS_FALSE ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && [ $CONFIG_ONLY -eq $BS_FALSE ]; then
|
215
|
+
echowarn "Nothing to install or configure"
|
216
|
+
exit 0
|
217
|
+
fi
|
218
|
+
|
219
|
+
if [ $CONFIG_ONLY -eq $BS_TRUE ] && [ "$TEMP_CONFIG_DIR" = "null" ]; then
|
220
|
+
echoerror "In order to run the script in configuration only mode you also need to provide the configuration directory."
|
221
|
+
exit 1
|
222
|
+
fi
|
223
|
+
|
85
224
|
# Define installation type
|
86
225
|
if [ "$#" -eq 0 ];then
|
87
226
|
ITYPE="stable"
|
@@ -91,11 +230,13 @@ else
|
|
91
230
|
shift
|
92
231
|
fi
|
93
232
|
|
94
|
-
|
95
|
-
|
233
|
+
# Check installation type
|
234
|
+
if [ "$ITYPE" != "stable" ] && [ "$ITYPE" != "daily" ] && [ "$ITYPE" != "git" ]; then
|
235
|
+
echoerror "Installation type \"$ITYPE\" is not known..."
|
96
236
|
exit 1
|
97
237
|
fi
|
98
238
|
|
239
|
+
# If doing a git install, check what branch/tag/sha will be checked out
|
99
240
|
if [ $ITYPE = "git" ]; then
|
100
241
|
if [ "$#" -eq 0 ];then
|
101
242
|
GIT_REV="master"
|
@@ -106,30 +247,50 @@ if [ $ITYPE = "git" ]; then
|
|
106
247
|
fi
|
107
248
|
fi
|
108
249
|
|
250
|
+
# Check for any unparsed arguments. Should be an error.
|
109
251
|
if [ "$#" -gt 0 ]; then
|
110
252
|
__check_unparsed_options "$*"
|
111
253
|
usage
|
112
254
|
echo
|
113
|
-
|
255
|
+
echoerror "Too many arguments."
|
114
256
|
exit 1
|
115
257
|
fi
|
116
258
|
|
117
259
|
# Root permissions are required to run this script
|
118
260
|
if [ $(whoami) != "root" ] ; then
|
119
|
-
|
261
|
+
echoerror "Salt requires root privileges to install. Please re-run this script as root."
|
120
262
|
exit 1
|
121
263
|
fi
|
122
264
|
|
265
|
+
CALLER=$(echo `ps -a -o pid,args | grep $$ | grep -v grep | tr -s ' '` | cut -d ' ' -f 2)
|
266
|
+
if [ "${CALLER}x" = "${0}x" ]; then
|
267
|
+
CALLER="PIPED THROUGH"
|
268
|
+
fi
|
269
|
+
echoinfo "${CALLER} ${0} -- Version ${ScriptVersion}"
|
270
|
+
#echowarn "Running the unstable version of ${ScriptName}"
|
271
|
+
|
123
272
|
|
124
273
|
#--- FUNCTION ----------------------------------------------------------------
|
125
274
|
# NAME: __exit_cleanup
|
126
275
|
# DESCRIPTION: Cleanup any leftovers after script has ended
|
276
|
+
#
|
277
|
+
#
|
278
|
+
# http://www.unix.com/man-page/POSIX/1posix/trap/
|
279
|
+
#
|
280
|
+
# Signal Number Signal Name
|
281
|
+
# 1 SIGHUP
|
282
|
+
# 2 SIGINT
|
283
|
+
# 3 SIGQUIT
|
284
|
+
# 6 SIGABRT
|
285
|
+
# 9 SIGKILL
|
286
|
+
# 14 SIGALRM
|
287
|
+
# 15 SIGTERM
|
127
288
|
#-------------------------------------------------------------------------------
|
128
289
|
__exit_cleanup() {
|
129
290
|
EXIT_CODE=$?
|
130
291
|
|
131
292
|
# Remove the logging pipe when the script exits
|
132
|
-
|
293
|
+
echodebug "Removing the logging pipe $LOGPIPE"
|
133
294
|
rm -f $LOGPIPE
|
134
295
|
|
135
296
|
# Kill tee when exiting, CentOS, at least requires this
|
@@ -137,25 +298,24 @@ __exit_cleanup() {
|
|
137
298
|
|
138
299
|
[ "x$TEE_PID" = "x" ] && exit $EXIT_CODE
|
139
300
|
|
140
|
-
|
301
|
+
echodebug "Killing logging pipe tee's with pid(s): $TEE_PID"
|
141
302
|
|
142
303
|
# We need to trap errors since killing tee will cause a 127 errno
|
143
304
|
# We also do this as late as possible so we don't "mis-catch" other errors
|
144
305
|
__trap_errors() {
|
145
|
-
|
306
|
+
echoinfo "Errors Trapped: $EXIT_CODE"
|
146
307
|
# Exit with the "original" exit code, not the trapped code
|
147
308
|
exit $EXIT_CODE
|
148
309
|
}
|
149
|
-
|
150
|
-
trap "__trap_errors" ERR >/dev/null 2>&1 || trap "__trap_errors" INT KILL QUIT
|
310
|
+
trap "__trap_errors" INT QUIT ABRT KILL QUIT TERM
|
151
311
|
|
152
312
|
# Now we're "good" to kill tee
|
153
|
-
kill -TERM $TEE_PID
|
313
|
+
kill -s TERM $TEE_PID
|
154
314
|
|
155
315
|
# In case the 127 errno is not triggered, exit with the "original" exit code
|
156
316
|
exit $EXIT_CODE
|
157
317
|
}
|
158
|
-
trap "__exit_cleanup" EXIT
|
318
|
+
trap "__exit_cleanup" EXIT INT
|
159
319
|
|
160
320
|
|
161
321
|
# Define our logging file and pipe paths
|
@@ -166,7 +326,7 @@ LOGPIPE="/tmp/$( echo $ScriptName | sed s/.sh/.logpipe/g )"
|
|
166
326
|
# On FreeBSD we have to use mkfifo instead of mknod
|
167
327
|
mknod $LOGPIPE p >/dev/null 2>&1 || mkfifo $LOGPIPE >/dev/null 2>&1
|
168
328
|
if [ $? -ne 0 ]; then
|
169
|
-
|
329
|
+
echoerror "Failed to create the named pipe required to log"
|
170
330
|
exit 1
|
171
331
|
fi
|
172
332
|
|
@@ -188,6 +348,11 @@ exec 2>$LOGPIPE
|
|
188
348
|
__gather_hardware_info() {
|
189
349
|
if [ -f /proc/cpuinfo ]; then
|
190
350
|
CPU_VENDOR_ID=$(cat /proc/cpuinfo | grep -E 'vendor_id|Processor' | head -n 1 | awk '{print $3}' | cut -d '-' -f1 )
|
351
|
+
elif [ -f /usr/bin/kstat ]; then
|
352
|
+
# SmartOS.
|
353
|
+
# Solaris!?
|
354
|
+
# This has only been tested for a GenuineIntel CPU
|
355
|
+
CPU_VENDOR_ID=$(/usr/bin/kstat -p cpu_info:0:cpu_info0:vendor_id | awk '{print $2}')
|
191
356
|
else
|
192
357
|
CPU_VENDOR_ID=$( sysctl -n hw.model )
|
193
358
|
fi
|
@@ -231,6 +396,71 @@ __parse_version_string() {
|
|
231
396
|
}
|
232
397
|
|
233
398
|
|
399
|
+
#--- FUNCTION ----------------------------------------------------------------
|
400
|
+
# NAME: __unquote_string
|
401
|
+
# DESCRIPTION: Strip single or double quotes from the provided string.
|
402
|
+
#-------------------------------------------------------------------------------
|
403
|
+
__unquote_string() {
|
404
|
+
echo $@ | sed "s/^\([\"']\)\(.*\)\1\$/\2/g"
|
405
|
+
}
|
406
|
+
|
407
|
+
#--- FUNCTION ----------------------------------------------------------------
|
408
|
+
# NAME: __camelcase_split
|
409
|
+
# DESCRIPTION: Convert CamelCased strings to Camel_Cased
|
410
|
+
#-------------------------------------------------------------------------------
|
411
|
+
__camelcase_split() {
|
412
|
+
echo $@ | sed -r 's/([^A-Z-])([A-Z])/\1 \2/g'
|
413
|
+
}
|
414
|
+
|
415
|
+
#--- FUNCTION ----------------------------------------------------------------
|
416
|
+
# NAME: __strip_duplicates
|
417
|
+
# DESCRIPTION: Strip duplicate strings
|
418
|
+
#-------------------------------------------------------------------------------
|
419
|
+
__strip_duplicates() {
|
420
|
+
echo $@ | tr -s '[:space:]' '\n' | awk '!x[$0]++'
|
421
|
+
}
|
422
|
+
|
423
|
+
#--- FUNCTION ----------------------------------------------------------------
|
424
|
+
# NAME: __sort_release_files
|
425
|
+
# DESCRIPTION: Custom sort function. Alphabetical or numerical sort is not
|
426
|
+
# enough.
|
427
|
+
#-------------------------------------------------------------------------------
|
428
|
+
__sort_release_files() {
|
429
|
+
KNOWN_RELEASE_FILES=$(echo "(arch|centos|debian|ubuntu|fedora|redhat|suse|\
|
430
|
+
mandrake|mandriva|gentoo|slackware|turbolinux|unitedlinux|lsb|system|\
|
431
|
+
os)(-|_)(release|version)" | sed -r 's:[[:space:]]::g')
|
432
|
+
primary_release_files=""
|
433
|
+
secondary_release_files=""
|
434
|
+
# Sort know VS un-known files first
|
435
|
+
for release_file in $(echo $@ | sed -r 's:[[:space:]]:\n:g' | sort --unique --ignore-case); do
|
436
|
+
match=$(echo $release_file | egrep -i ${KNOWN_RELEASE_FILES})
|
437
|
+
if [ "x${match}" != "x" ]; then
|
438
|
+
primary_release_files="${primary_release_files} ${release_file}"
|
439
|
+
else
|
440
|
+
secondary_release_files="${secondary_release_files} ${release_file}"
|
441
|
+
fi
|
442
|
+
done
|
443
|
+
|
444
|
+
# Now let's sort by know files importance, max important goes last in the max_prio list
|
445
|
+
max_prio="redhat-release centos-release"
|
446
|
+
for entry in $max_prio; do
|
447
|
+
if [ "x$(echo ${primary_release_files} | grep $entry)" != "x" ]; then
|
448
|
+
primary_release_files=$(echo ${primary_release_files} | sed -e "s:\(.*\)\($entry\)\(.*\):\2 \1 \3:g")
|
449
|
+
fi
|
450
|
+
done
|
451
|
+
# Now, least important goes last in the min_prio list
|
452
|
+
min_prio="lsb-release"
|
453
|
+
for entry in $max_prio; do
|
454
|
+
if [ "x$(echo ${primary_release_files} | grep $entry)" != "x" ]; then
|
455
|
+
primary_release_files=$(echo ${primary_release_files} | sed -e "s:\(.*\)\($entry\)\(.*\):\1 \3 \2:g")
|
456
|
+
fi
|
457
|
+
done
|
458
|
+
|
459
|
+
# Echo the results collapsing multiple white-space into a single white-space
|
460
|
+
echo "${primary_release_files} ${secondary_release_files}" | sed -r 's:[[:space:]]:\n:g'
|
461
|
+
}
|
462
|
+
|
463
|
+
|
234
464
|
#--- FUNCTION ----------------------------------------------------------------
|
235
465
|
# NAME: __gather_linux_system_info
|
236
466
|
# DESCRIPTION: Discover Linux system information
|
@@ -239,36 +469,52 @@ __gather_linux_system_info() {
|
|
239
469
|
DISTRO_NAME=""
|
240
470
|
DISTRO_VERSION=""
|
241
471
|
|
242
|
-
if
|
472
|
+
# Let's test if the lsb_release binary is available
|
473
|
+
rv=$(lsb_release >/dev/null 2>&1)
|
474
|
+
if [ $? -eq 0 ]; then
|
475
|
+
DISTRO_NAME=$(lsb_release -si)
|
476
|
+
if [ "x$(echo "$DISTRO_NAME" | grep RedHat)" != "x" ]; then
|
477
|
+
# Let's convert CamelCase to Camel Case
|
478
|
+
DISTRO_NAME=$(__camelcase_split "$DISTRO_NAME")
|
479
|
+
fi
|
480
|
+
rv=$(lsb_release -sr)
|
481
|
+
[ "${rv}x" != "x" ] && DISTRO_VERSION=$(__parse_version_string "$rv")
|
482
|
+
elif [ -f /etc/lsb-release ]; then
|
483
|
+
# We don't have the lsb_release binary, though, we do have the file it parses
|
243
484
|
DISTRO_NAME=$(grep DISTRIB_ID /etc/lsb-release | sed -e 's/.*=//')
|
244
|
-
|
485
|
+
rv=$(grep DISTRIB_RELEASE /etc/lsb-release | sed -e 's/.*=//')
|
486
|
+
[ "${rv}x" != "x" ] && DISTRO_VERSION=$(__parse_version_string "$rv")
|
245
487
|
fi
|
246
488
|
|
247
|
-
if [ "x$DISTRO_NAME" != "x"
|
489
|
+
if [ "x$DISTRO_NAME" != "x" ] && [ "x$DISTRO_VERSION" != "x" ]; then
|
248
490
|
# We already have the distribution name and version
|
249
491
|
return
|
250
492
|
fi
|
251
493
|
|
252
|
-
for rsource in $(
|
494
|
+
for rsource in $(__sort_release_files $(
|
253
495
|
cd /etc && /bin/ls *[_-]release *[_-]version 2>/dev/null | env -i sort | \
|
254
496
|
sed -e '/^redhat-release$/d' -e '/^lsb-release$/d'; \
|
255
497
|
echo redhat-release lsb-release
|
256
|
-
); do
|
498
|
+
)); do
|
257
499
|
|
258
500
|
[ -L "/etc/${rsource}" ] && continue # Don't follow symlinks
|
259
501
|
[ ! -f "/etc/${rsource}" ] && continue # Does not exist
|
260
502
|
|
261
503
|
n=$(echo ${rsource} | sed -e 's/[_-]release$//' -e 's/[_-]version$//')
|
262
|
-
|
504
|
+
rv=$( (grep VERSION /etc/${rsource}; cat /etc/${rsource}) | grep '[0-9]' | sed -e 'q' )
|
505
|
+
[ "${rv}x" = "x" ] && continue # There's no version information. Continue to next rsource
|
506
|
+
v=$(__parse_version_string "$rv")
|
263
507
|
case $(echo ${n} | tr '[:upper:]' '[:lower:]') in
|
264
|
-
redhat
|
265
|
-
if [ ".$(egrep '
|
508
|
+
redhat )
|
509
|
+
if [ ".$(egrep 'CentOS' /etc/${rsource})" != . ]; then
|
510
|
+
n="CentOS"
|
511
|
+
elif [ ".$(egrep 'Red Hat Enterprise Linux' /etc/${rsource})" != . ]; then
|
266
512
|
n="<R>ed <H>at <E>nterprise <L>inux"
|
267
513
|
else
|
268
514
|
n="<R>ed <H>at <L>inux"
|
269
515
|
fi
|
270
516
|
;;
|
271
|
-
arch ) n="Arch"
|
517
|
+
arch ) n="Arch Linux" ;;
|
272
518
|
centos ) n="CentOS" ;;
|
273
519
|
debian ) n="Debian" ;;
|
274
520
|
ubuntu ) n="Ubuntu" ;;
|
@@ -279,6 +525,20 @@ __gather_linux_system_info() {
|
|
279
525
|
slackware ) n="Slackware" ;;
|
280
526
|
turbolinux ) n="TurboLinux" ;;
|
281
527
|
unitedlinux ) n="UnitedLinux" ;;
|
528
|
+
system )
|
529
|
+
while read -r line; do
|
530
|
+
[ "${n}x" != "systemx" ] && break
|
531
|
+
case "$line" in
|
532
|
+
*Amazon*Linux*AMI*)
|
533
|
+
n="Amazon Linux AMI"
|
534
|
+
break
|
535
|
+
esac
|
536
|
+
done < /etc/${rsource}
|
537
|
+
;;
|
538
|
+
os )
|
539
|
+
n=$(__unquote_string $(grep '^NAME=' /etc/os-release | sed -e 's/^NAME=\(.*\)$/\1/g'))
|
540
|
+
[ "${n}" = "Arch Linux" ] && v="" # Arch Linux does not provide a version.
|
541
|
+
;;
|
282
542
|
* ) n="${n}" ;
|
283
543
|
esac
|
284
544
|
DISTRO_NAME=$n
|
@@ -293,13 +553,55 @@ __gather_linux_system_info() {
|
|
293
553
|
# DESCRIPTION: Discover SunOS system info
|
294
554
|
#-------------------------------------------------------------------------------
|
295
555
|
__gather_sunos_system_info() {
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
556
|
+
if [ -f /sbin/uname ]; then
|
557
|
+
DISTRO_VERSION=$(/sbin/uname -X | grep -i kernelid | awk '{ print $3}')
|
558
|
+
fi
|
559
|
+
|
560
|
+
DISTRO_NAME=""
|
561
|
+
if [ -f /etc/release ]; then
|
562
|
+
while read -r line; do
|
563
|
+
[ "${DISTRO_NAME}x" != "x" ] && break
|
564
|
+
case "$line" in
|
565
|
+
*OpenIndiana*oi_[0-9]*)
|
566
|
+
DISTRO_NAME="OpenIndiana"
|
567
|
+
DISTRO_VERSION=$(echo "$line" | sed -nr "s/OpenIndiana(.*)oi_([[:digit:]]+)(.*)/\2/p")
|
568
|
+
break
|
569
|
+
;;
|
570
|
+
*OpenSolaris*snv_[0-9]*)
|
571
|
+
DISTRO_NAME="OpenSolaris"
|
572
|
+
DISTRO_VERSION=$(echo "$line" | sed -nr "s/OpenSolaris(.*)snv_([[:digit:]]+)(.*)/\2/p")
|
573
|
+
break
|
574
|
+
;;
|
575
|
+
*Oracle*Solaris*[0-9]*)
|
576
|
+
DISTRO_NAME="Oracle Solaris"
|
577
|
+
DISTRO_VERSION=$(echo "$line" | sed -nr "s/(Oracle Solaris) ([[:digit:]]+)(.*)/\2/p")
|
578
|
+
break
|
579
|
+
;;
|
580
|
+
*Solaris*)
|
581
|
+
DISTRO_NAME="Solaris"
|
582
|
+
break
|
583
|
+
;;
|
584
|
+
*NexentaCore*)
|
585
|
+
DISTRO_NAME="Nexenta Core"
|
586
|
+
break
|
587
|
+
;;
|
588
|
+
*SmartOS*)
|
589
|
+
DISTRO_NAME="SmartOS"
|
590
|
+
break
|
591
|
+
;;
|
592
|
+
esac
|
593
|
+
done < /etc/release
|
594
|
+
fi
|
595
|
+
|
596
|
+
if [ "${DISTRO_NAME}x" = "x" ]; then
|
597
|
+
DISTRO_NAME="Solaris"
|
598
|
+
DISTRO_VERSION=$(
|
599
|
+
echo "${OS_VERSION}" |
|
600
|
+
sed -e 's;^4\.;1.;' \
|
601
|
+
-e 's;^5\.\([0-6]\)[^0-9]*$;2.\1;' \
|
602
|
+
-e 's;^5\.\([0-9][0-9]*\).*;\1;'
|
603
|
+
)
|
604
|
+
fi
|
303
605
|
}
|
304
606
|
|
305
607
|
|
@@ -329,12 +631,77 @@ __gather_system_info() {
|
|
329
631
|
__gather_bsd_system_info
|
330
632
|
;;
|
331
633
|
* )
|
332
|
-
|
634
|
+
echoerror "${OS_NAME} not supported.";
|
333
635
|
exit 1
|
334
636
|
;;
|
335
637
|
esac
|
336
638
|
|
337
639
|
}
|
640
|
+
__gather_system_info
|
641
|
+
|
642
|
+
|
643
|
+
echo
|
644
|
+
echoinfo "System Information:"
|
645
|
+
echoinfo " CPU: ${CPU_VENDOR_ID}"
|
646
|
+
echoinfo " CPU Arch: ${CPU_ARCH}"
|
647
|
+
echoinfo " OS Name: ${OS_NAME}"
|
648
|
+
echoinfo " OS Version: ${OS_VERSION}"
|
649
|
+
echoinfo " Distribution: ${DISTRO_NAME} ${DISTRO_VERSION}"
|
650
|
+
echo
|
651
|
+
|
652
|
+
# Let users know what's going to be installed/configured
|
653
|
+
if [ $INSTALL_MINION -eq $BS_TRUE ]; then
|
654
|
+
if [ $CONFIG_ONLY -eq $BS_FALSE ]; then
|
655
|
+
echoinfo "Installing minion"
|
656
|
+
else
|
657
|
+
echoinfo "Configuring minion"
|
658
|
+
fi
|
659
|
+
fi
|
660
|
+
|
661
|
+
if [ $INSTALL_MASTER -eq $BS_TRUE ]; then
|
662
|
+
if [ $CONFIG_ONLY -eq $BS_FALSE ]; then
|
663
|
+
echoinfo "Installing master"
|
664
|
+
else
|
665
|
+
echoinfo "Configuring master"
|
666
|
+
fi
|
667
|
+
fi
|
668
|
+
|
669
|
+
if [ $INSTALL_SYNDIC -eq $BS_TRUE ]; then
|
670
|
+
if [ $CONFIG_ONLY -eq $BS_FALSE ]; then
|
671
|
+
echoinfo "Installing syndic"
|
672
|
+
else
|
673
|
+
echoinfo "Configuring syndic"
|
674
|
+
fi
|
675
|
+
fi
|
676
|
+
|
677
|
+
# Simplify version naming on functions
|
678
|
+
if [ "x${DISTRO_VERSION}" = "x" ]; then
|
679
|
+
DISTRO_MAJOR_VERSION=""
|
680
|
+
DISTRO_MINOR_VERSION=""
|
681
|
+
PREFIXED_DISTRO_MAJOR_VERSION=""
|
682
|
+
PREFIXED_DISTRO_MINOR_VERSION=""
|
683
|
+
else
|
684
|
+
DISTRO_MAJOR_VERSION="$(echo $DISTRO_VERSION | sed 's/^\([0-9]*\).*/\1/g')"
|
685
|
+
DISTRO_MINOR_VERSION="$(echo $DISTRO_VERSION | sed 's/^\([0-9]*\).\([0-9]*\).*/\2/g')"
|
686
|
+
PREFIXED_DISTRO_MAJOR_VERSION="_${DISTRO_MAJOR_VERSION}"
|
687
|
+
if [ "${PREFIXED_DISTRO_MAJOR_VERSION}" = "_" ]; then
|
688
|
+
PREFIXED_DISTRO_MAJOR_VERSION=""
|
689
|
+
fi
|
690
|
+
PREFIXED_DISTRO_MINOR_VERSION="_${DISTRO_MINOR_VERSION}"
|
691
|
+
if [ "${PREFIXED_DISTRO_MINOR_VERSION}" = "_" ]; then
|
692
|
+
PREFIXED_DISTRO_MINOR_VERSION=""
|
693
|
+
fi
|
694
|
+
fi
|
695
|
+
# Simplify distro name naming on functions
|
696
|
+
DISTRO_NAME_L=$(echo $DISTRO_NAME | tr '[:upper:]' '[:lower:]' | sed 's/[^a-zA-Z0-9_ ]//g' | sed -re 's/([[:space:]])+/_/g')
|
697
|
+
|
698
|
+
|
699
|
+
# Only Ubuntu has daily packages, let's let users know about that
|
700
|
+
if ([ "${DISTRO_NAME_L}" != "ubuntu" ] && [ $ITYPE = "daily" ]) && \
|
701
|
+
([ "${DISTRO_NAME_L}" != "trisquel" ] && [ $ITYPE = "daily" ]); then
|
702
|
+
echoerror "${DISTRO_NAME} does not have daily packages support"
|
703
|
+
exit 1
|
704
|
+
fi
|
338
705
|
|
339
706
|
|
340
707
|
#--- FUNCTION ----------------------------------------------------------------
|
@@ -345,33 +712,13 @@ __gather_system_info() {
|
|
345
712
|
#-------------------------------------------------------------------------------
|
346
713
|
__function_defined() {
|
347
714
|
FUNC_NAME=$1
|
348
|
-
if [ "$
|
349
|
-
|
350
|
-
|
351
|
-
return 0
|
352
|
-
fi
|
353
|
-
elif [ "${DISTRO_NAME}" = "ubuntu" ]; then
|
354
|
-
if $( type ${FUNC_NAME} | grep -q 'shell function' ); then
|
355
|
-
echo " * INFO: Found function $FUNC_NAME"
|
356
|
-
return 0
|
357
|
-
fi
|
358
|
-
# Last resorts try POSIXLY_CORRECT or not
|
359
|
-
elif test -n "${POSIXLY_CORRECT+yes}"; then
|
360
|
-
if typeset -f $FUNC_NAME >/dev/null 2>&1 ; then
|
361
|
-
echo " * INFO: Found function $FUNC_NAME"
|
362
|
-
return 0
|
363
|
-
fi
|
364
|
-
else
|
365
|
-
# Arch linux seems to fall here
|
366
|
-
if $( type ${FUNC_NAME} >/dev/null 2>&1 ) ; then
|
367
|
-
echo " * INFO: Found function $FUNC_NAME"
|
368
|
-
return 0
|
369
|
-
fi
|
715
|
+
if [ "$(command -v $FUNC_NAME)x" != "x" ]; then
|
716
|
+
echoinfo "Found function $FUNC_NAME"
|
717
|
+
return 0
|
370
718
|
fi
|
371
|
-
|
719
|
+
echodebug "$FUNC_NAME not found...."
|
372
720
|
return 1
|
373
721
|
}
|
374
|
-
__gather_system_info
|
375
722
|
|
376
723
|
|
377
724
|
#--- FUNCTION ----------------------------------------------------------------
|
@@ -383,35 +730,77 @@ __git_clone_and_checkout() {
|
|
383
730
|
SALT_GIT_CHECKOUT_DIR=/tmp/git/salt
|
384
731
|
[ -d /tmp/git ] || mkdir /tmp/git
|
385
732
|
cd /tmp/git
|
386
|
-
[ -d $SALT_GIT_CHECKOUT_DIR ]
|
387
|
-
|
388
|
-
|
733
|
+
if [ -d $SALT_GIT_CHECKOUT_DIR ]; then
|
734
|
+
cd $SALT_GIT_CHECKOUT_DIR
|
735
|
+
git fetch || return 1
|
736
|
+
# Tags are needed because of salt's versioning, also fetch that
|
737
|
+
git fetch --tags || return 1
|
738
|
+
git reset --hard $GIT_REV || return 1
|
739
|
+
|
740
|
+
# Just calling `git reset --hard $GIT_REV` on a branch name that has
|
741
|
+
# already been checked out will not update that branch to the upstream
|
742
|
+
# HEAD; instead it will simply reset to itself. Check the ref to see
|
743
|
+
# if it is a branch name, check out the branch, and pull in the
|
744
|
+
# changes.
|
745
|
+
git branch -a | grep -q ${GIT_REV}
|
746
|
+
if [ $? -eq 0 ]; then
|
747
|
+
git pull --rebase || return 1
|
748
|
+
fi
|
749
|
+
else
|
750
|
+
git clone https://github.com/saltstack/salt.git salt || return 1
|
751
|
+
cd $SALT_GIT_CHECKOUT_DIR
|
752
|
+
git checkout $GIT_REV || return 1
|
753
|
+
fi
|
754
|
+
return 0
|
389
755
|
}
|
390
756
|
|
391
757
|
|
392
|
-
echo " * System Information:"
|
393
|
-
echo " CPU: ${CPU_VENDOR_ID}"
|
394
|
-
echo " CPU Arch: ${CPU_ARCH}"
|
395
|
-
echo " OS Name: ${OS_NAME}"
|
396
|
-
echo " OS Version: ${OS_VERSION}"
|
397
|
-
echo " Distribution: ${DISTRO_NAME} ${DISTRO_VERSION}"
|
398
|
-
|
399
|
-
|
400
|
-
# Simplify version naming on functions
|
401
|
-
if [ "x${DISTRO_VERSION}" = "x" ]; then
|
402
|
-
DISTRO_VERSION_NO_DOTS=""
|
403
|
-
else
|
404
|
-
DISTRO_VERSION_NO_DOTS="_$(echo $DISTRO_VERSION | tr -d '.')"
|
405
|
-
fi
|
406
|
-
# Simplify distro name naming on functions
|
407
|
-
DISTRO_NAME_L=$(echo $DISTRO_NAME | tr '[:upper:]' '[:lower:]' | sed 's/[^a-zA-Z0-9_ ]//g' | sed -e 's|[:space:]+|_|g')
|
408
|
-
|
409
758
|
#--- FUNCTION ----------------------------------------------------------------
|
410
759
|
# NAME: __apt_get_noinput
|
411
760
|
# DESCRIPTION: (DRY) apt-get install with noinput options
|
412
761
|
#-------------------------------------------------------------------------------
|
413
762
|
__apt_get_noinput() {
|
414
|
-
apt-get install -y -o DPkg::Options::=--force-confold
|
763
|
+
apt-get install -y -o DPkg::Options::=--force-confold $@; return $?
|
764
|
+
}
|
765
|
+
|
766
|
+
|
767
|
+
#--- FUNCTION ----------------------------------------------------------------
|
768
|
+
# NAME: copyfile
|
769
|
+
# DESCRIPTION: Simple function to copy files. Overrides if asked.
|
770
|
+
#-------------------------------------------------------------------------------
|
771
|
+
copyfile() {
|
772
|
+
overwrite=$FORCE_OVERWRITE
|
773
|
+
if [ $# -eq 2 ]; then
|
774
|
+
sfile=$1
|
775
|
+
dfile=$2
|
776
|
+
elif [ $# -eq 3 ]; then
|
777
|
+
sfile=$1
|
778
|
+
dfile=$2
|
779
|
+
overwrite=$3
|
780
|
+
else
|
781
|
+
echoerror "Wrong number of arguments for copyfile()"
|
782
|
+
echoinfo "USAGE: copyfile <source> <dest> OR copyfile <source> <dest> <overwrite>"
|
783
|
+
exit 1
|
784
|
+
fi
|
785
|
+
|
786
|
+
# Does the source file exist?
|
787
|
+
if [ ! -f "$sfile" ]; then
|
788
|
+
echowarn "$sfile does not exist!"
|
789
|
+
return 1
|
790
|
+
fi
|
791
|
+
|
792
|
+
if [ ! -f "$dfile" ]; then
|
793
|
+
# The destination file does not exist, copy
|
794
|
+
echodebug "Copying $sfile to $dfile"
|
795
|
+
cp "$sfile" "$dfile"
|
796
|
+
elif [ -f "$dfile" ] && [ $overwrite -eq $BS_TRUE ]; then
|
797
|
+
# The destination exist and we're overwriting
|
798
|
+
echodebug "Overriding $dfile with $sfile"
|
799
|
+
cp -f "$sfile" "$dfile"
|
800
|
+
elif [ -f "$dfile" ] && [ $overwrite -ne $BS_TRUE ]; then
|
801
|
+
echodebug "Not overriding $dfile with $sfile"
|
802
|
+
fi
|
803
|
+
return 0
|
415
804
|
}
|
416
805
|
|
417
806
|
|
@@ -422,113 +811,201 @@ __apt_get_noinput() {
|
|
422
811
|
# In order to install salt for a distribution you need to define:
|
423
812
|
#
|
424
813
|
# To Install Dependencies, which is required, one of:
|
425
|
-
# 1. install_<distro>_<
|
426
|
-
# 2. install_<distro>_<
|
427
|
-
# 3. install_<distro>_<
|
428
|
-
# 4
|
814
|
+
# 1. install_<distro>_<major_version>_<install_type>_deps
|
815
|
+
# 2. install_<distro>_<major_version>_<minor_version>_<install_type>_deps
|
816
|
+
# 3. install_<distro>_<major_version>_deps
|
817
|
+
# 4 install_<distro>_<major_version>_<minor_version>_deps
|
818
|
+
# 5. install_<distro>_<install_type>_deps
|
819
|
+
# 6. install_<distro>_deps
|
429
820
|
#
|
821
|
+
# Optionally, define a salt configuration function, which will be called if
|
822
|
+
# the -c|config-dir option is passed. One of:
|
823
|
+
# 1. config_<distro>_<major_version>_<install_type>_salt
|
824
|
+
# 2. config_<distro>_<major_version>_<minor_version>_<install_type>_salt
|
825
|
+
# 3. config_<distro>_<major_version>_salt
|
826
|
+
# 4 config_<distro>_<major_version>_<minor_version>_salt
|
827
|
+
# 5. config_<distro>_<install_type>_salt
|
828
|
+
# 6. config_<distro>_salt
|
829
|
+
# 7. config_salt [THIS ONE IS ALREADY DEFINED AS THE DEFAULT]
|
430
830
|
#
|
431
831
|
# To install salt, which, of course, is required, one of:
|
432
|
-
# 1. install_<distro>_<
|
433
|
-
# 2. install_<distro>_<install_type>
|
832
|
+
# 1. install_<distro>_<major_version>_<install_type>
|
833
|
+
# 2. install_<distro>_<major_version>_<minor_version>_<install_type>
|
834
|
+
# 3. install_<distro>_<install_type>
|
434
835
|
#
|
435
|
-
# Optionally, define a
|
436
|
-
#
|
437
|
-
#
|
438
|
-
#
|
439
|
-
#
|
440
|
-
#
|
441
|
-
#
|
442
|
-
#
|
443
|
-
#
|
444
|
-
# 1. install_<distro>_<
|
445
|
-
# 2. install_<distro>_<
|
446
|
-
# 3. install_<distro>_<
|
447
|
-
# 4
|
836
|
+
# Optionally, define a post install function, one of:
|
837
|
+
# 1. install_<distro>_<major_version>_<install_type>_post
|
838
|
+
# 2. install_<distro>_<major_version>_<minor_version>_<install_type>_post
|
839
|
+
# 3. install_<distro>_<major_version>_post
|
840
|
+
# 4 install_<distro>_<major_version>_<minor_version>_post
|
841
|
+
# 5. install_<distro>_<install_type>_post
|
842
|
+
# 6. install_<distro>_post
|
843
|
+
#
|
844
|
+
# Optionally, define a start daemons function, one of:
|
845
|
+
# 1. install_<distro>_<major_version>_<install_type>_restart_daemons
|
846
|
+
# 2. install_<distro>_<major_version>_<minor_version>_<install_type>_restart_daemons
|
847
|
+
# 3. install_<distro>_<major_version>_restart_daemons
|
848
|
+
# 4 install_<distro>_<major_version>_<minor_version>_restart_daemons
|
849
|
+
# 5. install_<distro>_<install_type>_restart_daemons
|
850
|
+
# 6. install_<distro>_restart_daemons
|
851
|
+
#
|
852
|
+
# NOTE: The start daemons function should be able to restart any daemons
|
853
|
+
# which are running, or start if they're not running.
|
448
854
|
#
|
449
855
|
##############################################################################
|
450
856
|
|
857
|
+
|
451
858
|
##############################################################################
|
452
859
|
#
|
453
860
|
# Ubuntu Install Functions
|
454
861
|
#
|
455
862
|
install_ubuntu_deps() {
|
456
863
|
apt-get update
|
457
|
-
|
458
|
-
|
864
|
+
if [ $DISTRO_MAJOR_VERSION -eq 12 ] && [ $DISTRO_MINOR_VERSION -gt 04 ] || [ $DISTRO_MAJOR_VERSION -gt 12 ]; then
|
865
|
+
# Above Ubuntu 12.04 add-apt-repository is in a different package
|
866
|
+
__apt_get_noinput software-properties-common
|
867
|
+
else
|
868
|
+
__apt_get_noinput python-software-properties
|
869
|
+
fi
|
870
|
+
if [ $DISTRO_MAJOR_VERSION -lt 11 ] && [ $DISTRO_MINOR_VERSION -lt 10 ]; then
|
871
|
+
add-apt-repository ppa:saltstack/salt
|
872
|
+
else
|
873
|
+
add-apt-repository -y ppa:saltstack/salt
|
874
|
+
fi
|
459
875
|
apt-get update
|
460
876
|
}
|
461
877
|
|
462
|
-
|
878
|
+
install_ubuntu_daily_deps() {
|
463
879
|
apt-get update
|
464
|
-
|
465
|
-
|
880
|
+
if [ $DISTRO_MAJOR_VERSION -eq 12 ] && [ $DISTRO_MINOR_VERSION -gt 04 ] || [ $DISTRO_MAJOR_VERSION -gt 12 ]; then
|
881
|
+
# Above Ubuntu 12.04 add-apt-repository is in a different package
|
882
|
+
__apt_get_noinput software-properties-common
|
883
|
+
else
|
884
|
+
__apt_get_noinput python-software-properties
|
885
|
+
fi
|
886
|
+
if [ $DISTRO_MAJOR_VERSION -lt 11 ] && [ $DISTRO_MINOR_VERSION -lt 10 ]; then
|
887
|
+
add-apt-repository ppa:saltstack/salt-daily
|
888
|
+
else
|
889
|
+
add-apt-repository -y ppa:saltstack/salt-daily
|
890
|
+
fi
|
466
891
|
apt-get update
|
467
|
-
__apt_get_noinput salt-minion
|
468
|
-
}
|
469
|
-
|
470
|
-
install_ubuntu_1004_git_deps() {
|
471
|
-
install_ubuntu_1004_deps
|
472
|
-
__apt_get_noinput git-core
|
473
892
|
}
|
474
893
|
|
475
|
-
|
894
|
+
install_ubuntu_11_10_deps() {
|
476
895
|
apt-get update
|
477
896
|
__apt_get_noinput python-software-properties
|
478
897
|
add-apt-repository -y 'deb http://us.archive.ubuntu.com/ubuntu/ oneiric universe'
|
479
898
|
add-apt-repository -y ppa:saltstack/salt
|
480
|
-
}
|
481
|
-
|
482
|
-
install_ubuntu_daily_deps() {
|
483
|
-
apt-get update
|
484
|
-
__apt_get_noinput python-software-properties
|
485
|
-
add-apt-repository -y ppa:saltstack/salt-depends
|
486
|
-
add-apt-repository -y ppa:saltstack/salt-daily
|
487
899
|
apt-get update
|
488
900
|
}
|
489
901
|
|
490
902
|
install_ubuntu_git_deps() {
|
491
|
-
|
492
|
-
__apt_get_noinput python-software-properties
|
493
|
-
add-apt-repository ppa:saltstack/salt
|
494
|
-
apt-get update
|
903
|
+
install_ubuntu_deps
|
495
904
|
__apt_get_noinput git-core python-yaml python-m2crypto python-crypto msgpack-python python-zmq python-jinja2
|
905
|
+
|
906
|
+
__git_clone_and_checkout || return 1
|
907
|
+
|
908
|
+
# Let's trigger config_salt()
|
909
|
+
if [ "$TEMP_CONFIG_DIR" = "null" ]; then
|
910
|
+
TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/"
|
911
|
+
CONFIG_SALT_FUNC="config_salt"
|
912
|
+
fi
|
913
|
+
|
914
|
+
return 0
|
496
915
|
}
|
497
916
|
|
498
|
-
|
917
|
+
install_ubuntu_11_10_post() {
|
499
918
|
add-apt-repository -y --remove 'deb http://us.archive.ubuntu.com/ubuntu/ oneiric universe'
|
500
919
|
}
|
501
920
|
|
502
921
|
install_ubuntu_stable() {
|
503
|
-
|
922
|
+
packages=""
|
923
|
+
if [ $INSTALL_MINION -eq $BS_TRUE ]; then
|
924
|
+
packages="${packages} salt-minion"
|
925
|
+
fi
|
926
|
+
if [ $INSTALL_MASTER -eq $BS_TRUE ]; then
|
927
|
+
packages="${packages} salt-master"
|
928
|
+
fi
|
929
|
+
if [ $INSTALL_SYNDIC -eq $BS_TRUE ]; then
|
930
|
+
packages="${packages} salt-syndic"
|
931
|
+
fi
|
932
|
+
__apt_get_noinput ${packages}
|
504
933
|
}
|
505
934
|
|
506
935
|
install_ubuntu_daily() {
|
507
|
-
|
936
|
+
install_ubuntu_stable
|
508
937
|
}
|
509
938
|
|
510
939
|
install_ubuntu_git() {
|
511
|
-
__git_clone_and_checkout
|
512
940
|
python setup.py install --install-layout=deb
|
513
941
|
}
|
514
942
|
|
515
943
|
install_ubuntu_git_post() {
|
516
|
-
for fname in
|
517
|
-
|
518
|
-
|
519
|
-
|
944
|
+
for fname in minion master syndic; do
|
945
|
+
|
946
|
+
# Skip if not meant to be installed
|
947
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
948
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
949
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
950
|
+
|
951
|
+
if [ -f /sbin/initctl ]; then
|
952
|
+
# We have upstart support
|
953
|
+
echodebug "There's upstart support"
|
954
|
+
/sbin/initctl status salt-$fname > /dev/null 2>&1
|
955
|
+
|
956
|
+
if [ $? -eq 1 ]; then
|
957
|
+
# upstart does not know about our service, let's copy the proper file
|
958
|
+
echowarn "Upstart does not apparently know anything about salt-$fname"
|
959
|
+
echodebug "Copying ${SALT_GIT_CHECKOUT_DIR}/pkg/salt-$fname.upstart to /etc/init/salt-$fname.conf"
|
960
|
+
copyfile ${SALT_GIT_CHECKOUT_DIR}/pkg/salt-$fname.upstart /etc/init/salt-$fname.conf
|
961
|
+
fi
|
962
|
+
# No upstart support in Ubuntu!?
|
963
|
+
elif [ -f ${SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init ]; then
|
964
|
+
echodebug "There's NO upstart support!?"
|
965
|
+
echodebug "Copying ${SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init to /etc/init.d/salt-$fname"
|
966
|
+
copyfile ${SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init /etc/init.d/salt-$fname
|
967
|
+
chmod +x /etc/init.d/salt-$fname
|
968
|
+
update-rc.d salt-$fname defaults
|
969
|
+
else
|
970
|
+
echoerror "Neither upstart not init.d was setup for salt-$fname"
|
520
971
|
fi
|
521
|
-
|
522
|
-
|
972
|
+
done
|
973
|
+
}
|
974
|
+
|
975
|
+
install_ubuntu_restart_daemons() {
|
976
|
+
for fname in minion master syndic; do
|
977
|
+
|
978
|
+
# Skip if not meant to be installed
|
979
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
980
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
981
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
982
|
+
|
983
|
+
if [ -f /sbin/initctl ]; then
|
984
|
+
echodebug "There's upstart support"
|
985
|
+
/sbin/initctl status salt-$fname || \
|
986
|
+
echowarn "Upstart does not apparently know anything about salt-$fname"
|
987
|
+
if [ $? -eq 0 ]; then
|
988
|
+
echodebug "Upstart apparently knows about salt-$fname"
|
989
|
+
# upstart knows about this service, let's stop and start it.
|
990
|
+
# We could restart but earlier versions of the upstart script
|
991
|
+
# did not support restart, so, it's safer this way
|
992
|
+
/sbin/initctl stop salt-$fname || echodebug "Failed to stop salt-$fname"
|
993
|
+
/sbin/initctl start salt-$fname
|
994
|
+
[ $? -eq 0 ] && continue
|
995
|
+
# We failed to start the service, let's test the SysV code bellow
|
996
|
+
echodebug "Failed to start salt-$fname"
|
997
|
+
fi
|
523
998
|
fi
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
999
|
+
|
1000
|
+
if [ ! -f /etc/init.d/salt-$fname ]; then
|
1001
|
+
echoerror "No init.d support for salt-$fname was found"
|
1002
|
+
return 1
|
528
1003
|
fi
|
529
|
-
|
530
|
-
|
1004
|
+
|
1005
|
+
/etc/init.d/salt-$fname stop > /dev/null 2>&1
|
1006
|
+
/etc/init.d/salt-$fname start
|
531
1007
|
done
|
1008
|
+
return 0
|
532
1009
|
}
|
533
1010
|
#
|
534
1011
|
# End of Ubuntu Install Functions
|
@@ -537,139 +1014,283 @@ install_ubuntu_git_post() {
|
|
537
1014
|
|
538
1015
|
##############################################################################
|
539
1016
|
#
|
540
|
-
#
|
1017
|
+
# Trisquel(Ubuntu) Install Functions
|
541
1018
|
#
|
542
|
-
|
543
|
-
|
1019
|
+
# Trisquel 6.0 is based on Ubuntu 12.04
|
1020
|
+
#
|
1021
|
+
install_trisquel_6_stable_deps() {
|
544
1022
|
apt-get update
|
545
|
-
|
546
|
-
|
547
|
-
install_debian_stable() {
|
548
|
-
__apt_get_noinput salt-minion
|
549
|
-
}
|
550
|
-
|
551
|
-
install_debian_60_deps() {
|
552
|
-
echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> \
|
553
|
-
/etc/apt/sources.list.d/backports.list
|
554
|
-
|
555
|
-
# Add madduck's repo since squeeze packages have been deprecated
|
556
|
-
for i in {salt-common,salt-master,salt-minion,salt-syndic,salt-doc}; do
|
557
|
-
echo "Package: $i"
|
558
|
-
echo "Pin: release a=squeeze-backports"
|
559
|
-
echo "Pin-Priority: 600"
|
560
|
-
echo
|
561
|
-
done > /etc/apt/preferences.d/local-salt-backport.pref
|
562
|
-
|
563
|
-
cat <<_eof > /etc/apt/sources.list.d/local-madduck-backports.list
|
564
|
-
deb http://debian.madduck.net/repo squeeze-backports main
|
565
|
-
deb-src http://debian.madduck.net/repo squeeze-backports main
|
566
|
-
_eof
|
567
|
-
|
568
|
-
wget -q http://debian.madduck.net/repo/gpg/archive.key
|
569
|
-
apt-key add archive.key
|
1023
|
+
__apt_get_noinput python-software-properties
|
1024
|
+
add-apt-repository -y ppa:saltstack/salt
|
570
1025
|
apt-get update
|
571
1026
|
}
|
572
1027
|
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
install_debian_git_deps() {
|
1028
|
+
install_trisquel_6_daily_deps() {
|
1029
|
+
apt-get update
|
1030
|
+
__apt_get_noinput python-software-properties
|
1031
|
+
add-apt-repository -y ppa:saltstack/salt-daily
|
578
1032
|
apt-get update
|
579
|
-
__apt_get_noinput lsb-release python python-pkg-resources python-crypto \
|
580
|
-
python-jinja2 python-m2crypto python-yaml msgpack-python git python-zmq
|
581
1033
|
}
|
582
1034
|
|
583
|
-
|
584
|
-
|
585
|
-
python
|
1035
|
+
install_trisquel_6_git_deps() {
|
1036
|
+
install_trisquel_6_stable_deps
|
1037
|
+
__apt_get_noinput git-core python-yaml python-m2crypto python-crypto \
|
1038
|
+
msgpack-python python-zmq python-jinja2
|
586
1039
|
|
587
|
-
|
1040
|
+
__git_clone_and_checkout || return 1
|
1041
|
+
|
1042
|
+
# Let's trigger config_salt()
|
588
1043
|
if [ "$TEMP_CONFIG_DIR" = "null" ]; then
|
589
1044
|
TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/"
|
590
|
-
|
1045
|
+
CONFIG_SALT_FUNC="config_salt"
|
591
1046
|
fi
|
592
|
-
}
|
593
1047
|
|
594
|
-
|
595
|
-
install_debian_60_deps # Add backports
|
596
|
-
install_debian_git_deps # Grab the actual deps
|
1048
|
+
return 0
|
597
1049
|
}
|
598
1050
|
|
599
|
-
|
600
|
-
|
1051
|
+
install_trisquel_6_stable() {
|
1052
|
+
install_ubuntu_stable
|
1053
|
+
}
|
601
1054
|
|
602
|
-
|
1055
|
+
install_trisquel_6_daily() {
|
1056
|
+
install_ubuntu_daily
|
1057
|
+
}
|
603
1058
|
|
604
|
-
|
1059
|
+
install_trisquel_6_git() {
|
1060
|
+
install_ubuntu_git
|
1061
|
+
}
|
605
1062
|
|
606
|
-
|
607
|
-
|
608
|
-
TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/"
|
609
|
-
CONFIG_MINION_FUNC="config_minion"
|
610
|
-
fi
|
1063
|
+
install_trisquel_git_post() {
|
1064
|
+
install_ubuntu_git_post
|
611
1065
|
}
|
612
1066
|
|
613
|
-
|
614
|
-
|
615
|
-
if [ $fname != "minion" ]; then
|
616
|
-
# Guess we should only enable and start the minion service. Right??
|
617
|
-
continue
|
618
|
-
fi
|
619
|
-
if [ -f ${SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init ]; then
|
620
|
-
cp ${SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init /etc/init.d/salt-$fname
|
621
|
-
fi
|
622
|
-
chmod +x /etc/init.d/salt-$fname
|
623
|
-
/etc/init.d/salt-$fname start
|
624
|
-
done
|
1067
|
+
install_trisquel_restart_daemons() {
|
1068
|
+
install_ubuntu_restart_daemons
|
625
1069
|
}
|
626
1070
|
#
|
627
|
-
#
|
1071
|
+
# End of Tristel(Ubuntu) Install Functions
|
628
1072
|
#
|
629
1073
|
##############################################################################
|
630
1074
|
|
631
1075
|
##############################################################################
|
632
1076
|
#
|
633
|
-
#
|
1077
|
+
# Debian Install Functions
|
634
1078
|
#
|
635
|
-
|
636
|
-
|
1079
|
+
install_debian_deps() {
|
1080
|
+
apt-get update
|
637
1081
|
}
|
638
1082
|
|
639
|
-
|
640
|
-
|
641
|
-
|
1083
|
+
install_debian_6_0_deps() {
|
1084
|
+
[ $PIP_ALLOWED -eq $BS_FALSE ] && pip_not_allowed
|
1085
|
+
echowarn "PyZMQ will be installed from PyPi in order to compile it against ZMQ3"
|
1086
|
+
echowarn "This is required for long term stable minion connections to the master."
|
642
1087
|
|
1088
|
+
# No user interaction, libc6 restart services for example
|
1089
|
+
export DEBIAN_FRONTEND=noninteractive
|
643
1090
|
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
1091
|
+
if [ "x$(grep -R 'backports.debian.org' /etc/apt)" = "x" ]; then
|
1092
|
+
echo "deb http://backports.debian.org/debian-backports squeeze-backports main" >> \
|
1093
|
+
/etc/apt/sources.list.d/backports.list
|
1094
|
+
fi
|
648
1095
|
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
1096
|
+
if [ ! -f /etc/apt/preferences.d/local-salt-backport.pref ]; then
|
1097
|
+
# Add madduck's repo since squeeze packages have been deprecated
|
1098
|
+
for fname in salt-common salt-master salt-minion salt-syndic salt-doc; do
|
1099
|
+
echo "Package: $fname"
|
1100
|
+
echo "Pin: release a=squeeze-backports"
|
1101
|
+
echo "Pin-Priority: 600"
|
1102
|
+
echo
|
1103
|
+
done > /etc/apt/preferences.d/local-salt-backport.pref
|
653
1104
|
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
1105
|
+
cat <<_eof > /etc/apt/sources.list.d/local-madduck-backports.list
|
1106
|
+
deb http://debian.madduck.net/repo squeeze-backports main
|
1107
|
+
deb-src http://debian.madduck.net/repo squeeze-backports main
|
1108
|
+
_eof
|
1109
|
+
|
1110
|
+
wget -q http://debian.madduck.net/repo/gpg/archive.key -O - | apt-key add -
|
1111
|
+
fi
|
1112
|
+
|
1113
|
+
if [ ! -f /etc/apt/sources.list.d/debian-experimental.list ]; then
|
1114
|
+
cat <<_eof > /etc/apt/sources.list.d/debian-experimental.list
|
1115
|
+
deb http://ftp.debian.org/debian experimental main
|
1116
|
+
deb-src http://ftp.debian.org/debian experimental main
|
1117
|
+
_eof
|
1118
|
+
|
1119
|
+
cat <<_eof > /etc/apt/preferences.d/libzmq3-debian-experimental.pref
|
1120
|
+
Package: libzmq3
|
1121
|
+
Pin: release a=experimental
|
1122
|
+
Pin-Priority: 800
|
1123
|
+
|
1124
|
+
Package: libzmq3-dev
|
1125
|
+
Pin: release a=experimental
|
1126
|
+
Pin-Priority: 800
|
1127
|
+
_eof
|
1128
|
+
fi
|
1129
|
+
|
1130
|
+
apt-get update
|
1131
|
+
__apt_get_noinput -t experimental libzmq3 libzmq3-dev
|
1132
|
+
__apt_get_noinput build-essential python-dev python-pip
|
1133
|
+
}
|
1134
|
+
|
1135
|
+
install_debian_git_deps() {
|
1136
|
+
[ $PIP_ALLOWED -eq $BS_FALSE ] && pip_not_allowed
|
1137
|
+
echowarn "PyZMQ will be installed from PyPi in order to compile it against ZMQ3"
|
1138
|
+
echowarn "This is required for long term stable minion connections to the master."
|
1139
|
+
|
1140
|
+
# No user interaction, libc6 restart services for example
|
1141
|
+
export DEBIAN_FRONTEND=noninteractive
|
1142
|
+
|
1143
|
+
apt-get update
|
1144
|
+
__apt_get_noinput lsb-release python python-pkg-resources python-crypto \
|
1145
|
+
python-jinja2 python-m2crypto python-yaml msgpack-python python-pip git
|
1146
|
+
|
1147
|
+
__git_clone_and_checkout || return 1
|
1148
|
+
|
1149
|
+
# Let's trigger config_salt()
|
1150
|
+
if [ "$TEMP_CONFIG_DIR" = "null" ]; then
|
1151
|
+
TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/"
|
1152
|
+
CONFIG_SALT_FUNC="config_salt"
|
1153
|
+
fi
|
1154
|
+
|
1155
|
+
return 0
|
1156
|
+
}
|
1157
|
+
|
1158
|
+
install_debian_6_0_git_deps() {
|
1159
|
+
install_debian_6_0_deps # Add backports
|
1160
|
+
install_debian_git_deps # Grab the actual deps
|
1161
|
+
}
|
1162
|
+
|
1163
|
+
install_debian_stable() {
|
1164
|
+
packages=""
|
1165
|
+
if [ $INSTALL_MINION -eq $BS_TRUE ]; then
|
1166
|
+
packages="${packages} salt-minion"
|
1167
|
+
fi
|
1168
|
+
if [ $INSTALL_MASTER -eq $BS_TRUE ]; then
|
1169
|
+
packages="${packages} salt-master"
|
1170
|
+
fi
|
1171
|
+
if [ $INSTALL_SYNDIC -eq $BS_TRUE ]; then
|
1172
|
+
packages="${packages} salt-syndic"
|
1173
|
+
fi
|
1174
|
+
__apt_get_noinput ${packages}
|
1175
|
+
|
1176
|
+
# Building pyzmq from source to build it against libzmq3.
|
1177
|
+
# Should override current installation
|
1178
|
+
pip install -U pyzmq
|
1179
|
+
}
|
1180
|
+
|
1181
|
+
|
1182
|
+
install_debian_6_0() {
|
1183
|
+
install_debian_stable
|
1184
|
+
}
|
1185
|
+
|
1186
|
+
install_debian_git() {
|
1187
|
+
python setup.py install --install-layout=deb
|
1188
|
+
|
1189
|
+
# Building pyzmq from source to build it against libzmq3.
|
1190
|
+
# Should override current installation
|
1191
|
+
pip install -U pyzmq
|
1192
|
+
}
|
1193
|
+
|
1194
|
+
install_debian_6_0_git() {
|
1195
|
+
install_debian_git
|
1196
|
+
}
|
1197
|
+
|
1198
|
+
install_debian_git_post() {
|
1199
|
+
for fname in minion master syndic; do
|
1200
|
+
|
1201
|
+
# Skip if not meant to be installed
|
1202
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
1203
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
1204
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
1205
|
+
|
1206
|
+
if [ -f ${SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init ]; then
|
1207
|
+
copyfile ${SALT_GIT_CHECKOUT_DIR}/debian/salt-$fname.init /etc/init.d/salt-$fname
|
659
1208
|
fi
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
1209
|
+
chmod +x /etc/init.d/salt-$fname
|
1210
|
+
update-rc.d salt-$fname defaults
|
1211
|
+
done
|
1212
|
+
}
|
1213
|
+
|
1214
|
+
install_debian_restart_daemons() {
|
1215
|
+
for fname in minion master syndic; do
|
1216
|
+
|
1217
|
+
# Skip if not meant to be installed
|
1218
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
1219
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
1220
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
1221
|
+
|
1222
|
+
/etc/init.d/salt-$fname stop > /dev/null 2>&1
|
1223
|
+
/etc/init.d/salt-$fname start
|
1224
|
+
done
|
1225
|
+
}
|
1226
|
+
#
|
1227
|
+
# Ended Debian Install Functions
|
1228
|
+
#
|
1229
|
+
##############################################################################
|
1230
|
+
|
1231
|
+
##############################################################################
|
1232
|
+
#
|
1233
|
+
# Fedora Install Functions
|
1234
|
+
#
|
1235
|
+
install_fedora_deps() {
|
1236
|
+
yum install -y PyYAML libyaml m2crypto python-crypto python-jinja2 python-msgpack python-zmq
|
1237
|
+
}
|
1238
|
+
|
1239
|
+
install_fedora_stable() {
|
1240
|
+
packages=""
|
1241
|
+
if [ $INSTALL_MINION -eq $BS_TRUE ]; then
|
1242
|
+
packages="${packages} salt-minion"
|
1243
|
+
fi
|
1244
|
+
if [ $INSTALL_MASTER -eq $BS_TRUE ] || [ $INSTALL_SYNDIC -eq $BS_TRUE ]; then
|
1245
|
+
packages="${packages} salt-master"
|
1246
|
+
fi
|
1247
|
+
yum install -y ${packages}
|
1248
|
+
}
|
1249
|
+
|
1250
|
+
install_fedora_git_deps() {
|
1251
|
+
install_fedora_deps
|
1252
|
+
yum install -y git
|
1253
|
+
|
1254
|
+
__git_clone_and_checkout || return 1
|
1255
|
+
|
1256
|
+
# Let's trigger config_salt()
|
1257
|
+
if [ "$TEMP_CONFIG_DIR" = "null" ]; then
|
1258
|
+
TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/"
|
1259
|
+
CONFIG_SALT_FUNC="config_salt"
|
1260
|
+
fi
|
1261
|
+
|
1262
|
+
return 0
|
1263
|
+
}
|
1264
|
+
|
1265
|
+
install_fedora_git() {
|
1266
|
+
python setup.py install
|
1267
|
+
}
|
1268
|
+
|
1269
|
+
install_fedora_git_post() {
|
1270
|
+
for fname in minion master syndic; do
|
1271
|
+
|
1272
|
+
# Skip if not meant to be installed
|
1273
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
1274
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
1275
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
1276
|
+
|
1277
|
+
copyfile ${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname.service /lib/systemd/system/salt-$fname.service
|
1278
|
+
|
1279
|
+
systemctl is-enabled salt-$fname.service || (systemctl preset salt-$fname.service && systemctl enable salt-$fname.service)
|
1280
|
+
sleep 0.1
|
671
1281
|
systemctl daemon-reload
|
672
|
-
|
1282
|
+
done
|
1283
|
+
}
|
1284
|
+
|
1285
|
+
install_fedora_restart_daemons() {
|
1286
|
+
for fname in minion master syndic; do
|
1287
|
+
|
1288
|
+
# Skip if not meant to be installed
|
1289
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
1290
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
1291
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
1292
|
+
|
1293
|
+
systemctl stop salt-$fname > /dev/null 2>&1
|
673
1294
|
systemctl start salt-$fname.service
|
674
1295
|
done
|
675
1296
|
}
|
@@ -682,85 +1303,391 @@ install_fedora_git_post() {
|
|
682
1303
|
#
|
683
1304
|
# CentOS Install Functions
|
684
1305
|
#
|
685
|
-
|
1306
|
+
install_centos_stable_deps() {
|
686
1307
|
if [ $CPU_ARCH_L = "i686" ]; then
|
687
|
-
|
1308
|
+
EPEL_ARCH="i386"
|
1309
|
+
else
|
1310
|
+
EPEL_ARCH=$CPU_ARCH_L
|
1311
|
+
fi
|
1312
|
+
if [ $DISTRO_MAJOR_VERSION -eq 5 ]; then
|
1313
|
+
rpm -Uvh --force http://mirrors.kernel.org/fedora-epel/5/${EPEL_ARCH}/epel-release-5-4.noarch.rpm
|
1314
|
+
elif [ $DISTRO_MAJOR_VERSION -eq 6 ]; then
|
1315
|
+
rpm -Uvh --force http://mirrors.kernel.org/fedora-epel/6/${EPEL_ARCH}/epel-release-6-8.noarch.rpm
|
688
1316
|
else
|
689
|
-
|
1317
|
+
echoerror "Failed add EPEL repository support."
|
1318
|
+
exit 1
|
690
1319
|
fi
|
691
|
-
|
1320
|
+
|
692
1321
|
yum -y update
|
1322
|
+
|
1323
|
+
if [ $DISTRO_MAJOR_VERSION -eq 5 ]; then
|
1324
|
+
yum -y install PyYAML python26-m2crypto m2crypto python26 python26-crypto \
|
1325
|
+
python26-msgpack python26-zmq python26-jinja2 --enablerepo=epel-testing
|
1326
|
+
else
|
1327
|
+
yum -y install PyYAML m2crypto python-crypto python-msgpack python-zmq \
|
1328
|
+
python-jinja2 --enablerepo=epel-testing
|
1329
|
+
fi
|
693
1330
|
}
|
694
1331
|
|
695
|
-
|
696
|
-
|
1332
|
+
install_centos_stable() {
|
1333
|
+
packages=""
|
1334
|
+
if [ $INSTALL_MINION -eq $BS_TRUE ]; then
|
1335
|
+
packages="${packages} salt-minion"
|
1336
|
+
fi
|
1337
|
+
if [ $INSTALL_MASTER -eq $BS_TRUE ] || [ $INSTALL_SYNDIC -eq $BS_TRUE ]; then
|
1338
|
+
packages="${packages} salt-master"
|
1339
|
+
fi
|
1340
|
+
yum -y install ${packages} --enablerepo=epel-testing
|
697
1341
|
}
|
698
1342
|
|
699
|
-
|
700
|
-
|
701
|
-
|
1343
|
+
install_centos_stable_post() {
|
1344
|
+
for fname in minion master syndic; do
|
1345
|
+
# Skip if not meant to be installed
|
1346
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
1347
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
1348
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
1349
|
+
|
1350
|
+
if [ ! -f /sbin/initctl ] && [ -f /etc/init.d/salt-$fname ]; then
|
1351
|
+
# Still in SysV init!?
|
1352
|
+
/sbin/chkconfig salt-$fname on
|
1353
|
+
fi
|
1354
|
+
done
|
702
1355
|
}
|
703
1356
|
|
704
|
-
|
705
|
-
|
706
|
-
yum -y install git
|
1357
|
+
install_centos_git_deps() {
|
1358
|
+
install_centos_stable_deps
|
1359
|
+
yum -y install git --enablerepo=epel-testing
|
1360
|
+
|
1361
|
+
__git_clone_and_checkout || return 1
|
1362
|
+
|
1363
|
+
# Let's trigger config_salt()
|
1364
|
+
if [ "$TEMP_CONFIG_DIR" = "null" ]; then
|
1365
|
+
TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/"
|
1366
|
+
CONFIG_SALT_FUNC="config_salt"
|
1367
|
+
fi
|
1368
|
+
|
1369
|
+
return 0
|
707
1370
|
}
|
708
1371
|
|
709
|
-
|
710
|
-
|
711
|
-
|
1372
|
+
install_centos_git() {
|
1373
|
+
if [ $DISTRO_MAJOR_VERSION -eq 5 ]; then
|
1374
|
+
python2.6 setup.py install
|
1375
|
+
else
|
1376
|
+
python2 setup.py install
|
1377
|
+
fi
|
1378
|
+
}
|
712
1379
|
|
713
|
-
|
714
|
-
|
715
|
-
|
1380
|
+
install_centos_git_post() {
|
1381
|
+
for fname in master minion syndic; do
|
1382
|
+
|
1383
|
+
# Skip if not meant to be installed
|
1384
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
1385
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
1386
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
1387
|
+
|
1388
|
+
if [ -f /sbin/initctl ]; then
|
1389
|
+
# We have upstart support
|
1390
|
+
/sbin/initctl status salt-$fname > /dev/null 2>&1
|
1391
|
+
if [ $? -eq 1 ]; then
|
1392
|
+
# upstart does not know about our service, let's copy the proper file
|
1393
|
+
copyfile ${SALT_GIT_CHECKOUT_DIR}/pkg/salt-$fname.upstart /etc/init/salt-$fname.conf
|
1394
|
+
fi
|
1395
|
+
# Still in SysV init?!
|
1396
|
+
elif [ ! -f /etc/init.d/salt-$fname ]; then
|
1397
|
+
copyfile ${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-${fname} /etc/init.d/
|
1398
|
+
chmod +x /etc/init.d/salt-${fname}
|
1399
|
+
/sbin/chkconfig salt-${fname} on
|
1400
|
+
fi
|
1401
|
+
done
|
716
1402
|
}
|
717
1403
|
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
1404
|
+
install_centos_restart_daemons() {
|
1405
|
+
for fname in minion master syndic; do
|
1406
|
+
# Skip if not meant to be installed
|
1407
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
1408
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
1409
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
1410
|
+
|
1411
|
+
if [ -f /sbin/initctl ]; then
|
1412
|
+
# We have upstart support
|
1413
|
+
/sbin/initctl status salt-$fname > /dev/null 2>&1
|
1414
|
+
if [ $? -eq 0 ]; then
|
1415
|
+
# upstart knows about this service.
|
1416
|
+
# Let's try to stop it, and then start it
|
1417
|
+
/sbin/initctl stop salt-$fname > /dev/null 2>&1
|
1418
|
+
/sbin/initctl start salt-$fname > /dev/null 2>&1
|
1419
|
+
# Restart service
|
1420
|
+
[ $? -eq 0 ] && continue
|
1421
|
+
# We failed to start the service, let's test the SysV code bellow
|
1422
|
+
fi
|
1423
|
+
fi
|
1424
|
+
|
1425
|
+
if [ -f /etc/init.d/salt-$fname ]; then
|
1426
|
+
# Still in SysV init!?
|
1427
|
+
/etc/init.d/salt-$fname stop > /dev/null 2>&1
|
1428
|
+
/etc/init.d/salt-$fname start
|
1429
|
+
fi
|
1430
|
+
done
|
723
1431
|
}
|
724
1432
|
#
|
725
1433
|
# Ended CentOS Install Functions
|
726
1434
|
#
|
727
1435
|
##############################################################################
|
728
1436
|
|
1437
|
+
##############################################################################
|
1438
|
+
#
|
1439
|
+
# RedHat Install Functions
|
1440
|
+
#
|
1441
|
+
install_red_hat_linux_stable_deps() {
|
1442
|
+
install_centos_stable_deps
|
1443
|
+
}
|
1444
|
+
|
1445
|
+
install_red_hat_linux_git_deps() {
|
1446
|
+
install_centos_git_deps
|
1447
|
+
}
|
1448
|
+
|
1449
|
+
install_red_hat_enterprise_linux_stable_deps() {
|
1450
|
+
install_red_hat_linux_stable_deps
|
1451
|
+
}
|
1452
|
+
|
1453
|
+
install_red_hat_enterprise_linux_git_deps() {
|
1454
|
+
install_red_hat_linux_git_deps
|
1455
|
+
}
|
1456
|
+
|
1457
|
+
install_red_hat_enterprise_server_stable_deps() {
|
1458
|
+
install_red_hat_linux_stable_deps
|
1459
|
+
}
|
1460
|
+
|
1461
|
+
install_red_hat_enterprise_server_git_deps() {
|
1462
|
+
install_red_hat_linux_git_deps
|
1463
|
+
}
|
1464
|
+
|
1465
|
+
install_red_hat_linux_stable() {
|
1466
|
+
install_centos_stable
|
1467
|
+
}
|
1468
|
+
|
1469
|
+
install_red_hat_linux_git() {
|
1470
|
+
install_centos_git
|
1471
|
+
}
|
1472
|
+
|
1473
|
+
install_red_hat_enterprise_linux_stable() {
|
1474
|
+
install_red_hat_linux_stable
|
1475
|
+
}
|
1476
|
+
|
1477
|
+
install_red_hat_enterprise_linux_git() {
|
1478
|
+
install_red_hat_linux_git
|
1479
|
+
}
|
1480
|
+
|
1481
|
+
install_red_hat_enterprise_server_stable() {
|
1482
|
+
install_red_hat_linux_stable
|
1483
|
+
}
|
1484
|
+
|
1485
|
+
install_red_hat_enterprise_server_git() {
|
1486
|
+
install_red_hat_linux_git
|
1487
|
+
}
|
1488
|
+
|
1489
|
+
install_red_hat_linux_stable_post() {
|
1490
|
+
install_centos_stable_post
|
1491
|
+
}
|
1492
|
+
|
1493
|
+
install_red_hat_linux_restart_daemons() {
|
1494
|
+
install_centos_restart_daemons
|
1495
|
+
}
|
1496
|
+
|
1497
|
+
install_red_hat_linux_git_post() {
|
1498
|
+
install_centos_git_post
|
1499
|
+
}
|
1500
|
+
|
1501
|
+
install_red_hat_enterprise_linux_stable_post() {
|
1502
|
+
install_red_hat_linux_stable_post
|
1503
|
+
}
|
1504
|
+
|
1505
|
+
install_red_hat_enterprise_linux_restart_daemons() {
|
1506
|
+
install_red_hat_linux_restart_daemons
|
1507
|
+
}
|
1508
|
+
|
1509
|
+
install_red_hat_enterprise_linux_git_post() {
|
1510
|
+
install_red_hat_linux_git_post
|
1511
|
+
}
|
1512
|
+
|
1513
|
+
install_red_hat_enterprise_server_stable_post() {
|
1514
|
+
install_red_hat_linux_stable_post
|
1515
|
+
}
|
1516
|
+
|
1517
|
+
install_red_hat_enterprise_server_restart_daemons() {
|
1518
|
+
install_red_hat_linux_restart_daemons
|
1519
|
+
}
|
1520
|
+
|
1521
|
+
install_red_hat_enterprise_server_git_post() {
|
1522
|
+
install_red_hat_linux_git_post
|
1523
|
+
}
|
1524
|
+
#
|
1525
|
+
# Ended RedHat Install Functions
|
1526
|
+
#
|
1527
|
+
##############################################################################
|
1528
|
+
|
1529
|
+
##############################################################################
|
1530
|
+
#
|
1531
|
+
# Amazon Linux AMI Install Functions
|
1532
|
+
#
|
1533
|
+
install_amazon_linux_ami_deps() {
|
1534
|
+
# Acording to http://aws.amazon.com/amazon-linux-ami/faqs/#epel we should
|
1535
|
+
# enable the EPEL 6 repo
|
1536
|
+
if [ $CPU_ARCH_L = "i686" ]; then
|
1537
|
+
EPEL_ARCH="i386"
|
1538
|
+
else
|
1539
|
+
EPEL_ARCH=$CPU_ARCH_L
|
1540
|
+
fi
|
1541
|
+
rpm -Uvh --force http://mirrors.kernel.org/fedora-epel/6/${EPEL_ARCH}/epel-release-6-8.noarch.rpm
|
1542
|
+
yum -y update
|
1543
|
+
yum -y install PyYAML m2crypto python-crypto python-msgpack python-zmq \
|
1544
|
+
python-ordereddict python-jinja2 --enablerepo=epel-testing
|
1545
|
+
}
|
1546
|
+
|
1547
|
+
install_amazon_linux_ami_git_deps() {
|
1548
|
+
install_amazon_linux_ami_deps
|
1549
|
+
yum -y install git --enablerepo=epel-testing
|
1550
|
+
|
1551
|
+
__git_clone_and_checkout || return 1
|
1552
|
+
|
1553
|
+
# Let's trigger config_salt()
|
1554
|
+
if [ "$TEMP_CONFIG_DIR" = "null" ]; then
|
1555
|
+
TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/"
|
1556
|
+
CONFIG_SALT_FUNC="config_salt"
|
1557
|
+
fi
|
1558
|
+
|
1559
|
+
return 0
|
1560
|
+
}
|
1561
|
+
|
1562
|
+
install_amazon_linux_ami_stable() {
|
1563
|
+
install_centos_stable
|
1564
|
+
}
|
1565
|
+
|
1566
|
+
install_amazon_linux_ami_stable_post() {
|
1567
|
+
install_centos_stable_post
|
1568
|
+
}
|
1569
|
+
|
1570
|
+
install_amazon_linux_ami_restart_daemons() {
|
1571
|
+
install_centos_restart_daemons
|
1572
|
+
}
|
1573
|
+
|
1574
|
+
install_amazon_linux_ami_git() {
|
1575
|
+
install_centos_git
|
1576
|
+
}
|
1577
|
+
|
1578
|
+
install_amazon_linux_ami_git_post() {
|
1579
|
+
install_centos_git_post
|
1580
|
+
}
|
1581
|
+
#
|
1582
|
+
# Ended Amazon Linux AMI Install Functions
|
1583
|
+
#
|
1584
|
+
##############################################################################
|
729
1585
|
|
730
1586
|
##############################################################################
|
731
1587
|
#
|
732
1588
|
# Arch Install Functions
|
733
1589
|
#
|
734
|
-
|
735
|
-
echo '[salt]
|
1590
|
+
install_arch_linux_stable_deps() {
|
1591
|
+
grep '\[salt\]' /etc/pacman.conf >/dev/null 2>&1 || echo '[salt]
|
736
1592
|
Server = http://intothesaltmine.org/archlinux
|
737
1593
|
' >> /etc/pacman.conf
|
738
1594
|
}
|
739
1595
|
|
740
|
-
|
741
|
-
echo '[salt]
|
742
|
-
|
743
|
-
|
1596
|
+
install_arch_linux_git_deps() {
|
1597
|
+
grep '\[salt\]' /etc/pacman.conf >/dev/null 2>&1 || echo '[salt]
|
1598
|
+
Server = http://intothesaltmine.org/archlinux
|
1599
|
+
' >> /etc/pacman.conf
|
1600
|
+
|
1601
|
+
pacman -Sy --noconfirm pacman
|
1602
|
+
pacman -Sy --noconfirm git python2-crypto python2-distribute \
|
1603
|
+
python2-jinja python2-m2crypto python2-markupsafe python2-msgpack \
|
1604
|
+
python2-psutil python2-yaml python2-pyzmq zeromq
|
1605
|
+
|
1606
|
+
__git_clone_and_checkout || return 1
|
1607
|
+
|
1608
|
+
# Let's trigger config_salt()
|
1609
|
+
if [ "$TEMP_CONFIG_DIR" = "null" ]; then
|
1610
|
+
TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/"
|
1611
|
+
CONFIG_SALT_FUNC="config_salt"
|
1612
|
+
fi
|
1613
|
+
|
1614
|
+
return 0
|
744
1615
|
}
|
745
1616
|
|
746
|
-
|
1617
|
+
install_arch_linux_stable() {
|
747
1618
|
pacman -Sy --noconfirm pacman
|
748
1619
|
pacman -Syu --noconfirm salt
|
749
1620
|
}
|
750
1621
|
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
rm -rf /usr/lib/python2.7/site-packages/salt*
|
755
|
-
rm -rf /usr/bin/salt-*
|
1622
|
+
install_arch_linux_git() {
|
1623
|
+
python2 setup.py install
|
1624
|
+
}
|
756
1625
|
|
757
|
-
|
1626
|
+
install_arch_linux_post() {
|
1627
|
+
for fname in minion master syndic; do
|
1628
|
+
|
1629
|
+
# Skip if not meant to be installed
|
1630
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
1631
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
1632
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
1633
|
+
|
1634
|
+
if [ -f /usr/bin/systemctl ]; then
|
1635
|
+
# Using systemd
|
1636
|
+
/usr/bin/systemctl is-enabled salt-$fname.service > /dev/null 2>&1 || (
|
1637
|
+
/usr/bin/systemctl preset salt-$fname.service > /dev/null 2>&1 &&
|
1638
|
+
/usr/bin/systemctl enable salt-$fname.service > /dev/null 2>&1
|
1639
|
+
)
|
1640
|
+
sleep 0.1
|
1641
|
+
/usr/bin/systemctl daemon-reload
|
1642
|
+
continue
|
1643
|
+
fi
|
758
1644
|
|
759
|
-
|
1645
|
+
# XXX: How do we enable old Arch init.d scripts?
|
1646
|
+
done
|
1647
|
+
}
|
1648
|
+
|
1649
|
+
install_arch_linux_git_post() {
|
1650
|
+
for fname in minion master syndic; do
|
1651
|
+
|
1652
|
+
# Skip if not meant to be installed
|
1653
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
1654
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
1655
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
1656
|
+
|
1657
|
+
if [ -f /usr/bin/systemctl ]; then
|
1658
|
+
copyfile ${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname.service /lib/systemd/system/salt-$fname.service
|
1659
|
+
|
1660
|
+
/usr/bin/systemctl is-enabled salt-$fname.service > /dev/null 2>&1 || (
|
1661
|
+
/usr/bin/systemctl preset salt-$fname.service > /dev/null 2>&1 &&
|
1662
|
+
/usr/bin/systemctl enable salt-$fname.service > /dev/null 2>&1
|
1663
|
+
)
|
1664
|
+
sleep 0.1
|
1665
|
+
/usr/bin/systemctl daemon-reload
|
1666
|
+
continue
|
1667
|
+
fi
|
1668
|
+
|
1669
|
+
# SysV init!?
|
1670
|
+
copyfile ${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname /etc/rc.d/init.d/salt-$fname
|
1671
|
+
chmod +x /etc/rc.d/init.d/salt-$fname
|
1672
|
+
done
|
760
1673
|
}
|
761
1674
|
|
762
|
-
|
763
|
-
|
1675
|
+
install_arch_linux_restart_daemons() {
|
1676
|
+
for fname in minion master syndic; do
|
1677
|
+
|
1678
|
+
# Skip if not meant to be installed
|
1679
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
1680
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
1681
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
1682
|
+
|
1683
|
+
if [ -f /usr/bin/systemctl ]; then
|
1684
|
+
/usr/bin/systemctl stop salt-$fname.service > /dev/null 2>&1
|
1685
|
+
/usr/bin/systemctl start salt-$fname.service
|
1686
|
+
continue
|
1687
|
+
fi
|
1688
|
+
/etc/rc.d/salt-$fname stop > /dev/null 2>&1
|
1689
|
+
/etc/rc.d/salt-$fname start
|
1690
|
+
done
|
764
1691
|
}
|
765
1692
|
#
|
766
1693
|
# Ended Arch Install Functions
|
@@ -771,101 +1698,483 @@ install_arch_post() {
|
|
771
1698
|
#
|
772
1699
|
# FreeBSD Install Functions
|
773
1700
|
#
|
774
|
-
|
1701
|
+
__freebsd_get_packagesite() {
|
775
1702
|
if [ $CPU_ARCH_L = "amd64" ]; then
|
776
|
-
|
1703
|
+
BSD_ARCH="x86:64"
|
777
1704
|
elif [ $CPU_ARCH_L = "x86_64" ]; then
|
778
|
-
|
1705
|
+
BSD_ARCH="x86:64"
|
779
1706
|
elif [ $CPU_ARCH_L = "i386" ]; then
|
780
|
-
|
1707
|
+
BSD_ARCH="x86:32"
|
781
1708
|
elif [ $CPU_ARCH_L = "i686" ]; then
|
782
|
-
|
1709
|
+
BSD_ARCH="x86:32"
|
783
1710
|
fi
|
784
1711
|
|
785
|
-
|
1712
|
+
if [ "x${PACKAGESITE}" = "x" ]; then
|
1713
|
+
echowarn "The environment variable PACKAGESITE is not set."
|
1714
|
+
echowarn "The installation will, most likely fail since pkgbeta.freebsd.org does not yet contain any packages"
|
1715
|
+
fi
|
1716
|
+
BS_PACKAGESITE=${PACKAGESITE:-"http://pkgbeta.freebsd.org/freebsd:${DISTRO_MAJOR_VERSION}:${BSD_ARCH}/latest"}
|
1717
|
+
}
|
1718
|
+
|
1719
|
+
install_freebsd_9_stable_deps() {
|
1720
|
+
__freebsd_get_packagesite
|
1721
|
+
|
1722
|
+
fetch "${BS_PACKAGESITE}/Latest/pkg.txz"
|
786
1723
|
tar xf ./pkg.txz -s ",/.*/,,g" "*/pkg-static"
|
787
1724
|
./pkg-static add ./pkg.txz
|
788
1725
|
/usr/local/sbin/pkg2ng
|
789
|
-
echo "PACKAGESITE:
|
1726
|
+
echo "PACKAGESITE: ${BS_PACKAGESITE}" > /usr/local/etc/pkg.conf
|
790
1727
|
|
791
1728
|
/usr/local/sbin/pkg install -y swig
|
792
1729
|
}
|
793
1730
|
|
794
1731
|
install_freebsd_git_deps() {
|
795
|
-
|
796
|
-
local ARCH="x86:64"
|
797
|
-
elif [ $CPU_ARCH_L = "x86_64" ]; then
|
798
|
-
local ARCH="x86:64"
|
799
|
-
elif [ $CPU_ARCH_L = "i386" ]; then
|
800
|
-
local ARCH="x86:32"
|
801
|
-
elif [ $CPU_ARCH_L = "i686" ]; then
|
802
|
-
local ARCH="x86:32"
|
803
|
-
fi
|
1732
|
+
__freebsd_get_packagesite
|
804
1733
|
|
805
|
-
fetch
|
1734
|
+
fetch "${BS_PACKAGESITE}/Latest/pkg.txz"
|
806
1735
|
tar xf ./pkg.txz -s ",/.*/,,g" "*/pkg-static"
|
807
1736
|
./pkg-static add ./pkg.txz
|
808
1737
|
/usr/local/sbin/pkg2ng
|
809
|
-
echo "PACKAGESITE:
|
1738
|
+
echo "PACKAGESITE: ${BS_PACKAGESITE}" > /usr/local/etc/pkg.conf
|
810
1739
|
|
811
1740
|
/usr/local/sbin/pkg install -y swig
|
1741
|
+
|
1742
|
+
__git_clone_and_checkout || return 1
|
1743
|
+
# Let's trigger config_salt()
|
1744
|
+
if [ "$TEMP_CONFIG_DIR" = "null" ]; then
|
1745
|
+
TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/"
|
1746
|
+
CONFIG_SALT_FUNC="config_salt"
|
1747
|
+
fi
|
1748
|
+
|
1749
|
+
return 0
|
812
1750
|
}
|
813
1751
|
|
814
|
-
|
815
|
-
/usr/local/sbin/pkg install -y salt
|
1752
|
+
install_freebsd_9_stable() {
|
1753
|
+
/usr/local/sbin/pkg install -y sysutils/py-salt
|
816
1754
|
}
|
817
1755
|
|
818
1756
|
install_freebsd_git() {
|
819
|
-
/usr/local/sbin/pkg install -y git salt
|
820
|
-
/usr/local/sbin/pkg delete -y salt
|
821
|
-
|
822
|
-
__git_clone_and_checkout
|
1757
|
+
/usr/local/sbin/pkg install -y git sysutils/py-salt
|
1758
|
+
/usr/local/sbin/pkg delete -y sysutils/py-salt
|
823
1759
|
|
824
1760
|
/usr/local/bin/python setup.py install
|
825
1761
|
}
|
826
1762
|
|
827
|
-
|
828
|
-
|
1763
|
+
install_freebsd_9_stable_post() {
|
1764
|
+
for fname in minion master syndic; do
|
1765
|
+
|
1766
|
+
# Skip if not meant to be installed
|
1767
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
1768
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
1769
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
1770
|
+
|
1771
|
+
enable_string="salt_${fname}_enable=\"YES\""
|
1772
|
+
grep "$enable_string" /etc/rc.conf >/dev/null 2>&1
|
1773
|
+
[ $? -eq 1 ] && echo "$enable_string" >> /etc/rc.conf
|
1774
|
+
|
1775
|
+
[ -f /usr/local/etc/salt/${fname}.sample ] && copyfile /usr/local/etc/salt/${fname}.sample /usr/local/etc/salt/${fname}
|
1776
|
+
|
1777
|
+
if [ $fname = "minion" ] ; then
|
1778
|
+
grep "salt_minion_paths" /etc/rc.conf >/dev/null 2>&1
|
1779
|
+
[ $? -eq 1 ] && echo "salt_minion_paths=\"/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin\"" >> /etc/rc.conf
|
1780
|
+
fi
|
1781
|
+
|
1782
|
+
done
|
829
1783
|
}
|
830
1784
|
|
831
1785
|
install_freebsd_git_post() {
|
832
|
-
|
1786
|
+
install_freebsd_9_stable_post
|
1787
|
+
}
|
1788
|
+
|
1789
|
+
install_freebsd_restart_daemons() {
|
1790
|
+
for fname in minion master syndic; do
|
1791
|
+
|
1792
|
+
# Skip if not meant to be installed
|
1793
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
1794
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
1795
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
1796
|
+
|
1797
|
+
service salt_$fname stop > /dev/null 2>&1
|
1798
|
+
service salt_$fname start
|
1799
|
+
done
|
833
1800
|
}
|
834
1801
|
#
|
835
1802
|
# Ended FreeBSD Install Functions
|
836
1803
|
#
|
837
1804
|
##############################################################################
|
838
1805
|
|
1806
|
+
##############################################################################
|
1807
|
+
#
|
1808
|
+
# SmartOS Install Functions
|
1809
|
+
#
|
1810
|
+
install_smartos_deps() {
|
1811
|
+
[ $PIP_ALLOWED -eq $BS_FALSE ] && pip_not_allowed
|
1812
|
+
echowarn "PyZMQ will be installed using pip"
|
1813
|
+
|
1814
|
+
ZEROMQ_VERSION='3.2.2'
|
1815
|
+
pkgin -y in libtool-base autoconf automake libuuid gcc-compiler gmake \
|
1816
|
+
python27 py27-pip py27-setuptools py27-yaml py27-crypto swig
|
1817
|
+
[ -d zeromq-${ZEROMQ_VERSION} ] || (
|
1818
|
+
wget http://download.zeromq.org/zeromq-${ZEROMQ_VERSION}.tar.gz &&
|
1819
|
+
tar -xvf zeromq-${ZEROMQ_VERSION}.tar.gz
|
1820
|
+
)
|
1821
|
+
cd zeromq-${ZEROMQ_VERSION}
|
1822
|
+
./configure
|
1823
|
+
make
|
1824
|
+
make install
|
1825
|
+
|
1826
|
+
pip-2.7 install pyzmq
|
1827
|
+
|
1828
|
+
# Let's trigger config_salt()
|
1829
|
+
if [ "$TEMP_CONFIG_DIR" = "null" ]; then
|
1830
|
+
# Let's set the configuration directory to /tmp
|
1831
|
+
TEMP_CONFIG_DIR="/tmp"
|
1832
|
+
CONFIG_SALT_FUNC="config_salt"
|
1833
|
+
|
1834
|
+
# Let's download, since they were not provided, the default configuration files
|
1835
|
+
if [ ! -f /etc/salt/minion ] && [ ! -f $TEMP_CONFIG_DIR/minion ]; then
|
1836
|
+
curl -sk -o $TEMP_CONFIG_DIR/minion -L https://raw.github.com/saltstack/salt/blob/develop/conf/minion
|
1837
|
+
fi
|
1838
|
+
if [ ! -f /etc/salt/master ] && [ ! -f $TEMP_CONFIG_DIR/master ]; then
|
1839
|
+
curl -sk -o $TEMP_CONFIG_DIR/master -L https://raw.github.com/saltstack/salt/blob/develop/conf/master
|
1840
|
+
fi
|
1841
|
+
fi
|
1842
|
+
|
1843
|
+
}
|
1844
|
+
|
1845
|
+
install_smartos_git_deps() {
|
1846
|
+
install_smartos_deps
|
1847
|
+
pkgin -y in scmgit
|
1848
|
+
|
1849
|
+
__git_clone_and_checkout || return 1
|
1850
|
+
# Let's trigger config_salt()
|
1851
|
+
if [ "$TEMP_CONFIG_DIR" = "null" ]; then
|
1852
|
+
TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/"
|
1853
|
+
CONFIG_SALT_FUNC="config_salt"
|
1854
|
+
fi
|
1855
|
+
|
1856
|
+
return 0
|
1857
|
+
}
|
1858
|
+
|
1859
|
+
install_smartos_stable() {
|
1860
|
+
USE_SETUPTOOLS=1 pip-2.7 install salt
|
1861
|
+
}
|
1862
|
+
|
1863
|
+
install_smartos_git() {
|
1864
|
+
# Use setuptools in order to also install dependencies
|
1865
|
+
USE_SETUPTOOLS=1 /opt/local/bin/python setup.py install
|
1866
|
+
}
|
1867
|
+
|
1868
|
+
install_smartos_post() {
|
1869
|
+
# Install manifest files if needed.
|
1870
|
+
for fname in minion master syndic; do
|
1871
|
+
svcs network/salt-$fname > /dev/null 2>&1
|
1872
|
+
if [ $? -eq 1 ]; then
|
1873
|
+
if [ ! -f $TEMP_CONFIG_DIR/salt-$fname.xml ]; then
|
1874
|
+
curl -sk -o $TEMP_CONFIG_DIR/salt-$fname.xml -L https://raw.github.com/saltstack/salt/develop/pkg/solaris/salt-$fname.xml
|
1875
|
+
fi
|
1876
|
+
svccfg import $TEMP_CONFIG_DIR/salt-$fname.xml
|
1877
|
+
fi
|
1878
|
+
done
|
1879
|
+
}
|
1880
|
+
|
1881
|
+
install_smartos_git_post() {
|
1882
|
+
# Install manifest files if needed.
|
1883
|
+
for fname in minion master syndic; do
|
1884
|
+
svcs network/salt-$fname > /dev/null 2>&1
|
1885
|
+
if [ $? -eq 1 ]; then
|
1886
|
+
svccfg import ${SALT_GIT_CHECKOUT_DIR}/pkg/solaris/salt-$fname.xml
|
1887
|
+
fi
|
1888
|
+
done
|
1889
|
+
}
|
1890
|
+
|
1891
|
+
install_smartos_restart_daemons() {
|
1892
|
+
for fname in minion master syndic; do
|
1893
|
+
|
1894
|
+
# Skip if not meant to be installed
|
1895
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
1896
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
1897
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
1898
|
+
|
1899
|
+
# Stop if running && Start service
|
1900
|
+
svcadm disable salt-$fname > /dev/null 2>&1
|
1901
|
+
svcadm enable salt-$fname
|
1902
|
+
done
|
1903
|
+
}
|
1904
|
+
#
|
1905
|
+
# Ended SmartOS Install Functions
|
1906
|
+
#
|
1907
|
+
##############################################################################
|
1908
|
+
|
1909
|
+
##############################################################################
|
1910
|
+
#
|
1911
|
+
# openSUSE Install Functions.
|
1912
|
+
#
|
1913
|
+
install_opensuse_stable_deps() {
|
1914
|
+
DISTRO_REPO="openSUSE_${DISTRO_MAJOR_VERSION}.${DISTRO_MINOR_VERSION}"
|
1915
|
+
zypper --non-interactive addrepo --refresh \
|
1916
|
+
http://download.opensuse.org/repositories/devel:/languages:/python/${DISTRO_REPO}/devel:languages:python.repo
|
1917
|
+
zypper --gpg-auto-import-keys --non-interactive refresh
|
1918
|
+
zypper --non-interactive install --auto-agree-with-licenses libzmq3 python \
|
1919
|
+
python-Jinja2 python-M2Crypto python-PyYAML python-msgpack-python \
|
1920
|
+
python-pycrypto python-pyzmq
|
1921
|
+
}
|
1922
|
+
|
1923
|
+
install_opensuse_git_deps() {
|
1924
|
+
install_opensuse_stable_deps
|
1925
|
+
zypper --non-interactive install --auto-agree-with-licenses git
|
1926
|
+
|
1927
|
+
__git_clone_and_checkout || return 1
|
1928
|
+
|
1929
|
+
# Let's trigger config_salt()
|
1930
|
+
if [ "$TEMP_CONFIG_DIR" = "null" ]; then
|
1931
|
+
TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/"
|
1932
|
+
CONFIG_SALT_FUNC="config_salt"
|
1933
|
+
fi
|
1934
|
+
|
1935
|
+
return 0
|
1936
|
+
}
|
1937
|
+
|
1938
|
+
install_opensuse_stable() {
|
1939
|
+
packages=""
|
1940
|
+
if [ $INSTALL_MINION -eq $BS_TRUE ]; then
|
1941
|
+
packages="${packages} salt-minion"
|
1942
|
+
fi
|
1943
|
+
if [ $INSTALL_MASTER -eq $BS_TRUE ]; then
|
1944
|
+
packages="${packages} salt-master"
|
1945
|
+
fi
|
1946
|
+
if [ $INSTALL_SYNDIC -eq $BS_TRUE ]; then
|
1947
|
+
packages="${packages} salt-syndic"
|
1948
|
+
fi
|
1949
|
+
zypper --non-interactive install --auto-agree-with-licenses $packages
|
1950
|
+
}
|
1951
|
+
|
1952
|
+
install_opensuse_git() {
|
1953
|
+
python setup.py install --prefix=/usr
|
1954
|
+
}
|
1955
|
+
|
1956
|
+
install_opensuse_stable_post() {
|
1957
|
+
for fname in minion master syndic; do
|
1958
|
+
|
1959
|
+
# Skip if not meant to be installed
|
1960
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
1961
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
1962
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
1963
|
+
|
1964
|
+
if [ -f /bin/systemctl ]; then
|
1965
|
+
systemctl is-enabled salt-$fname.service || (systemctl preset salt-$fname.service && systemctl enable salt-$fname.service)
|
1966
|
+
sleep 0.1
|
1967
|
+
systemctl daemon-reload
|
1968
|
+
continue
|
1969
|
+
fi
|
1970
|
+
|
1971
|
+
/sbin/chkconfig --add salt-$fname
|
1972
|
+
/sbin/chkconfig salt-$fname on
|
1973
|
+
|
1974
|
+
done
|
1975
|
+
}
|
1976
|
+
|
1977
|
+
install_opensuse_git_post() {
|
1978
|
+
for fname in minion master syndic; do
|
1979
|
+
|
1980
|
+
# Skip if not meant to be installed
|
1981
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
1982
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
1983
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
1984
|
+
|
1985
|
+
if [ -f /bin/systemctl ]; then
|
1986
|
+
copyfile ${SALT_GIT_CHECKOUT_DIR}/pkg/salt-$fname.service /lib/systemd/system/salt-$fname.service
|
1987
|
+
continue
|
1988
|
+
fi
|
1989
|
+
|
1990
|
+
copyfile ${SALT_GIT_CHECKOUT_DIR}/pkg/rpm/salt-$fname /etc/init.d/salt-$fname
|
1991
|
+
chmod +x /etc/init.d/salt-$fname
|
1992
|
+
|
1993
|
+
done
|
1994
|
+
|
1995
|
+
install_opensuse_stable_post
|
1996
|
+
}
|
1997
|
+
|
1998
|
+
install_opensuse_restart_daemons() {
|
1999
|
+
for fname in minion master syndic; do
|
2000
|
+
|
2001
|
+
# Skip if not meant to be installed
|
2002
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
2003
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
2004
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
2005
|
+
|
2006
|
+
if [ -f /bin/systemctl ]; then
|
2007
|
+
systemctl stop salt-$fname > /dev/null 2>&1
|
2008
|
+
systemctl start salt-$fname.service
|
2009
|
+
continue
|
2010
|
+
fi
|
2011
|
+
|
2012
|
+
service salt-$fname stop > /dev/null 2>&1
|
2013
|
+
service salt-$fname start
|
2014
|
+
|
2015
|
+
done
|
2016
|
+
}
|
2017
|
+
#
|
2018
|
+
# End of openSUSE Install Functions.
|
2019
|
+
#
|
2020
|
+
##############################################################################
|
2021
|
+
|
2022
|
+
##############################################################################
|
2023
|
+
#
|
2024
|
+
# SuSE Install Functions.
|
2025
|
+
#
|
2026
|
+
install_suse_11_stable_deps() {
|
2027
|
+
SUSE_PATCHLEVEL=$(grep PATCHLEVEL /etc/SuSE-release | awk '{print $3}')
|
2028
|
+
if [ "x${SUSE_PATCHLEVEL}" != "x" ]; then
|
2029
|
+
DISTRO_PATCHLEVEL="_SP${SUSE_PATCHLEVEL}"
|
2030
|
+
fi
|
2031
|
+
DISTRO_REPO="SLE_${DISTRO_MAJOR_VERSION}${DISTRO_PATCHLEVEL}"
|
2032
|
+
|
2033
|
+
zypper --non-interactive addrepo --refresh \
|
2034
|
+
http://download.opensuse.org/repositories/devel:/languages:/python/${DISTRO_REPO}/devel:languages:python.repo
|
2035
|
+
zypper --gpg-auto-import-keys --non-interactive refresh
|
2036
|
+
if [ $SUSE_PATCHLEVEL -eq 1 ]; then
|
2037
|
+
[ $PIP_ALLOWED -eq $BS_FALSE ] && pip_not_allowed
|
2038
|
+
echowarn "PyYaml will be installed using pip"
|
2039
|
+
zypper --non-interactive install --auto-agree-with-licenses libzmq3 python \
|
2040
|
+
python-Jinja2 'python-M2Crypto>=0.21' python-msgpack-python \
|
2041
|
+
python-pycrypto python-pyzmq python-pip
|
2042
|
+
# There's no python-PyYaml in SP1, let's install it using pip
|
2043
|
+
pip install PyYaml
|
2044
|
+
else
|
2045
|
+
zypper --non-interactive install --auto-agree-with-licenses libzmq3 python \
|
2046
|
+
python-Jinja2 'python-M2Crypto>=0.21' python-PyYAML python-msgpack-python \
|
2047
|
+
python-pycrypto python-pyzmq
|
2048
|
+
fi
|
2049
|
+
}
|
2050
|
+
|
2051
|
+
install_suse_11_git_deps() {
|
2052
|
+
install_suse_11_stable_deps
|
2053
|
+
zypper --non-interactive install --auto-agree-with-licenses git
|
2054
|
+
|
2055
|
+
__git_clone_and_checkout || return 1
|
2056
|
+
|
2057
|
+
# Let's trigger config_salt()
|
2058
|
+
if [ "$TEMP_CONFIG_DIR" = "null" ]; then
|
2059
|
+
TEMP_CONFIG_DIR="${SALT_GIT_CHECKOUT_DIR}/conf/"
|
2060
|
+
CONFIG_SALT_FUNC="config_salt"
|
2061
|
+
fi
|
2062
|
+
|
2063
|
+
return 0
|
2064
|
+
}
|
2065
|
+
|
2066
|
+
install_suse_11_stable() {
|
2067
|
+
if [ $SUSE_PATCHLEVEL -gt 1 ]; then
|
2068
|
+
install_opensuse_stable
|
2069
|
+
else
|
2070
|
+
# USE_SETUPTOOLS=1 To work around
|
2071
|
+
# error: option --single-version-externally-managed not recognized
|
2072
|
+
USE_SETUPTOOLS=1 pip install salt
|
2073
|
+
fi
|
2074
|
+
}
|
2075
|
+
|
2076
|
+
install_suse_11_git() {
|
2077
|
+
install_opensuse_git
|
2078
|
+
}
|
2079
|
+
|
2080
|
+
install_suse_11_stable_post() {
|
2081
|
+
if [ $SUSE_PATCHLEVEL -gt 1 ]; then
|
2082
|
+
install_opensuse_stable_post
|
2083
|
+
else
|
2084
|
+
for fname in minion master syndic; do
|
2085
|
+
|
2086
|
+
# Skip if not meant to be installed
|
2087
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
2088
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
2089
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
2090
|
+
|
2091
|
+
if [ -f /bin/systemctl ]; then
|
2092
|
+
curl -k -L https://github.com/saltstack/salt/raw/develop/pkg/salt-$fname.service \
|
2093
|
+
-o /lib/systemd/system/salt-$fname.service
|
2094
|
+
continue
|
2095
|
+
fi
|
2096
|
+
|
2097
|
+
curl -k -L https://github.com/saltstack/salt/raw/develop/pkg/rpm/salt-$fname \
|
2098
|
+
-o /etc/init.d/salt-$fname
|
2099
|
+
chmod +x /etc/init.d/salt-$fname
|
2100
|
+
|
2101
|
+
done
|
2102
|
+
fi
|
2103
|
+
}
|
2104
|
+
|
2105
|
+
install_suse_11_git_post() {
|
2106
|
+
install_opensuse_git_post
|
2107
|
+
}
|
2108
|
+
|
2109
|
+
install_suse_11_restart_daemons() {
|
2110
|
+
install_opensuse_restart_daemons
|
2111
|
+
}
|
2112
|
+
#
|
2113
|
+
# End of SuSE Install Functions.
|
2114
|
+
#
|
2115
|
+
##############################################################################
|
839
2116
|
|
840
2117
|
##############################################################################
|
841
2118
|
#
|
842
2119
|
# Default minion configuration function. Matches ANY distribution as long as
|
843
|
-
#
|
2120
|
+
# the -c options is passed.
|
844
2121
|
#
|
845
|
-
|
2122
|
+
config_salt() {
|
846
2123
|
# If the configuration directory is not passed, return
|
847
2124
|
[ "$TEMP_CONFIG_DIR" = "null" ] && return
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
fi
|
2125
|
+
|
2126
|
+
CONFIGURED_ANYTHING=$BS_FALSE
|
2127
|
+
|
2128
|
+
PKI_DIR=$SALT_ETC_DIR/pki
|
853
2129
|
|
854
2130
|
# Let's create the necessary directories
|
855
|
-
[ -d
|
856
|
-
[ -d
|
2131
|
+
[ -d $SALT_ETC_DIR ] || mkdir $SALT_ETC_DIR
|
2132
|
+
[ -d $PKI_DIR ] || mkdir -p $PKI_DIR && chmod 700 $PKI_DIR
|
2133
|
+
|
2134
|
+
if [ $INSTALL_MINION -eq $BS_TRUE ]; then
|
2135
|
+
# Create the PKI directory
|
2136
|
+
[ -d $PKI_DIR/minion ] || mkdir -p $PKI_DIR/minion && chmod 700 $PKI_DIR/minion
|
2137
|
+
|
2138
|
+
# Copy the minions configuration if found
|
2139
|
+
[ -f "$TEMP_CONFIG_DIR/minion" ] && mv "$TEMP_CONFIG_DIR/minion" /etc/salt && CONFIGURED_ANYTHING=$BS_TRUE
|
2140
|
+
|
2141
|
+
# Copy the minion's keys if found
|
2142
|
+
if [ -f "$TEMP_CONFIG_DIR/minion.pem" ]; then
|
2143
|
+
mv "$TEMP_CONFIG_DIR/minion.pem" $PKI_DIR/minion/
|
2144
|
+
chmod 400 $PKI_DIR/minion/minion.pem
|
2145
|
+
CONFIGURED_ANYTHING=$BS_TRUE
|
2146
|
+
fi
|
2147
|
+
if [ -f "$TEMP_CONFIG_DIR/minion.pub" ]; then
|
2148
|
+
mv "$TEMP_CONFIG_DIR/minion.pub" $PKI_DIR/minion/
|
2149
|
+
chmod 664 $PKI_DIR/minion/minion.pub
|
2150
|
+
CONFIGURED_ANYTHING=$BS_TRUE
|
2151
|
+
fi
|
2152
|
+
fi
|
857
2153
|
|
858
|
-
# Copy the minions configuration if found
|
859
|
-
[ -f "$TEMP_CONFIG_DIR/minion" ] && mv "$TEMP_CONFIG_DIR/minion" /etc/salt
|
860
2154
|
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
2155
|
+
if [ $INSTALL_MASTER -eq $BS_TRUE ] || [ $INSTALL_SYNDIC -eq $BS_TRUE ]; then
|
2156
|
+
# Create the PKI directory
|
2157
|
+
[ -d $PKI_DIR/master ] || mkdir -p $PKI_DIR/master && chmod 700 $PKI_DIR/master
|
2158
|
+
|
2159
|
+
# Copy the masters configuration if found
|
2160
|
+
[ -f "$TEMP_CONFIG_DIR/master" ] && mv "$TEMP_CONFIG_DIR/master" /etc/salt && CONFIGURED_ANYTHING=$BS_TRUE
|
2161
|
+
|
2162
|
+
# Copy the master's keys if found
|
2163
|
+
if [ -f "$TEMP_CONFIG_DIR/master.pem" ]; then
|
2164
|
+
mv "$TEMP_CONFIG_DIR/master.pem" $PKI_DIR/master/
|
2165
|
+
chmod 400 $PKI_DIR/master/master.pem
|
2166
|
+
CONFIGURED_ANYTHING=$BS_TRUE
|
2167
|
+
fi
|
2168
|
+
if [ -f "$TEMP_CONFIG_DIR/master.pub" ]; then
|
2169
|
+
mv "$TEMP_CONFIG_DIR/master.pub" $PKI_DIR/master/
|
2170
|
+
chmod 664 $PKI_DIR/master/master.pub
|
2171
|
+
CONFIGURED_ANYTHING=$BS_TRUE
|
2172
|
+
fi
|
865
2173
|
fi
|
866
|
-
|
867
|
-
|
868
|
-
|
2174
|
+
|
2175
|
+
if [ $CONFIG_ONLY -eq $BS_TRUE ] && [ $CONFIGURED_ANYTHING -eq $BS_FALSE ]; then
|
2176
|
+
echowarn "No configuration or keys were copied over. No configuration was done!"
|
2177
|
+
exit 0
|
869
2178
|
fi
|
870
2179
|
}
|
871
2180
|
#
|
@@ -874,18 +2183,45 @@ config_minion() {
|
|
874
2183
|
##############################################################################
|
875
2184
|
|
876
2185
|
|
2186
|
+
##############################################################################
|
2187
|
+
#
|
2188
|
+
# This function checks if all of the installed daemons are running or not.
|
2189
|
+
#
|
2190
|
+
daemons_running() {
|
2191
|
+
FAILED_DAEMONS=0
|
2192
|
+
for fname in minion master syndic; do
|
2193
|
+
|
2194
|
+
# Skip if not meant to be installed
|
2195
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
2196
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
2197
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
2198
|
+
|
2199
|
+
if [ "x$(ps aux | grep -v grep | grep salt-$fname)" = "x" ]; then
|
2200
|
+
echoerror "salt-$fname was not found running"
|
2201
|
+
FAILED_DAEMONS=$(expr $FAILED_DAEMONS + 1)
|
2202
|
+
fi
|
2203
|
+
done
|
2204
|
+
return $FAILED_DAEMONS
|
2205
|
+
}
|
2206
|
+
#
|
2207
|
+
# Ended daemons running check function
|
2208
|
+
#
|
2209
|
+
##############################################################################
|
2210
|
+
|
877
2211
|
|
878
2212
|
#=============================================================================
|
879
2213
|
# LET'S PROCEED WITH OUR INSTALLATION
|
880
2214
|
#=============================================================================
|
881
2215
|
# Let's get the dependencies install function
|
882
|
-
DEP_FUNC_NAMES="install_${DISTRO_NAME_L}${
|
883
|
-
DEP_FUNC_NAMES="$DEP_FUNC_NAMES install_${DISTRO_NAME_L}${
|
2216
|
+
DEP_FUNC_NAMES="install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_${ITYPE}_deps"
|
2217
|
+
DEP_FUNC_NAMES="$DEP_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_${ITYPE}_deps"
|
2218
|
+
DEP_FUNC_NAMES="$DEP_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_deps"
|
2219
|
+
DEP_FUNC_NAMES="$DEP_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_deps"
|
884
2220
|
DEP_FUNC_NAMES="$DEP_FUNC_NAMES install_${DISTRO_NAME_L}_${ITYPE}_deps"
|
885
2221
|
DEP_FUNC_NAMES="$DEP_FUNC_NAMES install_${DISTRO_NAME_L}_deps"
|
886
2222
|
|
887
2223
|
DEPS_INSTALL_FUNC="null"
|
888
|
-
for DEP_FUNC_NAME in $DEP_FUNC_NAMES; do
|
2224
|
+
for DEP_FUNC_NAME in $(__strip_duplicates $DEP_FUNC_NAMES); do
|
889
2225
|
if __function_defined $DEP_FUNC_NAME; then
|
890
2226
|
DEPS_INSTALL_FUNC=$DEP_FUNC_NAME
|
891
2227
|
break
|
@@ -893,12 +2229,34 @@ for DEP_FUNC_NAME in $DEP_FUNC_NAMES; do
|
|
893
2229
|
done
|
894
2230
|
|
895
2231
|
|
2232
|
+
# Let's get the minion config function
|
2233
|
+
CONFIG_SALT_FUNC="null"
|
2234
|
+
if [ "$TEMP_CONFIG_DIR" != "null" ]; then
|
2235
|
+
|
2236
|
+
CONFIG_FUNC_NAMES="config_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_${ITYPE}_salt"
|
2237
|
+
CONFIG_FUNC_NAMES="$CONFIG_FUNC_NAMES config_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_${ITYPE}_salt"
|
2238
|
+
CONFIG_FUNC_NAMES="$CONFIG_FUNC_NAMES config_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_salt"
|
2239
|
+
CONFIG_FUNC_NAMES="$CONFIG_FUNC_NAMES config_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_salt"
|
2240
|
+
CONFIG_FUNC_NAMES="$CONFIG_FUNC_NAMES config_${DISTRO_NAME_L}_${ITYPE}_salt"
|
2241
|
+
CONFIG_FUNC_NAMES="$CONFIG_FUNC_NAMES config_${DISTRO_NAME_L}_salt"
|
2242
|
+
CONFIG_FUNC_NAMES="$CONFIG_FUNC_NAMES config_salt"
|
2243
|
+
|
2244
|
+
for FUNC_NAME in $(__strip_duplicates $CONFIG_FUNC_NAMES); do
|
2245
|
+
if __function_defined $FUNC_NAME; then
|
2246
|
+
CONFIG_SALT_FUNC=$FUNC_NAME
|
2247
|
+
break
|
2248
|
+
fi
|
2249
|
+
done
|
2250
|
+
fi
|
2251
|
+
|
2252
|
+
|
896
2253
|
# Let's get the install function
|
897
|
-
INSTALL_FUNC_NAMES="install_${DISTRO_NAME_L}${
|
2254
|
+
INSTALL_FUNC_NAMES="install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_${ITYPE}"
|
2255
|
+
INSTALL_FUNC_NAMES="$INSTALL_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_${ITYPE}"
|
898
2256
|
INSTALL_FUNC_NAMES="$INSTALL_FUNC_NAMES install_${DISTRO_NAME_L}_${ITYPE}"
|
899
2257
|
|
900
2258
|
INSTALL_FUNC="null"
|
901
|
-
for FUNC_NAME in $INSTALL_FUNC_NAMES; do
|
2259
|
+
for FUNC_NAME in $(__strip_duplicates $INSTALL_FUNC_NAMES); do
|
902
2260
|
if __function_defined $FUNC_NAME; then
|
903
2261
|
INSTALL_FUNC=$FUNC_NAME
|
904
2262
|
break
|
@@ -906,32 +2264,17 @@ for FUNC_NAME in $INSTALL_FUNC_NAMES; do
|
|
906
2264
|
done
|
907
2265
|
|
908
2266
|
|
909
|
-
# Let's get the minion config function
|
910
|
-
CONFIG_MINION_FUNC="null"
|
911
|
-
if [ "$TEMP_CONFIG_DIR" != "null" ]; then
|
912
|
-
CONFIG_FUNC_NAMES="config_${DISTRO_NAME_L}${DISTRO_VERSION_NO_DOTS}_${ITYPE}_minion"
|
913
|
-
CONFIG_FUNC_NAMES="$CONFIG_FUNC_NAMES config_${DISTRO_NAME_L}${DISTRO_VERSION_NO_DOTS}_minon"
|
914
|
-
CONFIG_FUNC_NAMES="$CONFIG_FUNC_NAMES config_${DISTRO_NAME_L}_${ITYPE}_minion"
|
915
|
-
CONFIG_FUNC_NAMES="$CONFIG_FUNC_NAMES config_${DISTRO_NAME_L}_minion"
|
916
|
-
CONFIG_FUNC_NAMES="$CONFIG_FUNC_NAMES config_minion"
|
917
|
-
|
918
|
-
for FUNC_NAME in $CONFIG_FUNC_NAMES; do
|
919
|
-
if __function_defined $FUNC_NAME; then
|
920
|
-
CONFIG_MINION_FUNC=$FUNC_NAME
|
921
|
-
break
|
922
|
-
fi
|
923
|
-
done
|
924
|
-
fi
|
925
|
-
|
926
|
-
|
927
2267
|
# Let's get the post install function
|
928
|
-
POST_FUNC_NAMES="install_${DISTRO_NAME_L}${
|
929
|
-
POST_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}${
|
2268
|
+
POST_FUNC_NAMES="install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_${ITYPE}_post"
|
2269
|
+
POST_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_${ITYPE}_post"
|
2270
|
+
POST_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_post"
|
2271
|
+
POST_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_post"
|
930
2272
|
POST_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}_${ITYPE}_post"
|
931
2273
|
POST_FUNC_NAMES="$POST_FUNC_NAMES install_${DISTRO_NAME_L}_post"
|
932
2274
|
|
2275
|
+
|
933
2276
|
POST_INSTALL_FUNC="null"
|
934
|
-
for FUNC_NAME in $POST_FUNC_NAMES; do
|
2277
|
+
for FUNC_NAME in $(__strip_duplicates $POST_FUNC_NAMES); do
|
935
2278
|
if __function_defined $FUNC_NAME; then
|
936
2279
|
POST_INSTALL_FUNC=$FUNC_NAME
|
937
2280
|
break
|
@@ -939,53 +2282,144 @@ for FUNC_NAME in $POST_FUNC_NAMES; do
|
|
939
2282
|
done
|
940
2283
|
|
941
2284
|
|
2285
|
+
# Let's get the start daemons install function
|
2286
|
+
STARTDAEMONS_FUNC_NAMES="install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_${ITYPE}_restart_daemons"
|
2287
|
+
STARTDAEMONS_FUNC_NAMES="$STARTDAEMONS_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_${ITYPE}_restart_daemons"
|
2288
|
+
STARTDAEMONS_FUNC_NAMES="$STARTDAEMONS_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_restart_daemons"
|
2289
|
+
STARTDAEMONS_FUNC_NAMES="$STARTDAEMONS_FUNC_NAMES install_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_restart_daemons"
|
2290
|
+
STARTDAEMONS_FUNC_NAMES="$STARTDAEMONS_FUNC_NAMES install_${DISTRO_NAME_L}_${ITYPE}_restart_daemons"
|
2291
|
+
STARTDAEMONS_FUNC_NAMES="$STARTDAEMONS_FUNC_NAMES install_${DISTRO_NAME_L}_restart_daemons"
|
2292
|
+
|
2293
|
+
STARTDAEMONS_INSTALL_FUNC="null"
|
2294
|
+
for FUNC_NAME in $(__strip_duplicates $STARTDAEMONS_FUNC_NAMES); do
|
2295
|
+
if __function_defined $FUNC_NAME; then
|
2296
|
+
STARTDAEMONS_INSTALL_FUNC=$FUNC_NAME
|
2297
|
+
break
|
2298
|
+
fi
|
2299
|
+
done
|
2300
|
+
|
2301
|
+
|
2302
|
+
# Let's get the daemons running check function.
|
2303
|
+
DAEMONS_RUNNING_FUNC="null"
|
2304
|
+
DAEMONS_RUNNING_FUNC_NAMES="daemons_running_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}_${ITYPE}"
|
2305
|
+
DAEMONS_RUNNING_FUNC_NAMES="$DAEMONS_RUNNING_FUNC_NAMES daemons_running_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}_${ITYPE}"
|
2306
|
+
DAEMONS_RUNNING_FUNC_NAMES="$DAEMONS_RUNNING_FUNC_NAMES daemons_running_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}"
|
2307
|
+
DAEMONS_RUNNING_FUNC_NAMES="$DAEMONS_RUNNING_FUNC_NAMES daemons_running_${DISTRO_NAME_L}${PREFIXED_DISTRO_MAJOR_VERSION}${PREFIXED_DISTRO_MINOR_VERSION}"
|
2308
|
+
DAEMONS_RUNNING_FUNC_NAMES="$DAEMONS_RUNNING_FUNC_NAMES daemons_running_${DISTRO_NAME_L}_${ITYPE}"
|
2309
|
+
DAEMONS_RUNNING_FUNC_NAMES="$DAEMONS_RUNNING_FUNC_NAMES daemons_running_${DISTRO_NAME_L}"
|
2310
|
+
DAEMONS_RUNNING_FUNC_NAMES="$DAEMONS_RUNNING_FUNC_NAMES daemons_running"
|
2311
|
+
|
2312
|
+
for FUNC_NAME in $(__strip_duplicates $DAEMONS_RUNNING_FUNC_NAMES); do
|
2313
|
+
if __function_defined $FUNC_NAME; then
|
2314
|
+
DAEMONS_RUNNING_FUNC=$FUNC_NAME
|
2315
|
+
break
|
2316
|
+
fi
|
2317
|
+
done
|
2318
|
+
|
2319
|
+
|
2320
|
+
|
942
2321
|
if [ $DEPS_INSTALL_FUNC = "null" ]; then
|
943
|
-
|
2322
|
+
echoerror "No dependencies installation function found. Exiting..."
|
944
2323
|
exit 1
|
945
2324
|
fi
|
946
2325
|
|
947
2326
|
if [ $INSTALL_FUNC = "null" ]; then
|
948
|
-
|
2327
|
+
echoerror "No installation function found. Exiting..."
|
949
2328
|
exit 1
|
950
2329
|
fi
|
951
2330
|
|
952
2331
|
|
953
2332
|
# Install dependencies
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
2333
|
+
if [ $CONFIG_ONLY -eq $BS_FALSE ]; then
|
2334
|
+
# Only execute function is not in config mode only
|
2335
|
+
echoinfo "Running ${DEPS_INSTALL_FUNC}()"
|
2336
|
+
$DEPS_INSTALL_FUNC
|
2337
|
+
if [ $? -ne 0 ]; then
|
2338
|
+
echoerror "Failed to run ${DEPS_INSTALL_FUNC}()!!!"
|
2339
|
+
exit 1
|
2340
|
+
fi
|
959
2341
|
fi
|
960
2342
|
|
961
|
-
# Install Salt
|
962
|
-
echo " * Running ${INSTALL_FUNC}()"
|
963
|
-
$INSTALL_FUNC
|
964
|
-
if [ $? -ne 0 ]; then
|
965
|
-
echo " * Failed to run ${INSTALL_FUNC}()!!!"
|
966
|
-
exit 1
|
967
|
-
fi
|
968
2343
|
|
969
2344
|
# Configure Salt
|
970
|
-
if [ "$TEMP_CONFIG_DIR" != "null"
|
971
|
-
|
972
|
-
$
|
2345
|
+
if [ "$TEMP_CONFIG_DIR" != "null" ] && [ "$CONFIG_SALT_FUNC" != "null" ]; then
|
2346
|
+
echoinfo "Running ${CONFIG_SALT_FUNC}()"
|
2347
|
+
$CONFIG_SALT_FUNC
|
973
2348
|
if [ $? -ne 0 ]; then
|
974
|
-
|
2349
|
+
echoerror "Failed to run ${CONFIG_SALT_FUNC}()!!!"
|
975
2350
|
exit 1
|
976
2351
|
fi
|
977
2352
|
fi
|
978
2353
|
|
979
|
-
|
980
|
-
|
981
|
-
|
2354
|
+
|
2355
|
+
# Install Salt
|
2356
|
+
if [ $CONFIG_ONLY -eq $BS_FALSE ]; then
|
2357
|
+
# Only execute function is not in config mode only
|
2358
|
+
echoinfo "Running ${INSTALL_FUNC}()"
|
2359
|
+
$INSTALL_FUNC
|
2360
|
+
if [ $? -ne 0 ]; then
|
2361
|
+
echoerror "Failed to run ${INSTALL_FUNC}()!!!"
|
2362
|
+
exit 1
|
2363
|
+
fi
|
2364
|
+
fi
|
2365
|
+
|
2366
|
+
|
2367
|
+
# Run any post install function, Only execute function is not in config mode only
|
2368
|
+
if [ $CONFIG_ONLY -eq $BS_FALSE ] && [ "$POST_INSTALL_FUNC" != "null" ]; then
|
2369
|
+
echoinfo "Running ${POST_INSTALL_FUNC}()"
|
982
2370
|
$POST_INSTALL_FUNC
|
983
2371
|
if [ $? -ne 0 ]; then
|
984
|
-
|
2372
|
+
echoerror "Failed to run ${POST_INSTALL_FUNC}()!!!"
|
2373
|
+
exit 1
|
2374
|
+
fi
|
2375
|
+
fi
|
2376
|
+
|
2377
|
+
|
2378
|
+
# Run any start daemons function
|
2379
|
+
if [ "$STARTDAEMONS_INSTALL_FUNC" != "null" ]; then
|
2380
|
+
echoinfo "Running ${STARTDAEMONS_INSTALL_FUNC}()"
|
2381
|
+
$STARTDAEMONS_INSTALL_FUNC
|
2382
|
+
if [ $? -ne 0 ]; then
|
2383
|
+
echoerror "Failed to run ${STARTDAEMONS_INSTALL_FUNC}()!!!"
|
985
2384
|
exit 1
|
986
2385
|
fi
|
987
2386
|
fi
|
988
2387
|
|
2388
|
+
# Check if the installed daemons are running or not
|
2389
|
+
if [ "$DAEMONS_RUNNING_FUNC" != "null" ]; then
|
2390
|
+
sleep 3 # Sleep a little bit to let daemons start
|
2391
|
+
echoinfo "Running ${DAEMONS_RUNNING_FUNC}()"
|
2392
|
+
$DAEMONS_RUNNING_FUNC
|
2393
|
+
if [ $? -ne 0 ]; then
|
2394
|
+
echoerror "Failed to run ${DAEMONS_RUNNING_FUNC}()!!!"
|
2395
|
+
echodebug "Running Processes:"
|
2396
|
+
echodebug "$(ps auxwww)"
|
2397
|
+
|
2398
|
+
for fname in minion master syndic; do
|
2399
|
+
# Skip if not meant to be installed
|
2400
|
+
[ $fname = "minion" ] && [ $INSTALL_MINION -eq $BS_FALSE ] && continue
|
2401
|
+
[ $fname = "master" ] && [ $INSTALL_MASTER -eq $BS_FALSE ] && continue
|
2402
|
+
[ $fname = "syndic" ] && [ $INSTALL_SYNDIC -eq $BS_FALSE ] && continue
|
2403
|
+
|
2404
|
+
[ ! $SALT_ETC_DIR/$fname ] && [ $fname != "syndic" ] && echodebug "$SALT_ETC_DIR/$fname does not exist"
|
2405
|
+
|
2406
|
+
echodebug "Running salt-$fname by hand outputs: $(salt-$fname -l debug)"
|
2407
|
+
|
2408
|
+
[ ! -f /var/log/salt/$fname ] && echodebug "/var/log/salt/$fname does not exist. Can't cat its contents!" && continue
|
2409
|
+
|
2410
|
+
echodebug "DEAMON LOGS for $fname:"
|
2411
|
+
echodebug "$(cat /var/log/salt/$fname)"
|
2412
|
+
echo
|
2413
|
+
done
|
2414
|
+
exit 1
|
2415
|
+
fi
|
2416
|
+
fi
|
2417
|
+
|
2418
|
+
|
989
2419
|
# Done!
|
990
|
-
|
2420
|
+
if [ $CONFIG_ONLY -eq $BS_FALSE ]; then
|
2421
|
+
echoinfo "Salt installed!"
|
2422
|
+
else
|
2423
|
+
echoinfo "Salt configured"
|
2424
|
+
fi
|
991
2425
|
exit 0
|