diff --git a/doc/install.md b/doc/install.md index e27f50a4..dad2c72d 100644 --- a/doc/install.md +++ b/doc/install.md @@ -2,11 +2,11 @@ ### Go Dependency -Stacker requires at least go 1.11. +Stacker requires at least go 1.20. -#### Ubuntu 20.04 +#### Ubuntu 22.04 -On Ubuntu 20.04 you can install Go using the instructions at: +On Ubuntu 22.04 you can install Go using the instructions at: https://github.com/golang/go/wiki/Ubuntu #### Fedora 31 @@ -26,24 +26,20 @@ https://golang.org/doc/install#install ### Other Dependencies -#### **Ubuntu 20.04** +The other build dependencies can be satisfied by running: -The other build dependencies can be satisfied with the following command and -packages: +#### **Ubuntu 22.04** - sudo apt install lxc-dev libacl1-dev libgpgme-dev libcap-dev libseccomp-dev - sudo apt install libpam0g-dev libselinux-dev libssl-dev libzstd-dev libcryptsetup-dev libdevmapper-dev -#### **Ubuntu 22.04** + This script will install the current library and build-time depedencies. + Once installed it will prepare the system for build by fetching golang + tools, downloading go modules and preparing a mirror of remote OCI images. - sudo apt install lxc-dev libacl1-dev libgpgme-dev libcap-dev libseccomp-dev - sudo apt install libpam0g-dev libselinux-dev libssl-dev libzstd-dev libcryptsetup-dev libdevmapper-dev cryptsetup-bin pkg-config + sudo ./install-build-deps.sh **To run `make check` you will also need:** - sudo apt install bats jq tree - **umoci** - https://github.com/opencontainers/umoci Since the path **/usr/local** is owned by root, when you reach the step to run **make install**, you need to run it as **sudo**. @@ -67,4 +63,4 @@ packages: ### Building the Stacker Binary Finally, once you have the build dependencies, stacker can be built with a -simple `make`. The stacker binary will be output as `./stacker`. +simple `make stacker`. The stacker binary will be output as `./stacker`. diff --git a/install-build-deps.sh b/install-build-deps.sh new file mode 100755 index 00000000..2fe30028 --- /dev/null +++ b/install-build-deps.sh @@ -0,0 +1,68 @@ +#!/bin/bash +set -o pipefail +set -o errexit + +installdeps_fedora() { + sudo dnf install \ + bats \ + jq \ + lxc-devel \ + libcap-devel \ + libacl-devel + if ! command -v go 2>/dev/null; then + sudo dnf install golang + go version + fi +} + +installdeps_ubuntu() { + sudo add-apt-repository -y ppa:project-machine/squashfuse + sudo apt -yy install \ + bats \ + build-essential \ + cryptsetup-bin \ + jq \ + libacl1-dev \ + libcap-dev \ + libcryptsetup-dev \ + libdevmapper-dev \ + libpam0g-dev \ + libseccomp-dev \ + libselinux1-dev \ + libssl-dev \ + libzstd-dev \ + lxc-dev \ + lxc-utils \ + parallel \ + pkg-config \ + skopeo \ + squashfs-tools \ + squashfuse + if ! command -v go 2>/dev/null; then + sudo apt -yy install golang-go + go version + fi +} + +installdeps_golang() { + go version + GO111MODULE=off go get github.com/opencontainers/umoci/cmd/umoci + make download-tools + make docker-clone + make go-download +} + +. /etc/os-release + +# install platform deps +case $ID_LIKE in + debian|ubuntu) installdeps_ubuntu;; + redhat|fedora) installdeps_fedora;; + *) + echo "Unknown os ID_LIKE value $ID_LIKE" + exit 1 + ;; +esac + +# install golang deps +installdeps_golang || exit 1