Compare commits
No commits in common. "c14bc08deb8ab9dbc65e076a6e46e7f781992413" and "7752aab7136efb640a35e59ad664fb94ea54a963" have entirely different histories.
c14bc08deb
...
7752aab713
|
@ -9,6 +9,7 @@
|
||||||
<h1 class="ui icon header title">
|
<h1 class="ui icon header title">
|
||||||
{{AppName}}
|
{{AppName}}
|
||||||
</h1>
|
</h1>
|
||||||
|
<h2>{{.locale.Tr "startpage.app_desc"}}</h2>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -118,35 +118,36 @@ in
|
||||||
send_email=yes
|
send_email=yes
|
||||||
email_subject="Upgrade failed (exit code $exit_code)"
|
email_subject="Upgrade failed (exit code $exit_code)"
|
||||||
email_body="The system upgrade started at $start_time has failed with exit code $exit_code."
|
email_body="The system upgrade started at $start_time has failed with exit code $exit_code."
|
||||||
else
|
fi
|
||||||
echo "→ Determining package differences." | tee -a "$output_file"
|
|
||||||
installed_packages()
|
|
||||||
{
|
|
||||||
${nix-store} --query --requisites "$1" | cut -d- -f2- | sort | uniq
|
|
||||||
}
|
|
||||||
current_packages="$(installed_packages /run/current-system)"
|
|
||||||
built_packages="$(installed_packages /nix/var/nix/profiles/system)"
|
|
||||||
${diff} -y --suppress-common-lines --width=71 \
|
|
||||||
<(printf "Current generation\n------------------\n%s" "$current_packages") \
|
|
||||||
<(printf "New generation\n--------------\n%s" "$built_packages") \
|
|
||||||
| tee -a "$output_file" || true
|
|
||||||
|
|
||||||
booted_version="$(readlink /run/booted-system/{initrd,kernel,kernel-modules})"
|
echo "→ Determining package differences." | tee -a "$output_file"
|
||||||
built_version="$(readlink /nix/var/nix/profiles/system/{initrd,kernel,kernel-modules})"
|
installed_packages()
|
||||||
|
{
|
||||||
|
${nix-store} --query --requisites "$1" | cut -d- -f2- | sort | uniq
|
||||||
|
}
|
||||||
|
current_packages="$(installed_packages /run/current-system)"
|
||||||
|
built_packages="$(installed_packages /nix/var/nix/profiles/system)"
|
||||||
|
${diff} -y --suppress-common-lines --width=71 \
|
||||||
|
<(printf "Current generation\n------------------\n%s" "$current_packages") \
|
||||||
|
<(printf "New generation\n--------------\n%s" "$built_packages") \
|
||||||
|
| tee -a "$output_file" || true
|
||||||
|
|
||||||
echo "→ Checking if a reboot is needed." | tee -a "$output_file"
|
booted_version="$(readlink /run/booted-system/{initrd,kernel,kernel-modules})"
|
||||||
if [ "$booted_version" != "$built_version" ] ; then
|
built_version="$(readlink /nix/var/nix/profiles/system/{initrd,kernel,kernel-modules})"
|
||||||
version_comparison="$(cat <<-EOF
|
|
||||||
|
echo "→ Checking if a reboot is needed." | tee -a "$output_file"
|
||||||
|
if [ "$booted_version" != "$built_version" ] ; then
|
||||||
|
version_comparison="$(cat <<-EOF
|
||||||
The booted kernel version
|
The booted kernel version
|
||||||
$(indent "$booted_version")
|
$(indent "$booted_version")
|
||||||
does not match the newly built
|
does not match the newly built
|
||||||
$(indent "$built_version")
|
$(indent "$built_version")
|
||||||
.
|
.
|
||||||
EOF
|
EOF
|
||||||
)"
|
)"
|
||||||
echo "$version_comparison"
|
echo "$version_comparison"
|
||||||
send_email=yes
|
send_email=yes
|
||||||
email_body="$(cat <<-EOF
|
email_body="$(cat <<-EOF
|
||||||
$email_body
|
$email_body
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,27 +155,26 @@ in
|
||||||
------------------------------
|
------------------------------
|
||||||
$version_comparison
|
$version_comparison
|
||||||
EOF
|
EOF
|
||||||
)"
|
)"
|
||||||
activate_configuration="no"
|
activate_configuration="no"
|
||||||
if [ "$reboot_allowed" = "yes" ] && [ $exit_code -eq 0 ] ; then
|
if [ "$reboot_allowed" = "yes" ] && [ $exit_code -eq 0 ] ; then
|
||||||
email_body="$(printf "%s\n%s" "$email_body" "The system will reboot now.")"
|
email_body="$(printf "%s\n%s" "$email_body" "The system will reboot now.")"
|
||||||
do_reboot="yes"
|
do_reboot="yes"
|
||||||
activate_configuration="yes"
|
activate_configuration="yes"
|
||||||
email_subject_additions="$email_subject_additions, system will reboot"
|
email_subject_additions="$email_subject_additions, system will reboot"
|
||||||
else
|
else
|
||||||
email_body="$(printf "%s\n%s" "$email_body" "The upgraded configuration will be activated on the next reboot.")"
|
email_body="$(printf "%s\n%s" "$email_body" "The upgraded configuration will be activated on the next reboot.")"
|
||||||
email_subject_additions="$email_subject_additions, reboot required"
|
email_subject_additions="$email_subject_additions, reboot required"
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${optionalString (cfg.operation == "switch") ''
|
|
||||||
if [ "$activate_configuration" = "yes" ] ; then
|
|
||||||
echo "→ Activating new configuration." | tee -a "$output_file"
|
|
||||||
${nixos-rebuild} switch ${toString cfg.flags} 2>&1 | tee -a "$output_file" || exit_code=$?
|
|
||||||
fi
|
|
||||||
''}
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
${optionalString (cfg.operation == "switch") ''
|
||||||
|
if [ "$activate_configuration" = "yes" ] ; then
|
||||||
|
echo "→ Activating new configuration." | tee -a "$output_file"
|
||||||
|
${nixos-rebuild} switch ${toString cfg.flags} 2>&1 | tee -a "$output_file" || exit_code=$?
|
||||||
|
fi
|
||||||
|
''}
|
||||||
|
|
||||||
upgrade_output="$(cat "$output_file")"
|
upgrade_output="$(cat "$output_file")"
|
||||||
rm -f "$output_file"
|
rm -f "$output_file"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue