forked from Spark/builder
put the build script into the makepkg-overlay script
This commit is contained in:
parent
c2b5d134a4
commit
0e280608cc
|
@ -1,7 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
cleanup() {
|
||||
umount "$cnt_dir/rootfs"
|
||||
buildscript() {
|
||||
cat <<- EOF
|
||||
#!/usr/bin/env bash
|
||||
# The builder user is already created in the rootfs
|
||||
|
||||
export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin
|
||||
export LC_ALL=en_US.UTF-8
|
||||
|
||||
# Network
|
||||
dhcpcd eth0
|
||||
|
||||
# Upgrade
|
||||
pacman -Suy --noconfirm
|
||||
|
||||
# Build dir
|
||||
mkdir -m777 /buildroot
|
||||
|
||||
# Build the damn thing
|
||||
cd /buildroot
|
||||
sudo -u builder git clone "$pkg_url" .
|
||||
sudo -u builder makepkg -s --noconfirm -L
|
||||
EOF
|
||||
}
|
||||
|
||||
wrk_dir='/home/lxc'
|
||||
|
@ -11,12 +31,15 @@ pkg_dest=$2
|
|||
cnt="_makepkg.$$"
|
||||
cnt_dir="$wrk_dir/containers/$cnt"
|
||||
|
||||
# Unmount the thing in any case
|
||||
cleanup() { lxf umount "$cnt"; }
|
||||
trap 'cleanup' INT TERM EXIT
|
||||
|
||||
lxf -r builder -i builder new "$cnt"
|
||||
# Create new container
|
||||
lxf -r builder -i base new "$cnt"
|
||||
|
||||
# Add the build script
|
||||
cp "$wrk_dir/files/buildpackage" "$cnt_dir/rootfs/init"
|
||||
buildscript > "$cnt_dir/rootfs/init"
|
||||
chmod 755 "$cnt_dir/rootfs/init"
|
||||
|
||||
# Tell it where to fetch the package
|
||||
|
@ -25,7 +48,7 @@ echo "$pkg_url" > "$cnt_dir/rootfs/repo"
|
|||
export PKG_GIT_URL="$pkg_url"
|
||||
|
||||
# Start the container
|
||||
lxc-start -n "$cnt" -F; lxc_exit=$?
|
||||
lxc-start -n "$cnt" -F /init; lxc_exit=$?
|
||||
(( lxc_exit )) && exit "$lxc_exit"
|
||||
|
||||
# Put the artifacts where asked to
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
PATH+=":/usr/local/bin"
|
||||
PATH+=":/usr/local/bin:$HOME/.local/bin"
|
||||
|
||||
self="${PWD##*/}"; self="${self%.git}"
|
||||
self_url="https://pkg.fleshless.org/$self"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/bash
|
||||
shopt -s nullglob
|
||||
|
||||
parse_pkg_filename() {
|
||||
declare filename=$1
|
||||
|
|
Loading…
Reference in New Issue
Block a user