diff --git a/roles/fai/templates/srv/fai/config/scripts/04-snaps b/roles/fai/templates/srv/fai/config/scripts/04-snaps index 1b0ffd9..b05ccd6 100755 --- a/roles/fai/templates/srv/fai/config/scripts/04-snaps +++ b/roles/fai/templates/srv/fai/config/scripts/04-snaps @@ -1,15 +1,18 @@ #!/bin/bash +### FAILS: snapd is not running during FAI + if [ "${#SNAPS[*]}" -eq 0 ]; then SNAPS=( firefox ) fi function package_exists() { - return dpkg -l "$1" &> /dev/null + $ROOTCMD dpkg -l "$1" &> /dev/null + return $? } -for SNAP in $SNAPS; do - if ! package_exists "snapd"; then - snap install "$SNAP" +for SNAP in "${SNAPS[@]}"; do + if package_exists "snapd"; then + $ROOTCMD snap install "$SNAP" fi done