Skip to content

Commit

Permalink
Fix preseed support and vendor apparmor (5.21-edge) (#535)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomponline authored Aug 9, 2024
2 parents cc7edd5 + 363908d commit 9075cd1
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 4 deletions.
39 changes: 38 additions & 1 deletion snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1228,15 +1228,52 @@ parts:
- bin/pzstd
- bin/zstd

apparmor:
source: https://gitlab.com/apparmor/apparmor.git
source-commit: 84a6bc1b6dcdfeabb1ed3597f01e314f3bcee5c1 # v4.0.2
source-depth: 1
source-type: git
plugin: autotools
build-packages:
- g++
- bison
- flex
- autoconf-archive
- gettext
override-build: |-
set -ex
cd ./libraries/libapparmor
sh ./autogen.sh
sh ./configure --prefix=/
make
make install
cd ../../parser
make
make install
mkdir "${CRAFT_PART_INSTALL}/bin"
cp /sbin/apparmor_parser "${CRAFT_PART_INSTALL}/bin/"
mkdir "${CRAFT_PART_INSTALL}/lib"
cp /lib/libapparmor.so* "${CRAFT_PART_INSTALL}/lib/"
set +ex
prime:
- bin/apparmor_parser
- lib/libapparmor.so.1
- lib/libapparmor.so.1.*

# Core components
lxc:
after:
- apparmor
source: https://github.com/lxc/lxc
source-branch: stable-6.0
source-depth: 1
source-type: git
build-packages:
- dpkg-dev
- libapparmor-dev
- libcap-dev
- libdbus-1-dev
- libgnutls28-dev
Expand Down
11 changes: 8 additions & 3 deletions snapcraft/commands/daemon.start
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,12 @@ 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 @@ -740,12 +746,11 @@ if [ "${RET}" -gt "0" ]; then
exit 1
fi

## Check if this is the first time LXD is started
if [ ! -d "${SNAP_COMMON}/lxd/database" ]; then
## Process preseed if present
if [ "${FIRSTRUN}" = "true" ]; 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 9075cd1

Please sign in to comment.