@@ -566,6 +566,8 @@ uninstall_components() {
566
566
verbose_msg " removing manifest directory $_md "
567
567
run rm -r " $_md "
568
568
want_ok " failed to remove $_md "
569
+
570
+ maybe_unconfigure_ld
569
571
fi
570
572
fi
571
573
@@ -696,12 +698,32 @@ install_components() {
696
698
done
697
699
}
698
700
699
- maybe_run_ldconfig () {
701
+ maybe_configure_ld () {
702
+ local _abs_libdir=" $1 "
703
+
700
704
get_host_triple
701
705
local _ostype=" $RETVAL "
702
706
assert_nz " $_ostype " " ostype"
703
707
704
708
if [ " $_ostype " = " unknown-linux-gnu" -a ! -n " ${CFG_DISABLE_LDCONFIG-} " ]; then
709
+
710
+ # Fedora-based systems do not configure the dynamic linker to look
711
+ # /usr/local/lib, which is our default installation directory. To
712
+ # make things just work, try to put that directory in
713
+ # /etc/ld.so.conf.d/rust-installer-v1 so ldconfig picks it up.
714
+ # Issue #30.
715
+ #
716
+ # This will get rm'd when the last component is uninstalled in
717
+ # maybe_unconfigure_ld.
718
+ if [ " $_abs_libdir " = " /usr/local/lib" -a -d " /etc/ld.so.conf.d" ]; then
719
+ echo " $_abs_libdir " > " /etc/ld.so.conf.d/rust-installer-v1-$TEMPLATE_REL_MANIFEST_DIR .conf"
720
+ if [ $? -ne 0 ]; then
721
+ # This shouldn't happen if we've gotten this far
722
+ # installing to /usr/local
723
+ warn " failed to update /etc/ld.so.conf.d. this is unexpected"
724
+ fi
725
+ fi
726
+
705
727
verbose_msg " running ldconfig"
706
728
if [ -n " ${CFG_VERBOSE-} " ]; then
707
729
ldconfig
@@ -715,6 +737,19 @@ maybe_run_ldconfig() {
715
737
fi
716
738
}
717
739
740
+ maybe_unconfigure_ld () {
741
+ get_host_triple
742
+ local _ostype=" $RETVAL "
743
+ assert_nz " $_ostype " " ostype"
744
+
745
+ if [ " $_ostype " != " unknown-linux-gnu" ]; then
746
+ return 0
747
+ fi
748
+
749
+ rm " /etc/ld.so.conf.d/rust-installer-v1-$TEMPLATE_REL_MANIFEST_DIR .conf" 2> /dev/null
750
+ # Above may fail since that file may not have been created on install
751
+ }
752
+
718
753
# Doing our own 'install'-like backup that is consistent across platforms
719
754
maybe_backup_path () {
720
755
local _file_install_path=" $1 "
@@ -967,8 +1002,8 @@ install_uninstaller "$src_dir" "$src_basename" "$abs_libdir"
967
1002
# Install each component
968
1003
install_components " $src_dir " " $abs_libdir " " $dest_prefix " " $components "
969
1004
970
- # Run ldconfig to make dynamic libraries available to the linker
971
- maybe_run_ldconfig
1005
+ # Make dynamic libraries available to the linker
1006
+ maybe_configure_ld " $abs_libdir "
972
1007
973
1008
echo
974
1009
echo " $TEMPLATE_SUCCESS_MESSAGE "
0 commit comments