版本控制软件将保留 POSIX FS (ext3/ext4) 中的所有文件及其元数据
场景
我正在为某些嵌入式 Linux 设备开发 Root FS。它位于主机上,通过 NFS 导出,我的开发板安装在“/”下。 我需要的工作流程是: - 与其他开发人员分享我的 FS(他们有自己的开发板) - 将我的根文件系统备份到某个“服务器”上 - 将我的根 FS 部署到闪存盘或其他介质上 - 跟踪我的根 FS 中特定文件的更改、分支和合并、回滚等。
伙计们,这在我看来是一个版本控制场景,我什至使用 git。
问题
如您所知,Git(还有 svn/mercurial/bazaar !) 1) 不存储特殊文件(/dev 下的设备文件等) 2) 不存储文件所有者和权限。 我想按原样存储所有内容。
问题:
您知道一些可以完成这项工作的 VCS 吗? 或者您可能知道用于执行我的场景的另一种(但简单)解决方案?
这是一个常见问题吗...
我相信是这样,因为到目前为止我已经听说过每个人(!)都为自己的目的而设计的脚本/挂钩/自定义软件。我只需要一个全食 VSS
谢谢!!
THE SCENARIO
I'm developing a Root FS for some embedded Linux device. It is sitting on the host, exported via NFS and my development board mounts is under "/".
The workflows that I need are:
- to share my FS to other developers(they have with their own dev. boards)
- to backup my Root FS onto some "server"
- to deploy my Root FS onto flash-disks or other media
- track changes in specific files in my Root FS, branching&merging,roll back etc.
Guys, this seems to me as a Version Control scenario, and I even use git.
THE PROBLEM
As you know Git(and svn/mercurial/bazaar too !) 1) does not store special files (device files under /dev etc.) 2) does not store file owners and permissions.
I want to store everything and AS IS.
THE QUESTION:
Do you know some VCS that will do the job ?
Or may be you know about another (but simple) solution for doing my scenarios ?
IS IT A COMMON PROBLEM...
I believe that it is, because till now I've heard about scripts/hooks/custom soft that everybody(!) works out for his purposes. All I need is an all-eating-VSS
Thank you !!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
做过类似的事情(为嵌入式 Linux 操作系统开发固件)后,我发现最好将设备文件创建放入构建系统调用的脚本中,而不是将设备文件直接存储在开发计算机上。然后,创建文件的脚本(而不是文件本身)进入版本控制,并且(额外)您不需要成为 root 来修改它们。相反,通过 fakeroot 运行构建。
我想这并不能直接回答您的问题,但可能值得考虑修改您的开发模型。以 root 身份运行构建从来都不是一个好主意,因为如果您不小心在公共路径前面有一个“/”,会发生什么?您可能会无意中将 /bin 替换为为不同架构构建的 busybox 的一大堆链接。
Having done something similar (developing firmware for an embedded Linux OS), I've found that it's better to put device file creation into a script called by your build system, rather than to store device files directly on the development machine. Then the script that creates the files goes into version control, instead of the files themselves, and (BONUS) you don't need to be root to modify them. Run the build through fakeroot instead.
I suppose this doesn't directly answer your question, but it may be worth thinking about revising your development model. It's NEVER a good idea to run your build as root, because what happens if you accidentally have a "/" in front of a common path? You may inadvertently replace /bin with a whole bunch of links to busybox built for a different architecture.
这是适合您的工具:
http://fsvs.tigris.org/
它有 svn 后端。
This is the tool for you:
http://fsvs.tigris.org/
it has svn backend.
我知道这似乎有点明显,但正如您没有提到的那样:您是否考虑过将所有特殊文件放入常规文件(例如 tar 存档)的机制?您可以使用任何版本控制系统来存储它,并且由于文件系统具有大量二进制数据,因此完整根文件系统的两个版本之间的差异无论如何都没有那么有用,因此您甚至可能不会丢失您版本的太多功能控制系统提供。
I know this seems a little obvious, but as you haven't mentioned it: Have you considered mechanisms to put all your special files into a regular file, like, for example, into a tar archive? You could store that just fine with any version control system, and as filesystems have lots of binary data anyway diffs between two revisions of a full root filesystem aren't that useful anyway, so you might even not lose too many of the features your version control system provides.
initramfs 很好地解决了 userid、groupid、权限问题。在你的内核源代码目录中,有scripts/gen_initramfs_list.sh。
该脚本允许您从多个来源构建 initramfs 存档。例如,您可以指定:
目录:在此基本目录中找到的文件和目录将位于文件系统的根目录。
文件列表:它是一个文本文件,对于创建目录、文件和特殊设备文件非常有用。请参阅下面的示例
如果您以非 root 身份进行开发,并且您的 rootfs 位于 rootfsdir 中,那么 rootfsdir 中的文件可能归您所有。 gen_initramfs_list 可以将你的 uid, gid 转换为 0, 0。这是一个示例命令行:
其中 device.txt 包含:
然后你可以对 rootfsdir 内容使用标准版本控制,并在版本控制下添加 device.txt 文件,在这里您是:内容和文件属性已版本化:)。
我不知道是否可以通过文件列表源更改目录源中文件的权限和 uid/gid,但这将是一个逻辑功能。
当然,您可以从最小的 root fs 开始,从中挂载现有的 nfs_export。
这是一个常见的问题,gen_initramfs_list 是解决它的工具。
initramfs is a good answer to the userid groupid, permissioon problem. In your kernel source directory, there is scripts/gen_initramfs_list.sh.
This script allows you to build an initramfs archive from several sources. You can for example, specify :
a directory : The files and directory found in this base directory will be at the root of your file system.
a file liste : it is a text file, very useful to create directory, files and special device files. See example below
If you develop as non root, and your rootfs is in rootfsdir, then probably the file in rootfsdir are owned by you. gen_initramfs_list can translate your uid, gid into 0, 0. Here is an exemple command line :
Where device.txt contains :
Then you can use standard version control for your rootfsdir content, and add the device.txt file under version control, and here you are : content and file attribute are versionned :).
I don't know if you can change the permission and uid/gid of a file in a directory source via a filelist source, but this would be a logical feature.
Of course you can start with minimal root fs, from which you mount your existing nfs_export.
It is a common problem, and gen_initramfs_list is the tool to solve it.
为什么不直接使用rsync呢?像 rsnapshot (http://www.rsnapshot.org) 这样的东西会做你想做的事。或者 Unison (http://www.cis.upenn.edu/~bcpierce/unison/< /a>) 是专门为此设计的 - 它将自己描述为具有版本控制的跨平台文件同步技术,并且可能正是您所需要的。
Why not just use rsync? Something like rsnapshot (http://www.rsnapshot.org) will do what you want. Alternatively Unison (http://www.cis.upenn.edu/~bcpierce/unison/) is explicitly designed for this - it describes itself as a cross-platform file synchronisation technology with version control, and might be what you need.