Außer dem fehlenden "use File::Copy;", wie bereits vom Erstposter erwähnt, ist in Zeile 57
"if($commandchain[1] eq "") { "
zu lesen, das ist natürlich krass, Da das Element $commandchain[1] nur erzeugt wird, wenn an der Stelle etwas in der Befehlszeile steht, hat es wenig Sinn das Teil auf Vorhandensein ohne Inhalt zu prüfen:
"if(!$commandchain[1]) { "
ist an diese Stelle hilfreich. Ich habe die reparierte
99_updatefhem.pm angehängt, wer sich berufen fühlt, mag sie im SVN einchecken.
An dem festeingestellten Backupverzeichnis "/tmp/FHEM_Backup" habe ich nichts verändert, empfehle aber denen, die diese Form des Backup auf der Fritz!Box nutzen wollen, in der fhem.cfg "attr global backupdir /var/InternerSpeicher/FHEM_Backup" einzutragen.
Für fhem/commandref.html#updatefhem empfehle ich:
"updatefhem
updatefhem [backup] [filename]
Update the fhem modules and documentation from a nightly SVN checkout. For
this purpose fhem contacts
http://fhem.de/fhemupdate, compares the stored
timestamps of the local files with the file list on the server, and
downloads the files changed on the server. For all downloaded modules a
reload will be scheduled if the corresponding module is loaded.
If an explicit filename is given, then only this file will be downloaded.
Note: if the main program (
fhem.pl) is changed, a manual restart of fhem
will be necessary to apply the changes.
If backup is specified, then the old files are saved before overwriting
them. They are copied to the folder given in fhem.cfg as "attr global backupdir mybackupdir" or, by
default, to /tmp/FHEM_Backup. Please check if the fhem user has the rights
to create the desired folder for backup.
Attributes
backupdir
A folder where updatefhem will store all files from modpath before executing the update. Please check if the fhem user has the rights to create this folder.
Note: this is a global attribute, set in fhem.cfg, e.g.
attr global backupdir /Volumes/BigHD"
Man beachte: Es können entweder _alle_ oder _eine_ Datei aktualisiert und gesichert werden, etwas wie "up(datefhem) backup *.pm" funktioniert, mindestens auf meiner Fritz!Box, nicht.
Zusätzlich wäre zu überlegen, anstelle der Ausgabe einer Handlungsaufforderung
"if($f eq "
fhem.pl") {
$ret .= "updated
fhem.pl, restart of fhem is required\n";"
gleich programmatisch einen Neustart mit "shutdown restart" zu veranlassen.
Ignisquivir
Fritz!Box 7390 (84.05.07-21400 ), Fhem 5.2 – 7390 SVN, 2xCUL V 1.44 CUL868, 2xHM-LC-Sw4-SM, 1xHM-LCSw1-FM, KS300, 1xEUL, 2x HOPPE Fenstergriff SecuSignal