Browse Source

put the build script into the makepkg-overlay script

master
Fleshless Builder 5 years ago
parent
commit
0e280608cc
  1. 33
      makepkg-overlay
  2. 2
      post-receive
  3. 1
      repo-clean
  4. 1
      repo-sign

33
makepkg-overlay

@ -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

2
post-receive

@ -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
repo-clean

@ -1,4 +1,5 @@
#!/usr/bin/bash
shopt -s nullglob
parse_pkg_filename() {
declare filename=$1

1
repo-sign

@ -1,4 +1,5 @@
#!/usr/bin/bash
shopt -s nullglob
for i in *.pkg.*; do
if ! [[ "$i" == "${i%.*}.sig" ]]; then

Loading…
Cancel
Save