管理从源码安装的应用的link——stow

Thu, 2020-07-30
管理从源码安装的应用的link——stow

我原先发于 CSDN

Know from here

Install Position(take neovim as example)

/usr/local/stow/nvim/
cd /usr/local/stow/
sudo stow nvim

This command will make some link files at /usr/local/bin/, pointing to all the files in /usr/local/stow/nvim/bin and /usr/local/share/, pointing to all the files in /usr/local/stow/nvim/share and so on.

Example

For example, After make install, there will be nvim in /usr/local/stow/nvim/bin/, you could make a link file (like vim) in this directory, like following,

ll /usr/local/stow/nvim/bin
 total 16M
drwxr-sr-x 2 root staff 4.0K xxx xx xx:xx .
drwxr-sr-x 5 root staff 4.0K xxx xx xx:xx ..
-rwxr-xr-x 1 root staff  16M xxx xx xx:xx nvim
lrwxrwxrwx 1 root staff    4 xxx xx xx:xx vim -> nvim

ll /usr/local/stow/nvim/share
total 28K
drwxr-sr-x  7 root staff 4.0K xxx xx xx:xx .
drwxr-sr-x  5 root staff 4.0K xxx xx xx:xx ..
drwxr-sr-x  2 root staff 4.0K xxx xx xx:xx applications
drwxr-sr-x 31 root staff 4.0K xxx xx xx:xx locale
drwxr-sr-x  3 root staff 4.0K xxx xx xx:xx man
drwxr-sr-x  3 root staff 4.0K xxx xx xx:xx nvim
drwxr-sr-x  2 root staff 4.0K xxx xx xx:xx pixmaps

and then stow it

ll /usr/local/bin
total 8.0K
drwxr-xr-x  2 root root 4.0K xxx xx xx:xx .
drwxr-xr-x 11 root root 4.0K xxx xx xx:xx ..
lrwxrwxrwx  1 root root   21 xxx xx xx:xx nvim -> ../stow/nvim/bin/nvim
lrwxrwxrwx  1 root root   20 xxx xx xx:xx vim -> ../stow/nvim/bin/vim

ll /usr/local/share
total 24K
drwxr-xr-x  6 root root  4.0K xxx xx xx:xx .
drwxr-xr-x 11 root root  4.0K xxx xx xx:xx ..
lrwxrwxrwx  1 root root    31 xxx xx xx:xx applications -> ../stow/nvim/share/applications
lrwxrwxrwx  1 root root    25 xxx xx xx:xx locale -> ../stow/nvim/share/locale
drwxr-xr-x  2 root root  4.0K xxx xx xx:xx man
lrwxrwxrwx  1 root root    23 xxx xx xx:xx nvim -> ../stow/nvim/share/nvim
lrwxrwxrwx  1 root root    26 xxx xx xx:xx pixmaps -> ../stow/nvim/share/pixmaps

ll /usr/local/share/man
total 8.0K
drwxr-xr-x 2 root root 4.0K xxx xx xx:xx .
drwxr-xr-x 6 root root 4.0K xxx xx xx:xx ..
lrwxrwxrwx 1 root root   30 xxx xx xx:xx man1 -> ../../stow/nvim/share/man/man1
sudo stow --delete neovim
avatar
除非注明,本博客所有文章皆为原创。
本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议进行许可。