Mercurial > hgrepos > FreeBSD > ports > sysutils > local-bsdtools
comparison sbin/ftjail @ 668:e8fc5856a9af
ftjail: call "etcupdate status" in check-freebsd-update to check for unresolved conflicts from previous updates
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 30 Sep 2024 09:22:06 +0200 |
| parents | 83ec66c64f47 |
| children | e4e7a33c8b75 |
comparison
equal
deleted
inserted
replaced
| 667:fc82327ed7ea | 668:e8fc5856a9af |
|---|---|
| 905 local _directory _new_origin _etcupdate_tarball | 905 local _directory _new_origin _etcupdate_tarball |
| 906 local _opt_keep _opt_old_origin _opt_snapshots | 906 local _opt_keep _opt_old_origin _opt_snapshots |
| 907 | 907 |
| 908 local _errors _warnings _rc | 908 local _errors _warnings _rc |
| 909 local _directory _new_origin _etcupdate_tarball | 909 local _directory _new_origin _etcupdate_tarball |
| 910 local _dir_basename _dir_mounts _jailname _tmp _line _log_sock | 910 local _dir_basename _dir_mounts _jailname _running_jailname |
| 911 local _tmp _line _log_sock | |
| 911 local _root_dataset _root_mountpoint _root_type _root_options | 912 local _root_dataset _root_mountpoint _root_type _root_options |
| 912 local _mnt_device _mnt_mountpoint _mnt_type _mnt_options | 913 local _mnt_device _mnt_mountpoint _mnt_type _mnt_options |
| 913 local _idx _sn_ds _sn_name _sn_ds_related | 914 local _idx _sn_ds _sn_name _sn_ds_related |
| 915 local _etcupdate_status | |
| 914 | 916 |
| 915 _rc=0 | 917 _rc=0 |
| 916 | 918 |
| 917 _warnings='' | 919 _warnings='' |
| 918 farray_create _warnings | 920 farray_create _warnings |
| 987 farray_append _errors "dataset for snapshots \`${_sn_ds}' does not exist" | 989 farray_append _errors "dataset for snapshots \`${_sn_ds}' does not exist" |
| 988 fi | 990 fi |
| 989 _idx=$((_idx + 1)) | 991 _idx=$((_idx + 1)) |
| 990 done | 992 done |
| 991 | 993 |
| 994 _jailname='' | |
| 995 _running_jailname='' | |
| 992 if [ -n "${_directory}" ]; then | 996 if [ -n "${_directory}" ]; then |
| 993 | 997 |
| 994 _dir_basename="$(basename "${_directory}")" | 998 _dir_basename="$(basename "${_directory}")" |
| 995 | 999 |
| 996 set +e | 1000 set +e |
| 998 _tmp=$? | 1002 _tmp=$? |
| 999 set -e | 1003 set -e |
| 1000 case ${_tmp} in | 1004 case ${_tmp} in |
| 1001 0) | 1005 0) |
| 1002 farray_append _errors "Jail \`${_jailname}' is running. Please stop it." | 1006 farray_append _errors "Jail \`${_jailname}' is running. Please stop it." |
| 1007 _running_jailname="${_jailname}" | |
| 1003 ;; | 1008 ;; |
| 1004 1) | 1009 1) |
| 1005 farray_append _errors "Cannot determine jail name" | 1010 farray_append _errors "Cannot determine jail name" |
| 1006 ;; | 1011 ;; |
| 1007 3) | 1012 3) |
| 1096 if ! checkyes _sn_ds_related; then | 1101 if ! checkyes _sn_ds_related; then |
| 1097 farray_append _warnings "snapshot datasets and mounted datasets are not related" | 1102 farray_append _warnings "snapshot datasets and mounted datasets are not related" |
| 1098 fi | 1103 fi |
| 1099 fi | 1104 fi |
| 1100 | 1105 |
| 1106 # | |
| 1107 # Check whether conflicts remain from previous update, aborting. | |
| 1108 # This would result in errors when running etcupdate. | |
| 1109 # | |
| 1110 if [ -n "${_directory}" ]; then | |
| 1111 _etcupdate_status='' | |
| 1112 if [ -n "${_running_jailname}" ]; then | |
| 1113 _etcupdate_status="$(/usr/sbin/jexec -l -U root "${_running_jailname}" /usr/sbin/etcupdate status 2>&1 || true)" | |
| 1114 elif [ -d "${_directory}" ]; then | |
| 1115 _etcupdate_status="$(/usr/sbin/etcupdate status -D "${_directory}" 2>&1 || true)" | |
| 1116 fi | |
| 1117 [ -n "${_etcupdate_status}" ] && farray_append _errors "Unresolved conflicts from last update. Please run \"etcupdate resolve\" first." | |
| 1118 fi | |
| 1119 | |
| 1101 if farray_istrue _errors; then | 1120 if farray_istrue _errors; then |
| 1102 _print_check_errors _errors | 1121 _print_check_errors _errors |
| 1103 _rc=1 | 1122 _rc=1 |
| 1104 fi | 1123 fi |
| 1105 # Warnings do not influence the return code | 1124 # Warnings do not influence the return code |
