summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Kočí <cynerd@email.cz>2018-09-01 22:12:47 +0200
committerKarel Kočí <cynerd@email.cz>2018-09-01 22:35:51 +0200
commitc64cf37fbd633a610b9be03de08593939546b01d (patch)
treee6de72b733cd23bff406a425c48ea7e867637fb5
parent68a776e88d83602c43d34636b7abde5196e50f37 (diff)
downloadlaminar-cnf-c64cf37fbd633a610b9be03de08593939546b01d.tar.gz
laminar-cnf-c64cf37fbd633a610b9be03de08593939546b01d.tar.bz2
laminar-cnf-c64cf37fbd633a610b9be03de08593939546b01d.zip
alpine-amd64: trying to build something
-rwxr-xr-xjobs/alpine-amd64.run55
-rwxr-xr-xscripts/uchroot9
2 files changed, 49 insertions, 15 deletions
diff --git a/jobs/alpine-amd64.run b/jobs/alpine-amd64.run
index 83c6717..4ae8e87 100755
--- a/jobs/alpine-amd64.run
+++ b/jobs/alpine-amd64.run
@@ -9,30 +9,63 @@ if [ -n "$CLEAN" ]; then
exit 0
fi
+cat >abuild-system.conf <<EOF
+export CFLAGS="-Os -fomit-frame-pointer"
+export CXXFLAGS="\$CFLAGS"
+export CPPFLAGS="\$CFLAGS"
+export LDFLAGS="-Wl,--as-needed"
+
+export JOBS=4
+export MAKEFLAGS=-j\$JOBS
+
+USE_COLORS=1
+
+SRCDEST=/var/cache/distfiles
+REPODEST=\$HOME/packages/
+
+CLEANUP="srcdir bldroot pkgdir deps"
+ERROR_CLEANUP="bldroot deps"
+EOF
+
+export ROOT="$WORKSPACE/root"
# TODO get latest uri from latest-releases.yml file
flock --exclusive "$WORKSPACE/root.lock" /bin/sh -se <<EOF
. utils
- if [ ! -d "$WORKSPACE/root" ]; then
+ if [ ! -d "$ROOT" ]; then
echo_stage "Setting up new root"
wget "http://dl-cdn.alpinelinux.org/alpine/edge/releases/x86_64/alpine-minirootfs-3.8.0-x86_64.tar.gz" -O alpine.tar.gz
gunzip alpine.tar.gz
tar -f alpine.tar --delete ./dev/null
- mkdir "$WORKSPACE/root"
- uroot tar -xf alpine.tar -C "$WORKSPACE/root"
- uchroot "$WORKSPACE/root" /bin/sh -sxe <<EEOF
+ mkdir "$ROOT"
+ uroot tar -xf alpine.tar -C "$ROOT"
+ chmod 755 "$ROOT" # This is intentional, tar changes access rights
+ uchroot "$ROOT" root /bin/sh -sxe <<EEOF
apk update
- apk add alpine-sdk
- adduser -D -h /build build
+ apk add alpine-sdk lua-aports
+ adduser -s /bin/sh -D build
addgroup build abuild
- # TODO more setup
+ mkdir -p /var/cache/distfiles
+ chgrp abuild /var/cache/distfiles
+ chmod g+w /var/cache/distfiles
+EEOF
+ uchroot "$ROOT" build:build /bin/sh -sxe <<EEOF
+ cd && mkdir .abuild
+ echo 'PACKAGER_PRIVKEY="/home/build/.abuild/key.rsa"' > .abuild/abuild.conf
EEOF
+ uroot cp ~/alpinelinux.rsa.key "$ROOT/home/build/.abuild/key.rsa"
+ uroot cp abuild-system.conf "$ROOT/etc/abuild.conf"
fi
echo_stage "Update system"
- uchroot "$WORKSPACE/root" /bin/sh -ce 'apk update && apk upgrade'
+ uchroot "$ROOT" root /bin/sh -ce 'apk update && apk upgrade'
echo_stage "Update package sources"
- # TODO
-EOF
+ git_clone "git@cynerd.cz:alpine-personal-pkgs" "aports"
+ uroot rm -rf "$ROOT/home/build/aports"
+ uroot mv aports "$ROOT/home/build/aports"
+ uchroot "$ROOT" root chown -R build:build /home/build/aports
-# TODO
+ echo_stage "Build packages"
+ # TODO generate list of repositories automatically
+ uchroot "$ROOT" build:build buildrepo --purge personal hacked
+EOF
diff --git a/scripts/uchroot b/scripts/uchroot
index 77f3f10..e036ce2 100755
--- a/scripts/uchroot
+++ b/scripts/uchroot
@@ -1,7 +1,7 @@
#!/bin/sh
set -e
-[ $# -ge 1 ] || {
- echo "Usage: uchroot ROOT [CMD] [ARG].." >&2
+[ $# -ge 2 ] || {
+ echo "Usage: uchroot ROOT USER[:GROUP] [CMD] [ARG].." >&2
exit 1
}
@@ -11,7 +11,8 @@ fi
###############################################################
ROOT="$1"
-shift
+USERSPEC="$2"
+shift 2
[ -d "$ROOT" ] || {
echo "There is no such directory: $ROOT" >&2
exit 1
@@ -30,4 +31,4 @@ cp -f /etc/resolv.conf "$ROOT/etc/resolv.conf"
if [ $# -lt 1 ]; then
set "/bin/sh"
fi
-exec chroot "$ROOT" "$@"
+exec chroot --userspec="$USERSPEC" "$ROOT" "$@"