github.com/lazyboychen7/engine@v17.12.1-ce-rc2+incompatible/contrib/builder/rpm/armhf/generate.sh (about) 1 #!/usr/bin/env bash 2 # vim: set ts=4 sw=4 noet : 3 4 set -e 5 6 # usage: ./generate.sh [versions] 7 # ie: ./generate.sh 8 # to update all Dockerfiles in this directory 9 # or: ./generate.sh centos-7 10 # to only update centos-7/Dockerfile 11 # or: ./generate.sh fedora-newversion 12 # to create a new folder and a Dockerfile within it 13 14 cd "$(dirname "$(readlink -f "$BASH_SOURCE")")" 15 16 versions=( "$@" ) 17 if [ ${#versions[@]} -eq 0 ]; then 18 versions=( */ ) 19 fi 20 versions=( "${versions[@]%/}" ) 21 22 for version in "${versions[@]}"; do 23 distro="${version%-*}" 24 suite="${version##*-}" 25 from="${distro}:${suite}" 26 installer=yum 27 28 if [[ "$distro" == "fedora" ]]; then 29 installer=dnf 30 fi 31 32 mkdir -p "$version" 33 34 case "$from" in 35 centos:*) 36 # get "Development Tools" packages dependencies 37 image="multiarch/centos:7.2.1511-armhfp-clean" 38 ;; 39 *) 40 image="${from}" 41 ;; 42 esac 43 44 echo "$version -> FROM $image" 45 cat > "$version/Dockerfile" <<-EOF 46 # 47 # THIS FILE IS AUTOGENERATED; SEE "contrib/builder/rpm/armhf/generate.sh"! 48 # 49 50 FROM $image 51 EOF 52 53 echo >> "$version/Dockerfile" 54 55 extraBuildTags= 56 runcBuildTags= 57 58 case "$from" in 59 fedora:*) 60 echo "RUN ${installer} -y upgrade" >> "$version/Dockerfile" 61 ;; 62 *) ;; 63 esac 64 65 case "$from" in 66 centos:*) 67 # get "Development Tools" packages dependencies 68 69 echo 'RUN yum install -y yum-plugin-ovl' >> "$version/Dockerfile" 70 71 echo 'RUN yum groupinstall --skip-broken -y "Development Tools"' >> "$version/Dockerfile" 72 73 if [[ "$version" == "centos-7" ]]; then 74 echo 'RUN yum -y swap -- remove systemd-container systemd-container-libs -- install systemd systemd-libs' >> "$version/Dockerfile" 75 fi 76 ;; 77 *) 78 echo "RUN ${installer} install -y @development-tools fedora-packager" >> "$version/Dockerfile" 79 ;; 80 esac 81 82 packages=( 83 btrfs-progs-devel # for "btrfs/ioctl.h" (and "version.h" if possible) 84 device-mapper-devel # for "libdevmapper.h" 85 glibc-static 86 libseccomp-devel # for "seccomp.h" & "libseccomp.so" 87 libselinux-devel # for "libselinux.so" 88 pkgconfig # for the pkg-config command 89 selinux-policy 90 selinux-policy-devel 91 sqlite-devel # for "sqlite3.h" 92 systemd-devel # for "sd-journal.h" and libraries 93 tar # older versions of dev-tools do not have tar 94 git # required for containerd and runc clone 95 cmake # tini build 96 vim-common # tini build 97 ) 98 99 extraBuildTags+=' seccomp' 100 runcBuildTags="seccomp selinux" 101 102 echo "RUN ${installer} install -y ${packages[*]}" >> "$version/Dockerfile" 103 104 echo >> "$version/Dockerfile" 105 106 awk '$1 == "ENV" && $2 == "GO_VERSION" { print; exit }' ../../../../Dockerfile.armhf >> "$version/Dockerfile" 107 echo 'RUN curl -fSL "https://golang.org/dl/go${GO_VERSION}.linux-armv6l.tar.gz" | tar xzC /usr/local' >> "$version/Dockerfile" 108 echo 'ENV PATH $PATH:/usr/local/go/bin' >> "$version/Dockerfile" 109 110 echo >> "$version/Dockerfile" 111 112 echo 'ENV AUTO_GOPATH 1' >> "$version/Dockerfile" 113 114 echo >> "$version/Dockerfile" 115 116 # print build tags in alphabetical order 117 buildTags=$( echo "selinux $extraBuildTags" | xargs -n1 | sort -n | tr '\n' ' ' | sed -e 's/[[:space:]]*$//' ) 118 119 echo "ENV DOCKER_BUILDTAGS $buildTags" >> "$version/Dockerfile" 120 echo "ENV RUNC_BUILDTAGS $runcBuildTags" >> "$version/Dockerfile" 121 echo >> "$version/Dockerfile" 122 done