0x1949 Team - FAZEMRX - MANAGER
Edit File: snapcraft.yaml
name: snapd type: snapd summary: Daemon and tooling that enable snap packages description: | Install, configure, refresh and remove snap packages. Snaps are 'universal' packages that work across many different Linux systems, enabling secure distribution of the latest apps and utilities for cloud, servers, desktops and the internet of things. Start with 'snap list' to see installed snaps. adopt-info: snapd-deb # build-base is needed here for snapcraft to build this snap as with "modern" # snapcraft build-base: core package-repositories: - type: apt ppa: snappy-dev/image grade: stable license: GPL-3.0 # Note that this snap is unusual in that it has no "apps" section. # # It is started via re-exec on classic systems and via special # handling in the core18 snap on Ubuntu Core Systems. # # Because snapd itself manages snaps it must currently run totally # unconfined (even devmode is not enough). # # See the comments from jdstrand in # https://forum.snapcraft.io/t/5547/10 parts: snapd-deb: plugin: nil source: . build-snaps: [go/1.18/stable] # these packages are needed to call mkversion.sh in override-pull, all other # dependencies are installed using apt-get build-dep build-packages: - git - dpkg-dev after: [apparmor] override-pull: | snapcraftctl pull # set version, this needs dpkg-parsechangelog (from dpkg-dev) and git snapcraftctl set-version "$(./mkversion.sh --output-only)" # Ensure that ./debian/ packaging which we are about to use # matches the current `build-base` release. I.e. ubuntu-16.04 # for build-base:core, etc. ./generate-packaging-dir # install build dependencies export DEBIAN_FRONTEND=noninteractive export DEBCONF_NONINTERACTIVE_SEEN=true sudo -E apt-get build-dep -y ./ ./get-deps.sh --skip-unused-check override-build: | # unset the LD_FLAGS and LD_LIBRARY_PATH vars that snapcraft sets for us # as those will point to the $SNAPCRAFT_STAGE which on re-builds will # contain things like libc and friends that confuse the debian package # build system # TODO: should we unset $PATH to not include $SNAPCRAFT_STAGE too? unset LD_FLAGS unset LD_LIBRARY_PATH # if we are root, disable tests because a number of them fail when run as # root if [ "$(id -u)" = "0" ]; then DEB_BUILD_OPTIONS=nocheck export DEB_BUILD_OPTIONS fi # run the real build (but just build the binary package, and don't # bother compressing it too much) dpkg-buildpackage -b -Zgzip -zfast -uc -us dpkg-deb -x $(pwd)/../snapd_*.deb $SNAPCRAFT_PART_INSTALL # not included in the deb as it's only used with UC20 preseeding. cp -a data/preseed.json $SNAPCRAFT_PART_INSTALL/usr/lib/snapd/ # Note that this check should run *after* dpkg-buildpackage was run # as this will re-run "go generate" which may cause a dirty tree # # TODO: when something like "craftctl get-version" is ready, then we can # use that, but until then, we have to re-run mkversion.sh to check if the # version number was set as "dirty" from the override-pull step or during # the build step if sh -x ./mkversion.sh --output-only | grep "dirty"; then mkdir -p $SNAPCRAFT_PART_INSTALL/usr/lib/snapd ( echo "dirty git tree during build detected:" git status git diff ) > $SNAPCRAFT_PART_INSTALL/usr/lib/snapd/dirty-git-tree-info.txt fi # copy helper for collecting debug output cp -av debug-tools/snap-debug-info.sh $SNAPCRAFT_PART_INSTALL/usr/lib/snapd/ # xdelta is used to enable delta downloads (even if the host does not have it) xdelta3: plugin: nil stage-packages: - xdelta3 stage: - usr/bin/* - usr/lib/* - lib/* # squashfs-tools are used by `snap pack` squashfs-tools: plugin: nil stage-packages: - squashfs-tools stage: - usr/bin/* - usr/lib/* - lib/* # liblzma5 is part of core but the snapd snap needs to run even without core liblzma5: plugin: nil stage-packages: - liblzma5 stage: - lib/* # Needed by squashfs-tools zlib: plugin: nil stage-packages: - zlib1g stage: - lib/* # Also needed by squashfs-tools zstd: plugin: nil stage-packages: - libzstd1 stage: - usr/lib/* - lib/* # libc6 is part of core but we need it in the snapd snap for # CommandFromSystemSnap libc6: plugin: nil stage-packages: - libc6 - libc-bin - libgcc1 stage: - lib/* - usr/lib/* - lib64/* - etc/ld.so.conf - etc/ld.so.conf.d/* override-stage: | snapcraftctl stage # fix symlinks of ld.so to be relative if [ "$(readlink -f lib64/ld-linux-x86-64.so.2)" = "/lib/x86_64-linux-gnu/ld-2.23.so" ]; then ln -f -s ../lib/x86_64-linux-gnu/ld-2.23.so lib64/ld-linux-x86-64.so.2 fi if [ "$(readlink -f lib64/ld64.so.2)" = "/lib/powerpc64le-linux-gnu/ld-2.23.so" ]; then ln -f -s ../lib/powerpc64le-linux-gnu/ld-2.23.so lib64/ld64.so.2 fi apparmor: plugin: autotools build-packages: [bison, flex, gettext, g++, pkg-config, wget] source: https://launchpad.net/apparmor/3.0/3.0.8/+download/apparmor-3.0.8.tar.gz override-pull: | snapcraftctl pull # add support for mediating posix mqueue's and userns - these come from # the ubuntu source package for lunar # https://git.launchpad.net/ubuntu/+source/apparmor/tree/debian/patches/ubuntu?h=ubuntu/lunar for feature in mqueue userns; do wget https://git.launchpad.net/ubuntu/+source/apparmor/plain/debian/patches/ubuntu/add-${feature}-support.patch?h=ubuntu/lunar -O - | patch -p1 done # apply local apparmor patches for patch in $SNAPCRAFT_PROJECT_DIR/build-aux/snap/patches/apparmor/*; do patch -p1 < $patch done override-build: | cd $SNAPCRAFT_PART_BUILD/libraries/libapparmor ./autogen.sh ./configure --prefix=/usr --disable-man-pages --disable-perl --disable-python --disable-ruby make -j$(nproc) # place libapparmor into staging area for use by snap-confine make -C src install DESTDIR=$SNAPCRAFT_STAGE cd $SNAPCRAFT_PART_BUILD/parser # copy in a pregenerated list of network address families so that the # parser gets built to support as many as possible even if glibc in # the current build environment does not support them # For some reason, some snapcraft version remove the "build-aux" folder # and move the contents up when the data is uploaded; this conditional # manages it. if [ -d "$SNAPCRAFT_PROJECT_DIR/build-aux" ]; then cp $SNAPCRAFT_PROJECT_DIR/build-aux/snap/local/apparmor/af_names.h . else cp $SNAPCRAFT_PROJECT_DIR/snap/local/apparmor/af_names.h . fi make -j$(nproc) mkdir -p $SNAPCRAFT_PART_INSTALL/usr/lib/snapd cp -a apparmor_parser $SNAPCRAFT_PART_INSTALL/usr/lib/snapd/ mkdir -p $SNAPCRAFT_PART_INSTALL/usr/lib/snapd/apparmor cp -a parser.conf $SNAPCRAFT_PART_INSTALL/usr/lib/snapd/apparmor/ cd $SNAPCRAFT_PART_BUILD/profiles make -j$(nproc) mkdir -p $SNAPCRAFT_PART_INSTALL/usr/lib/snapd/apparmor.d cp -a apparmor.d/abi $SNAPCRAFT_PART_INSTALL/usr/lib/snapd/apparmor.d/ cp -a apparmor.d/abstractions $SNAPCRAFT_PART_INSTALL/usr/lib/snapd/apparmor.d/ cp -a apparmor.d/tunables $SNAPCRAFT_PART_INSTALL/usr/lib/snapd/apparmor.d/