home-manager: present news even if assertion failed

This commit is contained in:
Robert Helgesson 2017-09-09 17:14:07 +02:00
parent 07b4228988
commit cda222d2ec
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86
2 changed files with 25 additions and 16 deletions

View file

@ -73,9 +73,10 @@ function doBuildAttr() {
--argstr confAttr "$HOME_MANAGER_CONFIG_ATTRIBUTE"
}
# Presents news to the user. Takes as argument the path to a "news
# info" file as generated by `buildNews`.
function presentNews() {
local infoFile
infoFile=$(buildNews) || return 1
local infoFile="$1"
# shellcheck source=/dev/null
. "$infoFile"
@ -111,11 +112,22 @@ function presentNews() {
}
function doBuild() {
doBuildAttr -A activationPackage
presentNews
local newsInfo
newsInfo=$(buildNews)
local exitCode
doBuildAttr -A activationPackage \
&& exitCode=0 || exitCode=1
presentNews "$newsInfo"
return $exitCode
}
function doSwitch() {
local newsInfo
newsInfo=$(buildNews)
local generation
local exitCode=0
local wrkdir
@ -132,9 +144,7 @@ function doSwitch() {
# running and $wrkdir is always removed.
rm -r "$wrkdir"
if [[ $exitCode -eq 0 ]]; then
presentNews
fi
presentNews "$newsInfo"
return $exitCode
}