[Eisfair] Backup-Zip Argument --rsync-path funktioniert nicht

Marcus Röckrath marcus.roeckrath at gmx.de
So Jan 16 15:20:12 CET 2022


Hallo Matthias,

Matthias Prill wrote:

>> Zeile 470: "$tecopt2"
>> Zeile 476: "$tecopt"
>> 
>>> Nun kommt es wohl auf die Schreibweise bzw. Übergabe von der Konfig in
>>> die tecopt Variable an...
>> 
>> In der Konfiguration musst du IMHO die Variante
>> 
>> -a --delete --rsync="sudo rsync"
>> 
>> nutzen.
>> 
> Das hat alles nicht so geklappt wie es sollte. Das beste was ich
> herausbekommen konnte war:
> 
> - der Aufruf muß mit "tecopt" passieren
> - der Parameter muß in der Konfig ohne ' stehen ->
> BACKUP_3_TEC_RSYN=--rsync-path="sudo rsync"
> 
> - es darf nur der --rsync-path Teil drin sein. Andere Parameter wie -a
> und --delete dürfen nicht drin sein, sonst klappt es nicht
> 
> ...ich denke das ist eine Baustelle, die sehr tief verankert ist...

Diese "-Behandlung ist ein Geheimnis für sich. Wen es interessiert kann ja
mal folgendes Skript laufen lassen:

#!/bin/sh

BACKUP_1_TEC_RSYN='-a --delete --rsync-path=sudo rsync'
BACKUP_2_TEC_RSYN='-a --delete --rsync-path="sudo rsync"'
BACKUP_3_TEC_RSYN='-a --delete --rsync-path=\"sudo rsync\"'


backup ()
{
    tecopt="$1"
    echo Anzahl Parameter: $#      1. Parameter: "$tecopt"
}

echo ohne Anfuehrungsstriche
for z in 1 2 3
do
    eval current_opt='$BACKUP_'$z'_TEC_RSYN'
    backup $current_opt
done
echo
echo
echo mit Anfuehrungsstriche
for z in 1 2 3
do
    eval current_opt='$BACKUP_'$z'_TEC_RSYN'
    backup "$current_opt"
done

Ausgabe:

ohne Anfuehrungsstriche
Anzahl Parameter: 4 1. Parameter: -a
Anzahl Parameter: 4 1. Parameter: -a
Anzahl Parameter: 4 1. Parameter: -a

Hier wird die eigentlich aus 3 Optionen bestenhende Zeile in 4 Optionen
zerlegt, womit eben --rsync-path="sudo rsync" z. B. in

--rsync-pacht="sudo
rsync"

zerissen wird, was es dann auch für rsync tut.

mit Anfuehrungsstriche
Anzahl Parameter: 1 1. Parameter: -a --delete --rsync-path=sudo rsync
Anzahl Parameter: 1 1. Parameter: -a --delete --rsync-path="sudo rsync"
Anzahl Parameter: 1 1. Parameter: -a --delete --rsync-path=\"sudo rsync\"

-- 
Gruß Marcus
[eisfair-Team]


Mehr Informationen über die Mailingliste Eisfair