2

I have created a special folder (/usr/manual) for everything I install manually. This way when I reinstall the OS or change my laptop all I have to do is move /home and /usr/manual/ and reinstall the package list.

So because of my decision to never manually add files anywhere except /home and /usr/manual I'm looking for a way to put all the custom environment variables inside /usr/manual/.

I have created a symlink inside profile.d: /etc/profile.d/usrprofile pointing to /usr/manual/profile.d. But the files in /usr/manual/profile.d never get executed: it seems that the parser can't handle symlinks.

Is there an easy way to solve my problem?

  • Why /usr/manual? That's what /usr/local is for. – Gilles 'SO- stop being evil' Mar 22 '16 at 21:31
  • @Gilles Because /usr/local/ has stuff in it that I didn't put there. It was installed by apt or by different installer scripts and the entire purpose of my setup is separating files I install manually from files installed by installers. – 0x60 Mar 22 '16 at 22:38
2

The /etc/profile script normally sources files in /etc/profile.d that are ending with .sh and does not take care of subfolders. So you would have to link every single .sh file from your /usr/manual/profile.d directory, or you write a wrapper that is inside /etc/profile.d that takes care of your own .sh files in /usr/manual/profile.d. While thinking about it, the latter one might be the more elegant.

  • A wrapper script is a good idea! But (at the risk of coming off criminally punctilious) is it much better than just having all the .sh scripts I have right now? Here's what I have in mind: if I forget to move my scripts when I move to a new machine, I might have to create them from scratch. If they are in /usr/manual/ and I forget to move the symlink, that's no big deal, I just make a new one. If I have the wrapper script in /etc/profile.d/ and I forget to move it, I have to write the wrapper script again. – 0x60 Mar 22 '16 at 19:09
  • 1
    @0x60 Make a symbolic link to the wrapper script. – Gilles 'SO- stop being evil' Mar 22 '16 at 21:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.