This repository has been archived by the owner on Dec 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
clean_install_deploy_package.sh
141 lines (112 loc) · 2.28 KB
/
clean_install_deploy_package.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/sh
# defaultconfig
sling_url="http://localhost:4502"
sling_user="admin"
sling_password="admin"
sling_params=""
# set parameter variables before run
init()
{
sling_params="-Dsling.url=$sling_url -Dsling.user=$sling_user -Dsling.password=$sling_password"
other_params=$4
}
####
# run modes
deploy_only()
{
init
deploy_artifacts
}
default_build()
{
motd
init
clean_install
deploy_artifacts
}
#####
motd()
{
echo "********************************************************************"
echo ""
echo " Cleans and installs all modules"
echo " Uploads and installs application complete packages and sample content"
echo ""
echo " Destination: $sling_url"
echo ""
echo "********************************************************************"
}
####
clean_install()
{
echo ""
echo "*** Build artifacts ***"
echo ""
mvn $sling_params $other_params -Pfast clean install eclipse:eclipse
if [ "$?" -ne "0" ]; then
error_exit "*** Build artifacts FAILED ***"
fi
}
#####
deploy_artifacts()
{
echo ""
echo "*** Deploy complete package ***"
echo ""
cd complete
mvn -B $sling_params wcmio-content-package:install
if [ "$?" -ne "0" ]; then
error_exit "*** Deploying complete package FAILED ***"
fi
cd ../
echo ""
echo "*** Deploy config and samplecontent packages ***"
echo ""
cd config-definition
mvn -B $sling_params -Pdeploy-config-packages wcmio-content-package:install
if [ "$?" -ne "0" ]; then
error_exit "*** Deploying config packages FAILED ***"
fi
cd ../
cd sample-content
mvn -B $sling_params wcmio-content-package:install
if [ "$?" -ne "0" ]; then
error_exit "*** Deploying sample content packages FAILED ***"
fi
cd ../
}
#####
error_exit()
{
echo ""
echo "$1" 1>&2
echo ""
read -n1 -r -p "Press any key to continue..." key
exit 1
}
# check params and run
if [ "$1" != "" ]
then
if [ "$1" = "deploy_only" ]
then
# commandlineconfig
sling_url=$2
sling_user=$3
sling_password=$4
deploy_only
else
# commandlineconfig
sling_url=$1
sling_user=$2
sling_password=$3
shift 3
other_params=$@
default_build
fi
else
default_build
fi
echo ""
echo "*** Build complete ***"
echo ""
read -n1 -r -p "Press any key to continue..." key