Skip to content

Commit 2205c48

Browse files
committed
install: Explicitly delete the manifest during uninstall. Misc cleanup
1 parent 01d823b commit 2205c48

File tree

1 file changed

+20
-16
lines changed

1 file changed

+20
-16
lines changed

src/etc/install.sh

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -234,16 +234,16 @@ validate_opt
234234
# Sanity check: can we run the binaries?
235235
if [ -z "${CFG_DISABLE_VERIFY}" ]
236236
then
237-
# Don't do this if uninstalling. Failure here won't help in any way.
238-
if [ -z "${CFG_UNINSTALL}" ]
239-
then
240-
msg "verifying platform can run binaries"
241-
"${CFG_SRC_DIR}/bin/rustc" --version > /dev/null
242-
if [ $? -ne 0 ]
243-
then
244-
err "can't execute rustc binary on this platform"
245-
fi
246-
fi
237+
# Don't do this if uninstalling. Failure here won't help in any way.
238+
if [ -z "${CFG_UNINSTALL}" ]
239+
then
240+
msg "verifying platform can run binaries"
241+
"${CFG_SRC_DIR}/bin/rustc" --version > /dev/null
242+
if [ $? -ne 0 ]
243+
then
244+
err "can't execute rustc binary on this platform"
245+
fi
246+
fi
247247
fi
248248

249249
# Sanity check: can we can write to the destination?
@@ -255,7 +255,7 @@ if [ $? -ne 0 ]
255255
then
256256
err "can't write to destination. consider \`sudo\`."
257257
fi
258-
rm "${CFG_LIBDIR}/rust-install-probe"
258+
rm -f "${CFG_LIBDIR}/rust-install-probe"
259259
need_ok "failed to remove install probe"
260260

261261
# Sanity check: don't install to the directory containing the installer.
@@ -281,7 +281,7 @@ then
281281
msg "removing $p"
282282
if [ -f "$p" ]
283283
then
284-
rm "$p"
284+
rm -f "$p"
285285
if [ $? -ne 0 ]
286286
then
287287
warn "failed to remove $p"
@@ -291,12 +291,16 @@ then
291291
fi
292292
done < "${INSTALLED_MANIFEST}"
293293

294-
# TODO: Remove the manifest.
295-
# If we fail to remove rustlib below, then the installed manifest will
296-
# still be full; the installed manifest needs to be empty before install.
294+
# If we fail to remove rustlib below, then the installed manifest will
295+
# still be full; the installed manifest needs to be empty before install.
296+
msg "removing ${CFG_LIBDIR}/rustlib/manifest"
297+
rm -f "${CFG_LIBDIR}/rustlib/manifest"
298+
# For the above reason, this is a hard error
299+
need_ok "failed to remove installed manifest"
297300

298301
# Remove 'rustlib' directory
299-
rm -r "${CFG_LIBDIR}/rustlib"
302+
msg "removing ${CFG_LIBDIR}/rustlib"
303+
rm -Rf "${CFG_LIBDIR}/rustlib"
300304
if [ $? -ne 0 ]
301305
then
302306
warn "failed to remove rustlib"

0 commit comments

Comments
 (0)