Skip to content
Snippets Groups Projects
Commit e4f054d9 authored by hmangeart's avatar hmangeart
Browse files

add some bash set (-ve) # refs 21701

parent 47e90035
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
set -ve
trap "cp /tmp/{mediaserver-msuser.conf,skyreach.conf,msmonitor.conf} /etc/nginx/sites-available/; nginx -t && service nginx reload; exit 255" ERR trap "cp /tmp/{mediaserver-msuser.conf,skyreach.conf,msmonitor.conf} /etc/nginx/sites-available/; nginx -t && service nginx reload; exit 255" ERR
source /root/envsetup/global-conf.sh source /root/envsetup/global-conf.sh
LE_DIR="/etc/letsencrypt/live/" LE_DIR="/etc/letsencrypt/live/"
...@@ -33,6 +34,8 @@ cp mediaserver-msuser.conf skyreach.conf msmonitor.conf /tmp/ ...@@ -33,6 +34,8 @@ cp mediaserver-msuser.conf skyreach.conf msmonitor.conf /tmp/
# PREPARE LETSENCRYPT REQUEST STRING # PREPARE LETSENCRYPT REQUEST STRING
# ALTER NGINX CONF TO ACCEPT CLEAR HTTP # ALTER NGINX CONF TO ACCEPT CLEAR HTTP
# (DEACTIVATE errexit BECAUSE USING FAILING COMMANDS)
set +e
DOMAIN_STRING="${MS_SERVER_NAME}" && \ DOMAIN_STRING="${MS_SERVER_NAME}" && \
sed -i s/rewrite/#rewrite/ mediaserver-msuser.conf sed -i s/rewrite/#rewrite/ mediaserver-msuser.conf
[ -n "${CM_SERVER_NAME}" ] && \ [ -n "${CM_SERVER_NAME}" ] && \
...@@ -52,13 +55,13 @@ certbot certonly \ ...@@ -52,13 +55,13 @@ certbot certonly \
--webroot --webroot-path /tmp/letsencrypt \ --webroot --webroot-path /tmp/letsencrypt \
--domains "${DOMAIN_STRING}" \ --domains "${DOMAIN_STRING}" \
--email "${EMAIL_ADMINS}" \ --email "${EMAIL_ADMINS}" \
--rsa-key-size 4096 --rsa-key-size 4096
# RE-REDIRECT HTTP to HTTPS # RE-REDIRECT HTTP to HTTPS
sed -i s/#rewrite/rewrite/ mediaserver-msuser.conf skyreach.conf msmonitor.conf sed -i s/#rewrite/rewrite/ mediaserver-msuser.conf skyreach.conf msmonitor.conf
# CHECK CERTS PRESENCE & EDIT NGINX CONFIG # CHECK CERTS PRESENCE & EDIT NGINX CONFIG
# (DEACTIVATE errexit BECAUSE USING FAILING COMMANDS)
set +e set +e
[ -f ${LE_DIR}/${MS_SERVER_NAME}/fullchain.pem ] && \ [ -f ${LE_DIR}/${MS_SERVER_NAME}/fullchain.pem ] && \
sed -i s/#ssl_certificate/ssl_certificate/g mediaserver-msuser.conf sed -i s/#ssl_certificate/ssl_certificate/g mediaserver-msuser.conf
...@@ -73,4 +76,4 @@ set +e ...@@ -73,4 +76,4 @@ set +e
nginx -t && \ nginx -t && \
service nginx reload service nginx reload
rm /tmp/{mediaserver-msuser.conf,skyreach.conf,msmonitor.conf} rm /tmp/{mediaserver-msuser.conf,skyreach.conf,msmonitor.conf}
cd - cd -
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment