qvm-copy-to-vm: implement --ignore-symlinks option
Can be useful when copying to VM which doesn't support symlinks (or user doesn't have privilege to create it).
This commit is contained in:
parent
099971dcd5
commit
3cfd7f57b4
@ -18,6 +18,8 @@ enum {
|
||||
PROGRESS_FLAG_DONE
|
||||
};
|
||||
|
||||
int ignore_symlinks = 0;
|
||||
|
||||
unsigned long crc32_sum;
|
||||
int write_all_with_crc(int fd, void *buf, int size)
|
||||
{
|
||||
@ -143,7 +145,7 @@ int single_file_processor(char *filename, struct stat *st)
|
||||
hdr.filelen = 0;
|
||||
write_headers(&hdr, filename);
|
||||
}
|
||||
if (S_ISLNK(mode)) {
|
||||
if (S_ISLNK(mode) && !ignore_symlinks) {
|
||||
char name[st->st_size + 1];
|
||||
if (readlink(filename, name, sizeof(name)) != st->st_size)
|
||||
gui_fatal("readlink %s", filename);
|
||||
@ -227,6 +229,11 @@ int main(int argc, char **argv)
|
||||
crc32_sum = 0;
|
||||
cwd = getcwd(NULL, 0);
|
||||
for (i = 1; i < argc; i++) {
|
||||
if (strcmp(argv[i], "--ignore-symlinks")==0) {
|
||||
ignore_symlinks = 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
entry = get_abs_path(cwd, argv[i]);
|
||||
|
||||
do {
|
||||
|
@ -37,7 +37,7 @@ VM="$1"
|
||||
shift
|
||||
|
||||
if [ $PROGRESS_TYPE = console ] ; then
|
||||
export FILECOPY_TOTAL_SIZE=$(du --apparent-size -c "$@" | tail -1 | cut -f 1)
|
||||
export FILECOPY_TOTAL_SIZE=$(du --apparent-size -c -- "$@" 2> /dev/null | tail -1 | cut -f 1)
|
||||
fi
|
||||
|
||||
exec /usr/lib/qubes/qrexec-client-vm $VM qubes.Filecopy /usr/lib/qubes/qfile-agent "$@"
|
||||
|
@ -23,7 +23,7 @@
|
||||
VM=$(qvm-mru-entry --title="File Copy" --text="Enter the destination domain name:" --mrufile "qvm-mru-filecopy")
|
||||
if [ X$VM = X ] ; then exit 0 ; fi
|
||||
|
||||
SIZE=$(du --apparent-size -c "$@" | tail -1 | cut -f 1)
|
||||
SIZE=$(du --apparent-size -c -- "$@" 2>/dev/null | tail -1 | cut -f 1)
|
||||
|
||||
export PROGRESS_TYPE=gui
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
VM=$(kdialog -inputbox "Enter the VM name to send files to:")
|
||||
if [ X$VM = X ] ; then exit 0 ; fi
|
||||
|
||||
SIZE=$(du --apparent-size -c "$@" | tail -1 | cut -f 1)
|
||||
SIZE=$(du --apparent-size -c -- "$@" 2> /dev/null | tail -1 | cut -f 1)
|
||||
REF=$(kdialog --progressbar "Copy progress")
|
||||
qdbus $REF org.freedesktop.DBus.Properties.Set "" maximum $SIZE
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user