GNU Stow:错误:包名称中不允许使用斜杠

GNU Stow:错误:包名称中不允许使用斜杠

使用时出现错误:错误:包名称中不允许使用斜杠stow --simulate -v --target=/path/to/target/tree /path/to/source/tree

我做错了什么??

答案1

Stow 期望作为参数的包名称 - 例如“gcc”或“vim”或“foo”或“my-awesome-packge” - 而不是像/path/to/source/tree.默认情况下,它将在本地目录中查找该包,然后将其符号链接到父目录(或者--target如果您不喜欢默认值,则链接到您指定的任何目录)。

换句话说,如果我的目录/usr/local/stow包含:

packagea/
  bin/
    packagea
packageb/
  bin/
    packageb
  share/
    man/
      man1/
        packageb.1

然后我可以cd进入/usr/local/stow并运行stow packageaor stow packageb,并将stow创建必要的符号链接:

  • 对于stow packagea,/usr/local/bin/packagea将指向/usr/local/stow/package/bin/pacakge
  • 为了stow packageb
    • /usr/local/bin/packageb会链接到/usr/local/stow/packageb/bin/packageb
    • /usr/local/share/man/man1/packageb.1会链接到/usr/local/stow/packageb/share/man/man1/packageb.1

像这样:

# cd /usr/local/stow
# tree
.
└── packageb
    ├── bin
    │   └── packageb
    └── share
        └── man
            └── man1
                └── packageb.1
# stow --simulate -v packageb
LINK: bin/packageb => ../stow/packageb/bin/packageb
LINK: share/man/man1/packageb.1 => ../../../stow/packageb/share/man/man1/packageb.1
WARNING: in simulation mode so not modifying filesystem.

如果我想/usr/share/powerline/config_files/themes/tmux/default.json用 stow 来管理,我可能会做如下的事情。这里/root/stow是我的存放目录(但它可以在任何地方),我将其用作/usr/share我的目标目录。

  1. 在开始之前,我有:

    # tree /usr/share/powrline
    /usr/share/powrline/
    └── config_files
        └── themes
            ├── file1.txt
            ├── file2.txt
            ├── file3.txt
            ├── file4.txt
            └── file5.txt
    
  2. 在我的存放目录中:

    mkdir -p powrline/powrline/config_files/themes/tmux
    echo '{"this": "is a test"}' > powrline/powrline/config_files/themes/tmux/default.json
    

    这给了我:

    # tree
    .
    └── powrline
        └── powrline
            └── config_files
                └── themes
                    └── default.json
    
    
  3. 然后,也在我的 stow 目录中:

    stow --target=/usr/share powrline
    
  4. 这会给我:

    # tree /usr/share/powrline/
    /usr/share/powrline/
    └── config_files
        └── themes
            ├── default.json -> ../../../../../root/stow/powrline/powrline/config_files/themes/default.json
            ├── file1.txt
            ├── file2.txt
            ├── file3.txt
            ├── file4.txt
            └── file5.txt
    

我当然可以解码以使用除/usr/share目标之外的其他内容:例如,我可以用作/usr/share/powrline我的目标目录,在这种情况下,我的 stow 目录将如下所示:

.
└── powrline
    └── config_files
        └── themes
            └── default.json

相关内容