Skip to content

Commit

Permalink
daemon.start: group first run detection
Browse files Browse the repository at this point in the history
Signed-off-by: Simon Deziel <[email protected]>
  • Loading branch information
simondeziel committed May 19, 2024
1 parent 208bbd4 commit 14cf45b
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions snapcraft/commands/daemon.start
Original file line number Diff line number Diff line change
Expand Up @@ -690,12 +690,6 @@ if [ "${daemon_verbose:-"false"}" = "true" ]; then
CMD="${CMD} --verbose"
fi

# Check if this is the first time LXD is started.
FIRSTRUN="false"
if [ ! -d "${SNAP_COMMON}/lxd/database" ]; then
FIRSTRUN="true"
fi

# We deal with errors ourselves from this point on
set +e

Expand Down Expand Up @@ -741,11 +735,12 @@ if [ "${RET}" -gt "0" ]; then
exit 1
fi

## Process preseed if present
if [ "${FIRSTRUN}" = "true" ]; then
## Check if this is the first time LXD is started
if [ ! -d "${SNAP_COMMON}/lxd/database" ]; then
set -e
echo "=> First LXD execution on this system"

## Process preseed if present
if [ -e "${SNAP_COMMON}/init.yaml" ]; then
echo "==> Running LXD preseed file"
${LXD} init --preseed < "${SNAP_COMMON}/init.yaml"
Expand Down

0 comments on commit 14cf45b

Please sign in to comment.