将 cygwin 从一台机器移动到另一台机器时要复制什么?

发布于 2024-07-23 17:49:13 字数 159 浏览 6 评论 0原文

我正在重新安装计算机上的所有内容,其中包括 Cygwin。 我试图避免重新安装,部分原因是我什至不知道我安装的是什么。 我是否可以将 Cygwin 目录从一台计算机移动到另一台计算机并期望一切正常,或者是否还需要移动一些其他重要设置?

据我所知,它非常独立,但人们永远不知道。

I'm reinstalling everything on my machine, and amongst those is Cygwin. I'm trying to avoid reinstallation, partly because I don't even know what it is that I've installed. Can I just move the Cygwin directory from one machine to another and expect everything to work, or are there some other important settings that I need to move as well?

As far as I saw, it's pretty self-contained, but one never knows.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

柠栀 2024-07-30 17:49:13

是的! 大胆试试吧。 你不会遇到任何问题。

您只需将整个 cygwin 目录复制到您的新计算机,打开 cygwin shell,所有内容(只要您只调用 cygwin 内部程序和路径中的内容)就会像您正在处理您的计算机一样工作。老机器。

您唯一会丢失的是存储“已下载并压缩”的软件包(以便可能重新安装)的目录。 幸运的是这个目录是可选的,所以迁移到另一个平台没有问题。 您也可以复制该目录,但很可能您拥有的所有软件包都已过时,并且运行 setup.exe 无论如何都会获取新版本...

顺便说一句 - 因为有人说了完全相反的一些现实生活经验:我经常使用这个功能并取得成功。 我已将 cygwin 目录复制到 USB 记忆棒并在朋友的计算机上使用它。 当我们去度假并随身携带笔记本电脑时,我还将它复制到我未婚夫的笔记本电脑上。

它总是可以正常工作,没有任何问题......

Yep! Go for it. You won't encounter any problems.

You can just copy the entire cygwin directory to your new machine, open up the cygwin shell and everything (as long as you are only calling cygwin-internal programs and stuff that's within the path) will just work as if you you are working on your old machine.

The only thing you'll loose is the directory where the "already downloaded and compressed" packages for a possible re-installation are stored. Fortunately this directory is optional, so no problem for migration to another platform. You could copy that directory as well, but most likely all the packages that you have are outdated anyways and a run of setup.exe would fetch the new versions anyway...

Btw - since someone said exactly the opposite some real-life experience: I use this feature quite often with success. I've copied my cygwin dir to USB-sticks and used it on friends computers. I also copied it to the laptop of my fiance when we go to holidays and take a laptop with us.

It always worked without any problems....

万劫不复 2024-07-30 17:49:13

简短的回答是:不,您无法复制整个 Cygwin 文件夹。 你只需复制你需要的配置文件(bash文件,vim文件等)。

长答案是:如果复制整个 Cygwin 文件夹,它可能在某些情况下有效,而在其他情况下可能无效。

原因是:在 Windows 上复制文件时会丢失 linux 文件模式。 这会带来很多麻烦。 但是,当您像普通 Windows 程序一样使用 Cygwin 时(这意味着您不关心文件模式和任何相关内容)并以 Windows 管理员身份运行它(当 Cygwin 照常安装时不需要这样做)时,您可能不会遇到麻烦)。

顺便说一句:您可以导出通过 cygcheck.exe -c 安装的软件包并将其安装在新的 Cygwin 上。 您还可以在命令行中通过 Cygwin 的 setup-x86_64.exe 安装/更新 Cygwin 软件包,例如:

setup-x86_64.exe -q -P package1,package2,package3

The short answer is: No, you can't copy the whole Cygwin folder. You just copy the configuration files(bash files, vim file, etc.) you need.

The long answer is: If you copy the whole Cygwin folder, it may work in some case, and may not in some other case.

The reason is: you will lose linux file mode when copying files on Windows. And that will cause a lot of troubles. However, you may not have the troubles when you use Cygwin just like a common Windows Program(which means you don't care file mode and anything related), and run it as Windows Administrator(which is not required when Cygwin is installed as usual).

BTW: you can export the packages you installed by cygcheck.exe -c and install them on the new Cygwin. You can also install/update Cygwin packages by Cygwin's setup-x86_64.exe in command line like:

setup-x86_64.exe -q -P package1,package2,package3
柠檬色的秋千 2024-07-30 17:49:13

不,您必须从 cygwin 安装程序重新安装它,抱歉!

最重要的是,您需要复制主目录中的所有内容(默认为 c:/cygwin/home/),尤其是带有“.”的任何内容。 在文件名前面。

至于个人应用程序首选项等,您可能会丢失这些内容 - 但如果您在仍然可以访问旧计算机的情况下进行重新安装 - 您可能可以轻松恢复之前安装的 90%。

No, you have to reinstall it from the cygwin installer, sorry!

Most importantly you'll want to copy everything from your home directory (default is c:/cygwin/home/) especially anything w/ a "." in front of the filename.

As for individual application preferences, etc., you may lose those -- but if you do the reinstall while you still have access to your old machine -- you can probably get to 90% of your previous install without too much trouble.

ま昔日黯然 2024-07-30 17:49:13

我从一台 cygwin64 (我不认为有什么区别)复制到另一台机器的经验是,所有符号链接都被破坏了:

举个例子:

曾经是 /usr/bin/cc -> ; /usr/bin/gcc.exe (或类似的东西)
复制后 /usr/bin/cc 成为包含字符串的文本文件:

!<symlink>/usr/bin/gcc.exe

我的复制方法仅仅是 cp -r /cygwin/c/cygwin64

My dest was a FAT32 FS,但我认为这与此无关。
许多这些“文本”文件中还散布着字符 0x00 和 0xFF,因此它们看起来像是二进制的。

My experience with copying from one cygwin64 (I don't think there is a difference) to another machine is that all of the symbolic links got crushed:

As an example:

What used to be /usr/bin/cc -> /usr/bin/gcc.exe (or something like that)
After the copy /usr/bin/cc became a text file containing the string:

!<symlink>/usr/bin/gcc.exe

My method of copy was merely cp -r /cygwin/c/cygwin64 <dest>

My dest was a FAT32 FS, but I don't think that had anything to do with it.
There were also characters 0x00 and 0xFF sprinkled among many of these 'text' files so that they appeared to be binary.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文