Local onboard: set PARTNERSHIP_ENABLED=true in master.conf + push
When HOST1 completes its local setup (--onboard --local-only), enable the partnership in master.conf so sync scripts start functioning immediately. Pushes the updated master.conf to all listed hosts via vv_push_master_conf().
This commit is contained in:
@@ -1434,6 +1434,35 @@ if [[ "$MODE" == "onboard" ]]; then
|
|||||||
log "FolderView3 not configured — skipping"
|
log "FolderView3 not configured — skipping"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Enable partnership in master.conf + push to all hosts
|
||||||
|
echo ""
|
||||||
|
echo "Enabling partnership in master.conf..."
|
||||||
|
if [[ "$DRY_RUN" == false ]]; then
|
||||||
|
if command -v php &>/dev/null; then
|
||||||
|
php -r "
|
||||||
|
require_once '/usr/local/emhttp/plugins/varaverk/include/config.php';
|
||||||
|
\$master = vv_read_conf_raw('master.conf');
|
||||||
|
\$master = preg_replace('/^\s*PARTNERSHIP_ENABLED\s*=.*/m', 'PARTNERSHIP_ENABLED=true', \$master);
|
||||||
|
if (vv_write_conf_raw('master.conf', \$master)) {
|
||||||
|
\$results = vv_push_master_conf();
|
||||||
|
foreach (\$results as \$r) {
|
||||||
|
echo \$r['host'] . ': ' . (\$r['ok'] ? 'pushed' : 'FAILED — ' . \$r['error']) . PHP_EOL;
|
||||||
|
}
|
||||||
|
echo 'PARTNERSHIP_ENABLED=true' . PHP_EOL;
|
||||||
|
} else {
|
||||||
|
echo 'write_failed' . PHP_EOL;
|
||||||
|
}
|
||||||
|
" 2>/dev/null | grep -v '^$' | while IFS= read -r line; do
|
||||||
|
[[ "$line" == "PARTNERSHIP_ENABLED=true" ]] && log "PARTNERSHIP_ENABLED=true in master.conf ✅" || log "$line"
|
||||||
|
done
|
||||||
|
else
|
||||||
|
warn "php not available — set PARTNERSHIP_ENABLED=true in master.conf manually"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
warn "DRY RUN — would set PARTNERSHIP_ENABLED=true in master.conf and push"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Write HOST1_LOCAL_DONE flag to setup.db
|
||||||
local_state_file="/boot/config/varaverk_setup.db"
|
local_state_file="/boot/config/varaverk_setup.db"
|
||||||
if [[ "$DRY_RUN" == false ]]; then
|
if [[ "$DRY_RUN" == false ]]; then
|
||||||
local flag_key="${MY_ID}_LOCAL_DONE"
|
local flag_key="${MY_ID}_LOCAL_DONE"
|
||||||
|
|||||||
Reference in New Issue
Block a user