Add static built aria2c when using CI

This commit is contained in:
jalr 2018-04-01 14:47:33 +02:00
parent f5d73057f4
commit cac0d83f5e
4 changed files with 70 additions and 17 deletions

View file

@ -10,17 +10,15 @@ variables:
stages:
- prepare
- build
- torrent
services:
- docker:dind
before_script:
- docker info
- apk add --no-cache make openssh-client
dockerimage:
stage: prepare
before_script:
- docker info
- apk add --no-cache make openssh-client
script:
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $CI_REGISTRY
- make dockerimg
@ -28,7 +26,57 @@ dockerimage:
tags:
- fablab
aria2c:
stage: prepare
image: debian:stretch-slim
script:
- apt-get update
- apt-get -y install clang automake autoconf git make autopoint libtool pkg-config ccache
- git clone -q -b release-1.33.1 --depth 1 https://github.com/aria2/aria2 aria2
- export CCACHE_DIR=${PWD}/ccache
- cd aria2
- mkdir -p ccache
- export CCACHE_BASEDIR=${PWD}
- autoreconf -i
- automake
- autoconf
- export CXX="clang++ -Qunused-arguments -Wl,-s" CC="clang -Qunused-arguments -Wl,-s"
- >
./configure
--disable-ssl
--disable-metalink
--disable-websocket
--disable-epoll
--disable-largefile
--disable-nls
--disable-rpath
--without-libnettle
--without-libgmp
--without-libgcrypt
--without-openssl
--without-sqlite3
--without-libxml3
--without-libexpat
--without-libcares
--without-libz
--without-libssh2
ARIA2_STATIC=yes
- make CC="ccache $CC" CXX="ccache $CXX"
- mv src/aria2c ..
cache:
paths:
- ccache
artifacts:
paths:
- aria2c
expire_in: 2 weeks
tags:
- fablab
.squashfs_template: &squashfs_template
before_script:
- docker info
- apk add --no-cache make openssh-client
stage: build
script:
- make images/debian-stretch.squashfs

View file

@ -37,6 +37,8 @@ make_torrent() {
}
run_packer() {
touch /aria2c
packer build "$NAME.json"
if [ "$user" != "" ] && [ "$group" != "" ]; then

View file

@ -34,6 +34,11 @@
}
],
"provisioners": [
{
"type": "file",
"source": "/aria2c",
"destination": "/usr/local/bin/aria2c"
},
{
"type": "shell",
"inline": [ "mkdir -p /etc/initramfs-tools/scripts/local-premount/" ]
@ -43,6 +48,11 @@
"source": "initramfs/labsync",
"destination": "/etc/initramfs-tools/scripts/"
},
{
"type": "file",
"source": "initramfs/labsync-prereqs",
"destination": "/etc/initramfs-tools/scripts/local-premount/"
},
{
"type": "shell",
"inline": [
@ -52,18 +62,10 @@
"echo \"LABSYNC_COMMIT_REF_NAME='{{user `ci_commit_ref_name`}}'\" >> /etc/environment",
"echo \"LABSYNC_COMMIT_REF_SLUG='{{user `ci_commit_ref_slug`}}'\" >> /etc/environment",
"echo \"LABSYNC_PROJECT_URL='{{user `ci_project_url`}}'\" >> /etc/environment",
"sed -i 's#@@PROJECT_URL@@#{{user `ci_project_url`}}#' /etc/initramfs-tools/scripts/labsync"
]
},
{
"type": "file",
"source": "initramfs/labsync-prereqs",
"destination": "/etc/initramfs-tools/scripts/local-premount/"
},
{
"type": "shell",
"inline": [
"set -x",
"sed -i 's#@@PROJECT_URL@@#{{user `ci_project_url`}}#' /etc/initramfs-tools/scripts/labsync",
"if [ -s /usr/local/bin/aria2c ]; then aria2c=/usr/local/bin/aria2c; else aria2c=/usr/bin/aria2c; fi",
"sed -i \"s#@@ARIA2C@@#$aria2c#\" /etc/initramfs-tools/scripts/local-premount/labsync-prereqs",
"apt-get update",
"apt-get -y dist-upgrade",
"rmdir /boot && ln -s /usr/local/boot /boot",
@ -99,6 +101,7 @@
"echo '/etc/resolv.conf' >> /tmp/ignore_files",
"echo '/etc/hostname' >> /tmp/ignore_files",
"echo '/etc/hosts' >> /tmp/ignore_files",
"echo '/usr/local/bin/aria2c' >> /tmp/ignore_files",
"mkdir -p /tmp/extra/tmp /tmp/extra/proc /tmp/extra/sys /tmp/extra/etc"
]
},

View file

@ -8,7 +8,7 @@ case $1 in
. /usr/share/initramfs-tools/hook-functions
copy_exec /sbin/mke2fs
copy_exec /sbin/e2fsck
copy_exec /usr/bin/aria2c
copy_exec @@ARIA2C@@
copy_exec /sbin/sfdisk
copy_file cert /etc/ssl/certs/ca-certificates.crt
exit 0