Query remote SCRIPTS_DIR before SCPing master.conf
Instead of assuming the remote uses the same appdata path as the local host, SSH-grep their varaverk.cfg first and SCP to their actual Configurations/ dir. Falls back to /mnt/user/appdata/Varaverk if the plugin isn't installed or the file can't be read.
This commit is contained in:
@@ -37,7 +37,15 @@ function vv_push_master_conf(): array {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$dest = escapeshellarg('root@' . $ip . ':' . CONF_DIR . '/master.conf');
|
// Query the remote's varaverk.cfg so we SCP to their actual SCRIPTS_DIR,
|
||||||
|
// not ours — they may use a different appdata path (e.g. /mnt/cache vs /mnt/user).
|
||||||
|
$sshBase = 'ssh -i ' . escapeshellarg($sshKey)
|
||||||
|
. ' -o ConnectTimeout=10 -o StrictHostKeyChecking=no root@' . $ip;
|
||||||
|
$remoteCfg = trim(shell_exec($sshBase . ' "grep SCRIPTS_DIR /boot/config/plugins/varaverk/varaverk.cfg 2>/dev/null"') ?: '');
|
||||||
|
preg_match('/SCRIPTS_DIR\s*=\s*["\']?([^"\']+)["\']?/', $remoteCfg, $sm);
|
||||||
|
$remoteConf = rtrim($sm[1] ?? '/mnt/user/appdata/Varaverk', '/') . '/Configurations';
|
||||||
|
|
||||||
|
$dest = escapeshellarg('root@' . $ip . ':' . $remoteConf . '/master.conf');
|
||||||
$cmd = 'scp -i ' . escapeshellarg($sshKey)
|
$cmd = 'scp -i ' . escapeshellarg($sshKey)
|
||||||
. ' -o ConnectTimeout=10 -o StrictHostKeyChecking=no'
|
. ' -o ConnectTimeout=10 -o StrictHostKeyChecking=no'
|
||||||
. ' ' . escapeshellarg($localPath) . ' ' . $dest . ' 2>&1';
|
. ' ' . escapeshellarg($localPath) . ' ' . $dest . ' 2>&1';
|
||||||
|
|||||||
Reference in New Issue
Block a user