Skip to content

Commit 9a9122f

Browse files
committed
install.sh: Removing existing binary before cp to prevent OS signature caching issues.
1 parent dacd33f commit 9a9122f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

static/install.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ APEX_CLI_FILENAME=apex
1818

1919
APEX_CLI_FILE="${APEX_INSTALL_DIR}/${APEX_CLI_FILENAME}"
2020

21+
APEX_EXISTS=false
22+
2123
getSystemInfo() {
2224
ARCH=$(uname -m)
2325
case $ARCH in
@@ -70,11 +72,12 @@ checkHttpRequestCLI() {
7072
fi
7173
}
7274

73-
checkExistingapex() {
75+
checkExistingApex() {
7476
if [ -f "$APEX_CLI_FILE" ]; then
7577
echo -e "\nApex CLI is detected:"
7678
$APEX_CLI_FILE version
7779
echo -e "Reinstalling Apex CLI - ${APEX_CLI_FILE}...\n"
80+
APEX_EXISTS=true
7881
else
7982
echo -e "Installing Apex CLI...\n"
8083
fi
@@ -127,6 +130,10 @@ installFile() {
127130
fi
128131

129132
chmod o+x $tmp_root_apex_cli
133+
# Remove existing file to prevent signature caching.
134+
if [ "$APEX_EXISTS" = true ]; then
135+
runAsRoot rm "$APEX_INSTALL_DIR/$APEX_CLI_FILENAME"
136+
fi
130137
runAsRoot cp "$tmp_root_apex_cli" "$APEX_INSTALL_DIR"
131138

132139
if [ -f "$APEX_CLI_FILE" ]; then
@@ -166,7 +173,7 @@ trap "fail_trap" EXIT
166173

167174
getSystemInfo
168175
verifySupported
169-
checkExistingapex
176+
checkExistingApex
170177
checkHttpRequestCLI
171178

172179

0 commit comments

Comments
 (0)