File: core-initrd.sh

package info (click to toggle)
snapd 2.72-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 80,412 kB
  • sloc: sh: 16,506; ansic: 16,211; python: 11,213; makefile: 1,919; exp: 190; awk: 58; xml: 22
file content (40 lines) | stat: -rw-r--r-- 1,323 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash -ex

# Builds the ubuntu-core-initramfs .deb for the running Ubuntu release.
# Runs in a subshell to avoid leaking directory changes.
build_initramfs_deb() (
    pushd "$PROJECT_PATH"/core-initrd

    # For dpkg-parsechangelog, dch, and ubuntu-distro-info (used by
    # mkversion.sh) and to have the tools needed to build the source package.
    quiet eatmydata apt-get install -y dpkg-dev debhelper devscripts distro-info

    codename=$(lsb_release -c -s)
    latest=$(dpkg-parsechangelog --file latest/debian/changelog --show-field Distribution)
    if [ "$codename" = "$latest" ]; then
        rel=latest
    else
        rel=$(lsb_release -r -s)
    fi

    # build source packages using local code
    TEST_BUILD=1 ./build-source-pkgs.sh "$rel"

    # build binary package
    pushd "$rel"
    quiet eatmydata apt-get build-dep -y ./
    dpkg-buildpackage -tc -us -uc
    popd

    popd
)

# Builds and installs the ubuntu-core-initramfs package for the Ubuntu
# release running in the system. Runs in subshell to prevent changes
# of working directory on failures.
build_and_install_initramfs_deb() (
    build_initramfs_deb

    # install the produced .deb (lives in core-initrd/ after dpkg-buildpackage)
    quiet eatmydata apt-get install -y "$PROJECT_PATH"/core-initrd/ubuntu-core-initramfs_*.deb
)