Update roles/pfsense_upgrade/tasks/upgrade.yml
This commit is contained in:
@@ -34,36 +34,29 @@
|
||||
|
||||
- name: Switch repository and force synchronization (GUI Native)
|
||||
ansible.builtin.raw: |
|
||||
php -r '
|
||||
nohup php -r '
|
||||
require_once("/etc/inc/guiconfig.inc");
|
||||
require_once("/etc/inc/pkg-utils.inc");
|
||||
global $g;
|
||||
$target_repo = "{{ upgrade_target_repo }}";
|
||||
$repos = pkg_list_repos();
|
||||
$found = false;
|
||||
foreach ($repos as $repo) {
|
||||
if ($repo["name"] == $target_repo) {
|
||||
// Update XML config
|
||||
config_set_path("system/pkg_repo_conf_path", $repo["path"]);
|
||||
|
||||
// Explicitly pull the path from the global array to ensure it is not null
|
||||
$base_path = $g["pkg_repos_path"] ?: "/usr/local/share/pfSense/pkg/repos";
|
||||
|
||||
// Force the physical symlink switch
|
||||
pkg_switch_repo($base_path, $repo["name"]);
|
||||
|
||||
write_config("Branch switched to " . $repo["name"] . " via Ansible");
|
||||
update_repos();
|
||||
echo "Successfully switched to " . $repo["name"];
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$found) { echo "ERROR: Repository not found"; exit(1); }
|
||||
'
|
||||
register: _repo_switch
|
||||
timeout: "{{ upgrade_check_timeout | default(120) }}"
|
||||
changed_when: "'Successfully switched' in _repo_switch.stdout"
|
||||
' > /dev/null 2>&1 &
|
||||
ignore_unreachable: true
|
||||
when: perform_upgrade | bool
|
||||
|
||||
- name: Wait for system to settle after repo switch
|
||||
ansible.builtin.pause:
|
||||
seconds: 10
|
||||
when: perform_upgrade | bool
|
||||
|
||||
- name: Apply repository configuration via pfSense-repo-setup
|
||||
|
||||
Reference in New Issue
Block a user