File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -199,10 +199,9 @@ dist-install-dir-$(1): PREPARE_LIB_CMD=$(DEFAULT_PREPARE_LIB_CMD)
199199dist-install-dir-$(1 ) : PREPARE_MAN_CMD=$(DEFAULT_PREPARE_MAN_CMD )
200200dist-install-dir-$(1 ) : PREPARE_CLEAN=true
201201dist-install-dir-$(1 ) : prepare-base-dir-$(1 )
202- # Write the install manifest, making sure the manifest contains itself
203- $$(Q ) touch $$(PREPARE_DEST_DIR ) /$$(CFG_LIBDIR_RELATIVE ) /rustlib/manifest-$(1 ) .in
204202 $$(Q ) (cd $$(PREPARE_DEST_DIR ) / && find -type f | sed 's/^\.\///') \
205- > $$(PREPARE_DEST_DIR ) /$$(CFG_LIBDIR_RELATIVE ) /rustlib/manifest-$(1 ) .in
203+ > tmp/dist/manifest-$(1 ) .in
204+ $$(Q ) mv tmp/dist/manifest-$(1 ) .in $$(PREPARE_DEST_DIR ) /$$(CFG_LIBDIR_RELATIVE ) /rustlib/manifest.in
206205# Add remaining non-installed files
207206 $$(Q )$$(PREPARE_MAN_CMD ) $$(S ) COPYRIGHT $$(PREPARE_DEST_DIR )
208207 $$(Q )$$(PREPARE_MAN_CMD ) $$(S ) LICENSE-APACHE $$(PREPARE_DEST_DIR )
Original file line number Diff line number Diff line change 227227step_msg " validating $CFG_SELF args"
228228validate_opt
229229
230+
231+ # OK, let's get installing ...
232+
230233# Sanity check: can we can write to the destination?
231234umask 022 && mkdir -p " ${CFG_LIBDIR} "
232- need_ok " can't write to destination. consider ` sudo` ."
235+ need_ok " can't write to destination. consider ' sudo' ."
233236touch " ${CFG_LIBDIR} /rust-install-probe" 2> /dev/null
234237if [ $? -ne 0 ]
235238then
236- err " can't write to destination. consider ` sudo` ."
239+ err " can't write to destination. consider ' sudo' ."
237240fi
238241rm " ${CFG_LIBDIR} /rust-install-probe"
239242need_ok " failed to remove install probe"
240243
244+ # Sanity check: don't install to the directory containing the installer.
245+ # That would surely cause chaos.
246+ INSTALLER_DIR=" $( cd $( dirname $0 ) && pwd) "
247+ PREFIX_DIR=" $( cd ${CFG_PREFIX} && pwd) "
248+ if [ " ${INSTALLER_DIR} " = " ${PREFIX_DIR} " ]
249+ then
250+ err " can't install to same directory as installer"
251+ fi
252+
241253# The file name of the manifest we're going to create during install
242254INSTALLED_MANIFEST=" ${CFG_LIBDIR} /rustlib/manifest"
243255
You can’t perform that action at this time.
0 commit comments