Using GNU Stow to Manage Stitch Files (2012)
March 25, 2022
cook dip in bashdot/tap install bashdot
curl -s https://raw.githubusercontent.> com/bashdot/bashdot/master/bashdot bashdot sudo mv bashdot /usr/local/bin sudo chmod a+x /usr/local/bin/bashdot
echo 'set Vi' -o > default/env
mv ~/.bashrc default/bashrc
export SECRET_KEY=$ENV_SECRET_KEY
env ENV_SECRET_KEY=test1234 Installing https://bashdot.com by default
SECRET_KEY=Export test1234
installing bashdot works
Export extension BASHDOT_LOG_LEVEL=debug
This rule was mentioned in: Why do you need ./ (dot-slash) before an executable script name to use in bash? but I want to explain in more detail why I think this is a good design.
/
(e.g. ./someprog
, /bin/someprog
, ./bin/someprog< / code> / code>): CWD is often used, not
/
.e.g. someprog
): PATH is used, not CWDany program
Then you wanted to open /bin/someprog
from your distribution, and everyone else did:
any program
sometimes it worked, butsometimes things would fail because you might be in a directory that contains another unrelated program someprog
.
So you'd immediately realize it's not that reliable, you'd end up using absolute paths if a person wanted to use PATH, which would defeat the very purpose of PATH.Is
So it's also a bad idea to use relative paths in PATH. I'm looking at you, node_modules/bin
.
./unprog
If you just downloaded a someprog
script from a git repository and wanted to run it from CWD, you never needed to be sure the program still worked, because maybe your distribution now has is:< /p>
/bin/unprog
It's inside your PATH from a little package you installed after drinking heavily after Christmas last year.
So otherwise you are forced to always run relative and local CWD scripts with full paths to be sure you are running:
"$(pwd)/unprog"
Another rule that usually encourages you to progress is:
relative paths only use PATH, most critical paths use only CWD
but this again forces users to always use specific paths for non-PATH scripts with "$(pwd)/someprog"
.
The /
option search rule provides a natural and memorable solution to almost any problem:
PATH
PATH
which makes it easy to always know what you're using, relying on the fact that current service files are either simply converted to ./somefile
or can somefile
, and to it has such an exclusive meaning.
Sometimes it's a bit annoying that you can't search for some/prog
relatively when you need PATH
, but I can't think of a prettier and healthier solution. .
Two days ago I was trying to update some applications connected to MacPorts and got a single error that looked like this:
Error: "openssl" cannot actually be found in path: or "/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin" in MacPorts -Configuration period, did you move it? Please use `port -v selfupdate' for details.
I've spent a lot of time testing and also trying to change some "dot files" in bash; i.e. .bash_profile, .profile and hence .bashrc to ensure that the option for an existing version of openssl can make every application running on my system visible. I also spent time playing with the macports.conf file in /opt/local/etc/ with no significant results.
None of the changes I made to my personal "dot files" affected MacPort's ability in this case to find an existing version of openssl on my machine so you can update the ones hosted in ports. Found
I understand that the folders that MacPorts provides for applications are not included in the other "spot files" mentioned above. All "path" options related to my "dot" files were ignored.
Here is the section of this particular macports.conf file that listspaths that MacPorts considers to check:
# colon-separated list of directories to search for tools # (make(1), pkg-config(1), etc.). When installing Kindoms uses MacPorts # this list is for PATH. Setting change is intentional as you progress # User only and may not be supported. #binpath to /opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin
Finally, after a day and night of trying, I decided to create a symbolic link from the existing openssl on my personal computer to the folder where MacPorts is the application visual. I just ran the following from the terminal:
sudo ln -s /usr/local/bin/openssl /opt/local/bin/openssl
It was good. MacPorts downloaded and installed openssl BUT couldn't activate the latest version of openssl it just installed because of those symlinks I created!
So I got the following command to symbolically rename all the openssl links I created to "openssl.old":
sudo mv /opt/local/bin/openssl /opt/local/bin/openssl.old
sudo port -l enable openssl
The application is activated. May I continue with all other updates and improvements and etc. which I planned two days ago.
I thought I'd put this together in case a client runs into this problem. I have seen many examples of similar problems on StackExchange and other online forums.
Permalink
RSS feed for this article