File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4444
4545$LOGGER_CMD " $( date) - starting keystore-setup"
4646
47+ # Create the props file if missing, so the new password can be saved
48+ if [ ! -f " $PROPS_FILE " ]; then
49+ $LOGGER_CMD " Props file does not exist, creating it"
50+ touch " $PROPS_FILE "
51+ chmod 600 " $PROPS_FILE " || $LOGGER_CMD " Cannot chmod $PROPS_FILE "
52+ fi
53+
4754# Re-use existing password or use the one provided
48- if [ -f " $PROPS_FILE " ]; then
49- $LOGGER_CMD " Previous props file exists, trying to extract password"
50- OLD_PASS=$( sed -n ' /^keystore.passphrase/p' " $PROPS_FILE " | sed ' s/^keystore.passphrase=//g' )
51- if [ -n " ${OLD_PASS// } " ]; then
52- KS_PASS=" $OLD_PASS "
53- $LOGGER_CMD " Password extraction successful"
55+ OLD_PASS=$( sed -n ' /^keystore.passphrase/p' " $PROPS_FILE " | sed ' s/^keystore.passphrase=//g' )
56+ if [ -n " ${OLD_PASS// } " ]; then
57+ KS_PASS=" $OLD_PASS "
58+ $LOGGER_CMD " Password extraction successful"
59+ else
60+ sed -i " /^keystore.passphrase.*/d" " $PROPS_FILE " 2>&1 | $LOGGER_CMD || true
61+ echo " keystore.passphrase=$KS_PASS " >> " $PROPS_FILE "
62+ if [ $? != 0 ]; then
63+ $LOGGER_CMD " Could not add new password to agent.properties"
5464 else
55- sed -i " /^keystore.passphrase.*/d" " $PROPS_FILE " 2>&1 | $LOGGER_CMD || true
56- echo " keystore.passphrase=$KS_PASS " >> " $PROPS_FILE "
57- if [ $? != 0 ]; then
58- $LOGGER_CMD " Could not add new password to agent.properties"
59- else
60- $LOGGER_CMD " New keystore password set"
61- fi
65+ $LOGGER_CMD " New keystore password set"
6266 fi
6367fi
6468
You can’t perform that action at this time.
0 commit comments