问题描述
我试图更改未知的uid和gid的文件,我的 rsync
命令将考虑作为源文件,然后执行我的 rsync
命令。
I am trying to change unknown uid's and gid's on files that my rsync
command would consider as source files before I execute my rsync
command.
我的 rsync
命令包含排除文件。
My rsync
command includes an exclude file.
我需要这样做的原因在我的问题)
Download the latest rsync
source tar file at rsync site
我已解压缩到
我下载了 Eclipse
以用作IDE,但您只需修改文件与 NotePad ++
如下:
I downloaded Eclipse
to use as an IDE but you could just modify the files with NotePad++
as follows:
在main.c文件中添加了一个信息行,运行rsync,以便您知道您正在使用您的个人rsync版本。我相信,还有一个适当的方式设置版本号为我自己的一个,但我会让有人评论如何做到这一点。 (所有我的行以/ * dalek * /结尾):
In the main.c file I added an information line that you see every time you run rsync so you know you are using your personal rsync version. I am sure that there is also an appropriate way to set the version number to one of my own but I will let someone comment on how to do that. (all my lines end with /* dalek */):
starttime = time(NULL);
our_uid = MY_UID();
our_gid = MY_GID();
rprintf(FINFO,"rsync 3.1.1 with edits started by uid: %u gid: %u\n", our_uid, our_gid ); /* dalek */
然后,在flist.c中,添加我的/ * dalek * / lines
Then, in flist.c, add my /* dalek */ lines as follows:
if (!preserve_uid || ((uid_t)F_OWNER(file) == uid && *lastname))
xflags |= XMIT_SAME_UID;
else {
uid = F_OWNER(file);
if (uid==4294967295){ /* dalek */
if (do_lchown(fname, our_uid, F_GROUP(file)) != 0) { /* dalek */
rprintf(FINFO, "COULD NOT CHANGE 4294967295 UID to %u on %s\n",our_uid,fname); /* dalek */
}else{ /* dalek */
uid=our_uid; /* dalek */
} /* dalek */
} /* dalek */
if (!numeric_ids) {
user_name = add_uid(uid);
if (inc_recurse && user_name)
xflags |= XMIT_USER_NAME_FOLLOWS;
}
}
if (!preserve_gid || ((gid_t)F_GROUP(file) == gid && *lastname))
xflags |= XMIT_SAME_GID;
else {
gid = F_GROUP(file);
if (gid==4294967295){ /* dalek */
if (do_lchown(fname, F_OWNER(file), our_gid) != 0) { /* dalek */
rprintf(FINFO, "COULD NOT CHANGE 4294967295 GID to %u on %s\n",our_gid,fname); /* dalek */
}else{ /* dalek */
gid=our_gid; /* dalek */
} /* dalek */
} /* dalek */
if (!numeric_ids) {
group_name = add_gid(gid);
if (inc_recurse && group_name)
xflags |= XMIT_GROUP_NAME_FOLLOWS;
}
}
然后在最近添加的rsync源目录中运行 ./ configure.sh
然后运行 make
,然后运行 make install
。这就对了!你应该在... / usr / local / bin中有一个新的rsync.exe文件,当你使用rsync从现在开始,因为cygwin放置... / usr / local / bin在... / bin之前它使用的PATH。原始rsync仍在... / bin中。要使用原始文件,只需将修改的rsync.exe移出/ usr / local / bin。
Then in your recently added rsync source directory run ./configure.sh
then run make
then run make install
. That is it! You should have a new rsync.exe file in .../usr/local/bin which will be run whenever you use rsync from now on since cygwin puts .../usr/local/bin ahead of .../bin in the PATH it uses. The original rsync is still in .../bin. To use the original, just move your modified rsync.exe out of .../usr/local/bin.
这篇关于更好的方式`chowning`未知的uid / gid的文件`rsync`(包括一个--exclude-from文件)将考虑作为源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!