-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core-initrd: build snap-bootstrap and include in deb package
Include snap-bootstrap sources and other needed snapd bits into the ubuntu-core-initramfs source package, and build it when building the deb file. Therefore, do not pull anymore snapd bits in the system from ubuntu-core-initramfs script. Add also a README.md to the folder and a script to automate building the source packages, avoiding duplicated sources where possible.
- Loading branch information
1 parent
4b26d65
commit baae9ff
Showing
9 changed files
with
205 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Initramfs for Ubuntu Core and hybrid systems | ||
|
||
This folder contains files that are used to build the initramfs for | ||
Ubuntu Core 24 / hybrid 24.04 and later versions, and that were | ||
originally in https://github.com/canonical/core-initrd. This contains | ||
subfolders, each of them for a currently supported Ubuntu release. | ||
|
||
Each subfolder contains the sources for a debian package. The `latest` | ||
subdir contains the sources for the most recent Ubuntu release. To | ||
build source packages that can later be built by Launchpad, checkout | ||
the matching snapd release and run from this folder: | ||
|
||
``` | ||
./build-source-pkgs.sh | ||
``` | ||
|
||
This will pull the sources to build `snap-bootstrap` from the snapd | ||
tree and copy duplicated files from the `latest` folder to older | ||
releases. At this point `dch -i` should be run for each release to | ||
update version and changelog, and this should be commited to the snapd | ||
release and master branches. To build the source packages, run | ||
|
||
``` | ||
gbp buildpackage -S -sa -d --git-ignore-branch | ||
``` | ||
|
||
in each release subfolder. Then it is recommended to compare the | ||
sources with the previous versions in the snappy-de PPA: | ||
|
||
``` | ||
dget https://launchpad.net/~snappy-dev/+archive/ubuntu/image/+sourcefiles/ubuntu-core-initramfs/<old_version>/ubuntu-core-initramfs_<old_version>.dsc | ||
debdiff ubuntu-core-initramfs_<old_version>.dsc ubuntu-core-initramfs_<new_version>.dsc > diff.txt | ||
``` | ||
|
||
And to finally upload with: | ||
|
||
``` | ||
dput ppa:snappy-dev/image ubuntu-core-initramfs_<new_version>_source.changes | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,72 @@ | ||
#!/bin/bash -exu | ||
|
||
# This scripts cleans-up the core-initrd subfolder and pulls all necessary bits | ||
# from snapd to create the ubuntu-core-initramfs source package for each | ||
# supported Ubuntu release. It is meant to be called inside the core-initrd | ||
# folder. | ||
|
||
git clean -ffdx | ||
|
||
# The current commit must be in the repo to be able to get the dependencies | ||
# of snap-bootstrap. | ||
commit=$(git rev-parse HEAD) | ||
|
||
# build info file | ||
pushd .. | ||
./mkversion.sh | ||
popd | ||
|
||
contains_element() { | ||
local e match="$1" | ||
shift | ||
for e; do [[ "$e" == "$match" ]] && return 0; done | ||
return 1 | ||
} | ||
|
||
# Folder for snapd bits, that will be copied to all releases | ||
mkdir snapd-initramfs | ||
pushd snapd-initramfs | ||
## snap-bootstrap | ||
mkdir cmd | ||
# go commands do not follow symlinks, copy instead | ||
cp -a ../../cmd/snap-bootstrap/ cmd/ | ||
cat << EOF > go.mod | ||
module github.com/snapcore/snap-bootstrap | ||
go 1.18 | ||
require github.com/snapcore/snapd $commit | ||
EOF | ||
# solve dependencies | ||
go mod tidy | ||
# build vendor folder | ||
go mod vendor | ||
|
||
## info and recovery trigger service | ||
mkdir snapd | ||
cp ../../data/info snapd/ | ||
sed 's#@libexecdir@#/usr/lib#' ../../data/systemd/snapd.recovery-chooser-trigger.service.in > \ | ||
snapd/snapd.recovery-chooser-trigger.service | ||
popd | ||
|
||
# Go through the different supported Ubuntu releases, creating source | ||
# packages for them. | ||
no_link=(debian go.mod go.sum cmd snapd vendor) | ||
for dir in */debian; do | ||
rel=${dir%/debian} | ||
|
||
if [ "$rel" != latest ]; then | ||
for f in latest/*; do | ||
ln -s "$f" "$rel"/"${f#latest/}" | ||
for p in latest/*; do | ||
file=${p#latest/} | ||
if contains_element "$file" "${no_link[@]}"; then | ||
continue | ||
fi | ||
cp -a "$p" "$rel/" | ||
done | ||
fi | ||
|
||
pushd "$rel" | ||
cp -a ../snapd-initramfs/* . | ||
dpkg-buildpackage -S -sa -d | ||
popd | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters