1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-24 02:39:48 +01:00

Use stricter Bash settings in activation script

For example, with these settings Bash will complain if uninitialized
variables are used. Some code has been improved to run cleanly with
these settings.
This commit is contained in:
Robert Helgesson 2017-03-25 21:48:17 +01:00
parent 207c349825
commit fea693ba16
No known key found for this signature in database
GPG key ID: C3DB11069E65DC86
4 changed files with 8 additions and 7 deletions

View file

@ -40,7 +40,7 @@ function doBuild() {
extraArgs="$extraArgs -I $p"
done
if [[ $VERBOSE ]]; then
if [[ -v VERBOSE ]]; then
extraArgs="$extraArgs --show-trace"
fi

View file

@ -30,20 +30,20 @@ setupVars
echo "Starting home manager activation"
if [[ $VERBOSE ]]; then
if [[ -v VERBOSE ]]; then
export VERBOSE_ECHO=echo
export VERBOSE_ARG="--verbose"
else
export VERBOSE_ECHO=true
unset VERBOSE_ARG
export VERBOSE_ARG=""
fi
if [[ $DRY_RUN ]] ; then
if [[ -v DRY_RUN ]] ; then
$VERBOSE_ECHO "This is a dry run"
export DRY_RUN_CMD=echo
else
$VERBOSE_ECHO "This is a live run"
unset DRY_RUN_CMD
export DRY_RUN_CMD=""
fi
$VERBOSE_ECHO "Activation variables:"

View file

@ -328,7 +328,8 @@ in
sf = pkgs.writeText "activation-script" ''
#!${pkgs.stdenv.shell}
set -e
set -eu
set -o pipefail
${builtins.readFile ./activation-init.sh}

View file

@ -184,7 +184,7 @@ in
in
# The dconf service needs to be installed and prepared.
stringAfter [ "installPackages" ] ''
if [[ $DRY_RUN ]]; then
if [[ -v DRY_RUN ]]; then
echo ${pkgs.gnome3.dconf}/bin/dconf load ${dconfPath} "<" ${sf}
else
${pkgs.gnome3.dconf}/bin/dconf load ${dconfPath} < ${sf}