`make install` 复制了哪些文件,复制到哪里?

发布于 2024-08-07 07:14:42 字数 92 浏览 3 评论 0原文

有没有办法获取 make install 复制到文件系统的文件名/路径列表?有些软件包附带 MANIFEST 文件,但我正在使用的软件包则没有。

Is there a way to get a list of filenames/paths that make install copies to the filesystem? Some packages come with a MANIFEST file, but not the ones that I am working with.

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

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

发布评论

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

评论(6

李不 2024-08-14 07:14:42

我只是在编译 QEMU 的自定义版本时自己对此进行了调查。我使用以下方法来确定安装的内容和位置(以及将其用作 .deb 文件的基础):

mkdir /tmp/installer
./configure --target-list=i386-softmmu
make
sudo make install DESTDIR=/tmp/installer
cd /tmp/installer
tree .

Tree 是一个实用程序,它以视觉上吸引人的方式递归显示目录的内容 - sudo apt-get install tr​​ee 适用于 Debian / Ubuntu 用户

希望对某人有所帮助...我花了一些时间才弄清楚,但我发现这是一个非常有用的方法想象正在发生的事情。

I was just investigating this myself while compiling a custom version of QEMU. I used the following method to work out what was installed and where (as well as using it as a basis for a .deb file):

mkdir /tmp/installer
./configure --target-list=i386-softmmu
make
sudo make install DESTDIR=/tmp/installer
cd /tmp/installer
tree .

Tree is a utility that recursively displays the contents of a directory in a visually appealing manner - sudo apt-get install tree for Debian / Ubuntu users

Hope that helps someone... it took me a bit of poking around to nut it out, but I found it quite a useful way of visualising what was going on.

得不到的就毁灭 2024-08-14 07:14:42

最简单的方法是使用 chroot:在 chroot 监狱内运行“make install”;计算安装前的文件列表,并将其与安装后的文件列表进行比较。

许多安装将支持 --prefix 配置选项和/或 DESTDIR 环境变量。您可以将它们用于 chroot 的更轻等待版本(相信如果您以相当无特权的用户身份运行安装,则如果尝试写入这些之外的位置,安装将会失败)。

另一种方法是替换安装程序。许多软件包支持 INSTALL 环境变量,它是要使用的安装程序;周围有安装的跟踪版本。

The most fool-proof way is to use chroot: have "make install" run inside a chroot jail; compute a list of the files that you had before the installation, and compare that to the list of files after the installation.

Many installations will support either a --prefix configuration option, and/or a DESTDIR environment variable. You can use those for a lighter-wait version of chroot (trusting that the installation will fail if it tries to write to a location outside these if you run installation as a fairly unprivileged user).

Another approach is to replace the install program. Many packages support an INSTALL environment variable that, well, is the install program to use; there are tracing versions of install around.

无人问我粥可暖 2024-08-14 07:14:42

如果编译说明的作者提供了允许卸载的信息,make uninstall 可能会在删除文件时显示这些文件(自从我完成卸载以来已经有一段时间了,所以我不能肯定地说) 。

此外,make -n install 将对安装过程进行“dry run”,从其结果中提取信息可能是合理的。

make uninstall might show the files as it removes them if the author of the compiling instructions provides the information to allow an uninstall (it has been awhile since I have done one so I can't say for sure).

Also make -n install will do a "dry run" of the install process and it may be reasonable to extract the information from its results.

脱离于你 2024-08-14 07:14:42

对于您运行“make install”的每个项目,它都不同。安装的文件由正在使用的 Makefile 中的安装目标控制。最好的办法是打开 Makefile 并搜索“install:” - 从那里您可以看到哪些文件将被复制到您的系统中。

It differs for every project that you run 'make install' on. The files which are installed are controlled by the install target in the Makefile being used. Your best bet is to open the Makefile and search for 'install:' - from there you can see what files will be copied out to your system.

赏烟花じ飞满天 2024-08-14 07:14:42
  1. 在安装之前拍摄安装位置内容的快照
  2. 安装
  3. 将当前内容与旧内容进行比较。

例子:

./configure --prefix /usr/local
make -j`nproc`

find /usr/local | sort -u > /tmp/snapshot1
make install
find /usr/local | sort -u > /tmp/snapshot2
comm -3 /tmp/snapshot{1,2} # this prints the files added by `make install` to stdout
  1. Take a snapshot of the contents of the install location before installing
  2. Install
  3. Compare the current contents with the old contents.

Example:

./configure --prefix /usr/local
make -j`nproc`

find /usr/local | sort -u > /tmp/snapshot1
make install
find /usr/local | sort -u > /tmp/snapshot2
comm -3 /tmp/snapshot{1,2} # this prints the files added by `make install` to stdout
梦行七里 2024-08-14 07:14:42

如果您使用的安装程序不支持 DESTDIR 或 --prefix (或等效项),我发现可以按如下方式识别新文件:

  1. 从尽可能干净的系统开始(一个新的虚拟机)最好是图片)
  2. 编译软件,等待几分钟。
  3. 安装软件包。
  4. 查找过去 5 分钟内修改的文件:sudo find / -mmin -5 -type f (find 命令有大量参数用于根据文件修改/创建时间进行查询,但这效果很好对我来说;你只需要缩小时间跨度,这样你就可以获取安装程序创建的文件,而不是其他的)。

If the install program you're using doesn't support DESTDIR or --prefix (or an equivalent), I have found that it may be possible to identify new files as follows:

  1. Start with as clean a system as possible (a fresh VM image is preferable)
  2. Compile the software, wait a few minutes.
  3. Install the software package.
  4. Find files modified within the past 5 minutes: sudo find / -mmin -5 -type f (the find command has a ton of parameters for querying based on file modification / creation times, but this worked pretty well for me; you just need to narrow the time span so that you pick up the files created by the installer but nothing else).
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文