@@ -97,7 +97,6 @@ mv $PREFIX/httpd/htdocs/Apache-htaccess $PREFIX/httpd/htdocs/.htaccess
97
97
chmod 755 $PREFIX /httpd
98
98
chown -R $MP_APACHE_USER :$MP_APACHE_USER $PREFIX /httpd/htdocs
99
99
chmod a+rx $PREFIX /httpd/htdocs/api/dc-scripts/* .sh
100
- chmod a+rx $PREFIX /httpd/htdocs/api/dc-scripts/* .pl
101
100
102
101
# plugins directory, empty by default
103
102
mkdir -p ${PREFIX} /plugins
@@ -121,10 +120,10 @@ chown $MP_APACHE_USER:$MP_APACHE_USER $PREFIX/httpd/logs/application
121
120
#
122
121
# Do all the prelimenary Design Center setup only on the first install of cfengine package
123
122
#
123
+ DCWORKDIR=/opt/cfengine
124
+ DCPARAMS=$DCWORKDIR /dc-scripts/params.sh
124
125
if ! is_upgrade; then
125
126
# This folder is required for Design Center and Mission Portal to talk to each other
126
- DCWORKDIR=/opt/cfengine
127
- $PREFIX /design-center/bin/cf-sketch --inputs=$PREFIX /design-center --installsource=$PREFIX /share/NovaBase/sketches/cfsketches.json --install-all
128
127
mkdir -p $DCWORKDIR /userworkdir/admin/.ssh
129
128
mkdir -p $DCWORKDIR /stage_backup
130
129
mkdir -p $DCWORKDIR /dc-scripts
@@ -134,20 +133,23 @@ if ! is_upgrade; then
134
133
touch $DCWORKDIR /userworkdir/admin/.ssh/id_rsa.pvt
135
134
chmod 600 $DCWORKDIR /userworkdir/admin/.ssh/id_rsa.pvt
136
135
137
- cat > $DCWORKDIR /dc-scripts/params.sh << EOHIPPUS
138
- #!/bin/bash
136
+ cat > $DCPARAMS << EOHIPPUS
139
137
ROOT="$DCWORKDIR /masterfiles_staging"
140
138
GIT_URL="$DCWORKDIR /masterfiles.git"
141
- GIT_BRANCH="master"
139
+ GIT_REFSPEC="master"
140
+ GIT_USERNAME=""
141
+ GIT_PASSWORD=""
142
142
GIT_WORKING_BRANCH="CF_WORKING_BRANCH"
143
- GIT_EMAIL="default-committer@your-cfe-site.com"
144
- GIT_AUTHOR="Default Committer"
145
143
PKEY="$DCWORKDIR /userworkdir/admin/.ssh/id_rsa.pvt"
146
144
SCRIPT_DIR="$PREFIX /httpd/htdocs/api/dc-scripts"
147
145
VCS_TYPE="GIT"
146
+
148
147
export PATH="\$ {PATH}:$PREFIX /bin"
149
- export PKEY="\$ {PKEY}"
148
+ export PKEY
149
+ export GIT_USERNAME
150
+ export GIT_PASSWORD
150
151
export GIT_SSH="\$ {SCRIPT_DIR}/ssh-wrapper.sh"
152
+ export GIT_ASKPASS="\$ {SCRIPT_DIR}/git-askpass.sh"
151
153
EOHIPPUS
152
154
153
155
# The runfile key in the below JSON is not needed anymore, all the
@@ -166,8 +168,6 @@ EOHIPPUS
166
168
}
167
169
EOHIPPUS
168
170
169
- chmod 700 $DCWORKDIR /dc-scripts/params.sh
170
-
171
171
chown -R $MP_APACHE_USER :$MP_APACHE_USER $DCWORKDIR /userworkdir
172
172
chown -R $MP_APACHE_USER :$MP_APACHE_USER $DCWORKDIR /dc-scripts
173
173
chown -R $MP_APACHE_USER :$MP_APACHE_USER $DCWORKDIR /stage_backup
@@ -201,6 +201,35 @@ EOHIPPUS
201
201
if [ ! -f /usr/bin/curl ]; then
202
202
ln -sf $PREFIX /bin/curl /usr/bin/curl
203
203
fi
204
+ else
205
+ # Migrate DC params.sh
206
+ # change GIT_BRANCH to GIT_REFSPEC, if it exists
207
+ # or add it after first line
208
+ if ! grep ' GIT_REFSPEC=' $DCPARAMS > /dev/null; then
209
+ if grep ' GIT_BRANCH=' $DCPARAMS > /dev/null; then
210
+ sed -i ' s/GIT_BRANCH=/GIT_REFSPEC=/' $DCPARAMS
211
+ else
212
+ sed -i ' 1a GIT_REFSPEC="master"' $DCPARAMS
213
+ fi
214
+ fi
215
+ # Add git username and password, if they're missing
216
+ if ! grep ' GIT_USERNAME=' $DCPARAMS > /dev/null; then
217
+ sed -i ' 1a GIT_USERNAME=""' $DCPARAMS
218
+ fi
219
+ if ! grep ' GIT_PASSWORD=' $DCPARAMS > /dev/null; then
220
+ sed -i ' 1a GIT_PASSWORD=""' $DCPARAMS
221
+ fi
222
+ # Add export lines at the end, if they're missing
223
+ if ! grep ' export GIT_USERNAME' $DCPARAMS > /dev/null; then
224
+ echo ' export GIT_USERNAME' >> $DCPARAMS
225
+ fi
226
+ if ! grep ' export GIT_PASSWORD' $DCPARAMS > /dev/null; then
227
+ echo ' export GIT_PASSWORD' >> $DCPARAMS
228
+ fi
229
+ if ! grep ' export GIT_ASKPASS' $DCPARAMS > /dev/null; then
230
+ echo ' export GIT_ASKPASS="${SCRIPT_DIR}/git-askpass.sh"' >> $DCPARAMS
231
+ fi
232
+
204
233
fi
205
234
206
235
if [ -f $PREFIX /bin/cf-twin ]; then
@@ -731,12 +760,12 @@ find $PREFIX/httpd/htdocs/application/ -type f -exec chown -R root:$MP_APACHE_US
731
760
find $PREFIX /httpd/htdocs/application/ -type f -exec chmod 0440 {} +
732
761
733
762
# API non-executable
734
- find $PREFIX /httpd/htdocs/api/ -type f ! -name ' *.sh' -o ! -name ' *.pl ' - exec chown -R root:$MP_APACHE_USER {} +
735
- find $PREFIX /httpd/htdocs/api/ -type f ! -name ' *.sh' -o ! -name ' *.pl ' - exec chmod 0440 {} +
763
+ find $PREFIX /httpd/htdocs/api/ -type f ! -name ' *.sh' -exec chown -R root:$MP_APACHE_USER {} +
764
+ find $PREFIX /httpd/htdocs/api/ -type f ! -name ' *.sh' -exec chmod 0440 {} +
736
765
737
766
# API executable
738
- find $PREFIX /httpd/htdocs/api/ -type f -name ' *.sh' -o -name ' *.pl ' - exec chown -R root:$MP_APACHE_USER {} +
739
- find $PREFIX /httpd/htdocs/api/ -type f -name ' *.sh' -o -name ' *.pl ' - exec chmod 0550 {} +
767
+ find $PREFIX /httpd/htdocs/api/ -type f -name ' *.sh' -exec chown -R root:$MP_APACHE_USER {} +
768
+ find $PREFIX /httpd/htdocs/api/ -type f -name ' *.sh' -exec chmod 0550 {} +
740
769
741
770
# API static non htaccess
742
771
find $PREFIX /httpd/htdocs/api/static -type f ! -name ' .htaccess' -exec chown -R root:$MP_APACHE_USER {} +
0 commit comments