Add readme to make this public

main
Sean Hickey 2021-08-29 15:58:57 -07:00
parent 894996ac73
commit 0a5b671472
2 changed files with 74 additions and 1 deletions

73
README.md Normal file
View File

@ -0,0 +1,73 @@
# Localinstall
This is a simple script that symlinks files into my `~/.local/bin`
directory. I have this directory already part of my `PATH` environment
variable, so this allows me to effectively "install" stuff for just my
user.
You can use `localinstall.sh` to install itself as a convenient first
step.
```sh
./localinstall.sh ./localinstall.sh
```
Then make sure that your `PATH` is updated to use these binaries. Add
this to your shell init file thing (e.g. `.zshrc` or `.bashrc`):
```sh
PATH=${HOME}/.local/bin:$PATH
```
Then open a new shell (or source your init file again) and you should
be able to call `localinstall.sh` from any directory.
Then lets say you compiled a binary called `my_program`. You can do this
```sh
localinstall.sh ./my_program
```
And now you can call `my_program` from anywhere as well.
## But Why!?
Why the heck would you ever use this? Well...a couple of reasons.
Personally, I don't like it when I have to install stuff into a more
global directory. A lot of programs will default to `/usr/local/bin`,
which seems like the ideal place to put stuff. However, it still needs
`sudo` to install things there, and it installs stuff for all users on
the system. I don't necessarily want other users to use my
development-branch build of a program.
When running `make install` (or similar), some programs don't have a
sane default like `/usr/local/bin` and instead do things like
`/usr/local/<program>` or `/opt/<program>`. I don't think I've ever
seen anything actually plop directly into `/usr/bin` or `/bin`, but
that would be the worst case scenario. This script lets me keep all my
binaries in one place, specifically ones that are not installed by the
system's repository. Related to this, I know where everything is, and
so they are easier to cleanup or uninstall later. Some programs don't
properly implement `make uninstall`.
I don't typically have other users on my systems, just me. So
installing globally for all users vs just my user is kinda moot.
I also don't always want all of the things to be installed from a
software package. Running `make install` may place a whole collection
of binaries into my system when I really only wanted 1 of them. This
lets me just symlink the one I needed.
## Limitations
As kinda outlined in the "why" section, using this script has some
limitations/properties:
* These are only installed for the user that ran the script.
* The thing pointed to by each symlink can change out from under you.
# Copyright
I think this script is too small to reasonably apply copyright
to. It is in the Public Domain.

View File

@ -9,7 +9,7 @@ file=$1
install_dir="${HOME}/.local/bin"
filepath=$(readlink -f "$file")
filepath=$(readlink "$file")
filename=$(basename "$file")
mkdir -p $install_dir