为什么解压缩时会创建符号链接?
Why are symlinks created when unzipping?
我有一个存储库,用于存储我所有的点文件,因此可以更轻松地设置新计算机。该存储库还包含用于安装应用程序、修改我的扩展坞、设置首选项、更新 SSH 密钥等的脚本。由于存储库更新了我的 SSH 密钥并修改了我的 git 配置,我发现仅下载存储库会更容易作为 ZIP 文件,然后 运行 启动脚本(与手动设置 Git 然后克隆存储库)。
但是,我这样做只是为了设置一台新计算机并使用 unzip dotfiles.zip
解压缩存储库,看起来我的一些设置实际上 运行(设置符号链接)。
ewiener@laptop repositories % unzip dotfiles.zip
Archive: dotfiles.zip
a58722380d39f1f13a3b9ab3238be6abd9c3b5a3
creating: dotfiles-master/
inflating: dotfiles-master/.gitconfig
extracting: dotfiles-master/.gitignore
creating: dotfiles-master/.ssh/
linking: dotfiles-master/.ssh/.ssh -> /home/eric/repositories/dotfiles/.ssh
inflating: dotfiles-master/.ssh/config
inflating: dotfiles-master/.ssh/id_rsa
inflating: dotfiles-master/.ssh/id_rsa.pub
inflating: dotfiles-master/.ssh/known_hosts
inflating: dotfiles-master/.ssh/known_hosts.old
inflating: dotfiles-master/.vimrc
creating: dotfiles-master/OSX/
extracting: dotfiles-master/OSX/.gitignore_global
inflating: dotfiles-master/OSX/.p10k.zsh
inflating: dotfiles-master/OSX/.zshrc
inflating: dotfiles-master/OSX/Chester.itermcolors
inflating: dotfiles-master/OSX/OSX Setup.md
creating: dotfiles-master/OSX/OSX Setup/
inflating: dotfiles-master/OSX/OSX Setup/Screen_Shot_2020-03-24_at_12.29.35_PM.png
creating: dotfiles-master/OSX/iterm2_preferences/
inflating: dotfiles-master/OSX/iterm2_preferences/com.googlecode.iterm2.plist
inflating: dotfiles-master/OSX/link_files.sh
inflating: dotfiles-master/OSX/setup.sh
inflating: dotfiles-master/OSX/setup_dock.sh
inflating: dotfiles-master/aliases.zsh
creating: dotfiles-master/ubuntu/
extracting: dotfiles-master/ubuntu/.gitignore_global
inflating: dotfiles-master/ubuntu/.p10k.zsh
inflating: dotfiles-master/ubuntu/.zshrc
inflating: dotfiles-master/ubuntu/computer-setup-ubuntu.md
inflating: dotfiles-master/ubuntu/link_files.sh
inflating: dotfiles-master/ubuntu/setup.sh
inflating: dotfiles-master/ubuntu/use_robot.sh
finishing deferred symbolic links:
dotfiles-master/.ssh/.ssh -> /home/eric/repositories/dotfiles/.ssh
为什么在解压缩存储库时创建了符号链接?
很可能是因为 zip 文件是使用符号链接创建的。
来自zip man page:
-y |
--symlinks
For UNIX and VMS (V8.3 and later), store symbolic links as such in the zip archive, instead of compressing and storing the file
referred to by the link. This can avoid multiple copies of files being
included in the archive as zip recurses the directory trees and
accesses files directly and by links.
我有一个存储库,用于存储我所有的点文件,因此可以更轻松地设置新计算机。该存储库还包含用于安装应用程序、修改我的扩展坞、设置首选项、更新 SSH 密钥等的脚本。由于存储库更新了我的 SSH 密钥并修改了我的 git 配置,我发现仅下载存储库会更容易作为 ZIP 文件,然后 运行 启动脚本(与手动设置 Git 然后克隆存储库)。
但是,我这样做只是为了设置一台新计算机并使用 unzip dotfiles.zip
解压缩存储库,看起来我的一些设置实际上 运行(设置符号链接)。
ewiener@laptop repositories % unzip dotfiles.zip
Archive: dotfiles.zip
a58722380d39f1f13a3b9ab3238be6abd9c3b5a3
creating: dotfiles-master/
inflating: dotfiles-master/.gitconfig
extracting: dotfiles-master/.gitignore
creating: dotfiles-master/.ssh/
linking: dotfiles-master/.ssh/.ssh -> /home/eric/repositories/dotfiles/.ssh
inflating: dotfiles-master/.ssh/config
inflating: dotfiles-master/.ssh/id_rsa
inflating: dotfiles-master/.ssh/id_rsa.pub
inflating: dotfiles-master/.ssh/known_hosts
inflating: dotfiles-master/.ssh/known_hosts.old
inflating: dotfiles-master/.vimrc
creating: dotfiles-master/OSX/
extracting: dotfiles-master/OSX/.gitignore_global
inflating: dotfiles-master/OSX/.p10k.zsh
inflating: dotfiles-master/OSX/.zshrc
inflating: dotfiles-master/OSX/Chester.itermcolors
inflating: dotfiles-master/OSX/OSX Setup.md
creating: dotfiles-master/OSX/OSX Setup/
inflating: dotfiles-master/OSX/OSX Setup/Screen_Shot_2020-03-24_at_12.29.35_PM.png
creating: dotfiles-master/OSX/iterm2_preferences/
inflating: dotfiles-master/OSX/iterm2_preferences/com.googlecode.iterm2.plist
inflating: dotfiles-master/OSX/link_files.sh
inflating: dotfiles-master/OSX/setup.sh
inflating: dotfiles-master/OSX/setup_dock.sh
inflating: dotfiles-master/aliases.zsh
creating: dotfiles-master/ubuntu/
extracting: dotfiles-master/ubuntu/.gitignore_global
inflating: dotfiles-master/ubuntu/.p10k.zsh
inflating: dotfiles-master/ubuntu/.zshrc
inflating: dotfiles-master/ubuntu/computer-setup-ubuntu.md
inflating: dotfiles-master/ubuntu/link_files.sh
inflating: dotfiles-master/ubuntu/setup.sh
inflating: dotfiles-master/ubuntu/use_robot.sh
finishing deferred symbolic links:
dotfiles-master/.ssh/.ssh -> /home/eric/repositories/dotfiles/.ssh
为什么在解压缩存储库时创建了符号链接?
很可能是因为 zip 文件是使用符号链接创建的。
来自zip man page:
-y | --symlinks
For UNIX and VMS (V8.3 and later), store symbolic links as such in the zip archive, instead of compressing and storing the file referred to by the link. This can avoid multiple copies of files being included in the archive as zip recurses the directory trees and accesses files directly and by links.