]> rtime.felk.cvut.cz Git - novaboot.git/commitdiff
Copy files to TFTP server with default permissions
authorMichal Sojka <michal.sojka@cvut.cz>
Mon, 12 Apr 2021 06:26:00 +0000 (08:26 +0200)
committerMichal Sojka <michal.sojka@cvut.cz>
Mon, 12 Apr 2021 06:26:00 +0000 (08:26 +0200)
Previously, we used rsync's --perm option to mirror source permissions
at target. This could have caused the files to be inaccessible by the
TFTP server, because source permissions were to tight. To overcome
this problem, we now always set the target permissions to the default
value by using --chmod. From rsync manual:

    To give new files the destination-default permissions (while
    leaving existing files unchanged), make sure that the --perms
    option is off and use --chmod=ugo=rwX.

Note that this change does not require changes on the server
side (novaboot-shell).

novaboot

index 15eddaa67ec7b72c4bc1017cebfc9bb595ce0525..c17b5c1075c4720c89b338f504812982cb192eeb 100755 (executable)
--- a/novaboot
+++ b/novaboot
@@ -1002,7 +1002,7 @@ foreach my $script (@scripts) {
        my $istty = -t STDOUT && ($ENV{'TERM'} || 'dumb') ne 'dumb';
        my $progress = $istty ? "--progress" : "";
        if ($files) {
-           system_verbose("rsync $progress -RLp $rsync_flags $files $real_server");
+           system_verbose("rsync $progress -RL --chmod=ugo=rwX $rsync_flags $files $real_server");
            if ($server =~ m|/\$NAME$| && $concat) {
                my $cmd = join("; ", map { "( cd $path/.. && cat */$_ > $_ )" } @bootloader_configs);
                system_verbose($hostname ? "ssh $hostname '$cmd'" : $cmd);