Commit de72858
install: default to ~/.local/bin and preserve existing install path
`curl -fsSL https://polar.sh/install.sh | bash` could fail on machines
without `/usr/local/bin` because the installer tried to move the binary
there before ensuring the directory existed. For example, on my machine:
```
==> Detecting platform...
==> Platform: darwin-arm64
==> Fetching latest version...
==> Version: v1.3.6
==> Downloading polar v1.3.6...
==> Verifying checksum...
==> Checksum verified
==> Extracting...
==> Installing to /usr/local/bin...
mv: rename /var/folders/km/xvqr8_156mn6dbxj17fsvcy80000gn/T/tmp.PNE7BmJFn8/polar to /usr/local/bin/polar: No such file or directory
```
Instead, following XDG conventions, default to `~/.local/bin` for fresh
installs, create the install directory before moving the binary, and
reuse the directory of an existing `polar` binary on upgrades so we do
not install a new copy that is shadowed earlier in `PATH`.1 parent 3cc653d commit de72858
1 file changed
Lines changed: 85 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
59 | 60 | | |
60 | 61 | | |
61 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
62 | 141 | | |
63 | 142 | | |
64 | 143 | | |
| 144 | + | |
| 145 | + | |
65 | 146 | | |
66 | 147 | | |
67 | 148 | | |
| |||
111 | 192 | | |
112 | 193 | | |
113 | 194 | | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
| 195 | + | |
| 196 | + | |
120 | 197 | | |
121 | 198 | | |
122 | 199 | | |
| |||
125 | 202 | | |
126 | 203 | | |
127 | 204 | | |
| 205 | + | |
128 | 206 | | |
129 | 207 | | |
130 | 208 | | |
| |||
0 commit comments