# HG changeset patch # User Franz Glasner # Date 1727680926 -7200 # Node ID e8fc5856a9af6619d4679b75b590436616cf8d06 # Parent fc82327ed7eaa1884d56fb4b8d833dffd1fe34b8 ftjail: call "etcupdate status" in check-freebsd-update to check for unresolved conflicts from previous updates diff -r fc82327ed7ea -r e8fc5856a9af sbin/ftjail --- a/sbin/ftjail Sun Sep 29 23:58:34 2024 +0200 +++ b/sbin/ftjail Mon Sep 30 09:22:06 2024 +0200 @@ -907,10 +907,12 @@ local _errors _warnings _rc local _directory _new_origin _etcupdate_tarball - local _dir_basename _dir_mounts _jailname _tmp _line _log_sock + local _dir_basename _dir_mounts _jailname _running_jailname + local _tmp _line _log_sock local _root_dataset _root_mountpoint _root_type _root_options local _mnt_device _mnt_mountpoint _mnt_type _mnt_options local _idx _sn_ds _sn_name _sn_ds_related + local _etcupdate_status _rc=0 @@ -989,6 +991,8 @@ _idx=$((_idx + 1)) done + _jailname='' + _running_jailname='' if [ -n "${_directory}" ]; then _dir_basename="$(basename "${_directory}")" @@ -1000,6 +1004,7 @@ case ${_tmp} in 0) farray_append _errors "Jail \`${_jailname}' is running. Please stop it." + _running_jailname="${_jailname}" ;; 1) farray_append _errors "Cannot determine jail name" @@ -1098,6 +1103,20 @@ fi fi + # + # Check whether conflicts remain from previous update, aborting. + # This would result in errors when running etcupdate. + # + if [ -n "${_directory}" ]; then + _etcupdate_status='' + if [ -n "${_running_jailname}" ]; then + _etcupdate_status="$(/usr/sbin/jexec -l -U root "${_running_jailname}" /usr/sbin/etcupdate status 2>&1 || true)" + elif [ -d "${_directory}" ]; then + _etcupdate_status="$(/usr/sbin/etcupdate status -D "${_directory}" 2>&1 || true)" + fi + [ -n "${_etcupdate_status}" ] && farray_append _errors "Unresolved conflicts from last update. Please run \"etcupdate resolve\" first." + fi + if farray_istrue _errors; then _print_check_errors _errors _rc=1