You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.3 KiB
Bash

#!/bin/bash
set -e
echo "Building on: $DRONE_STAGE_MACHINE"
AUR_URL="https://aur.archlinux.org"
OUTDIR="$DRONE_WORKSPACE_BASE/out"
sudo mkdir -p "$OUTDIR"
sudo chown -R builder:builder "$OUTDIR"
export PKGDEST="$OUTDIR"
export SRCDEST="$HOME/sources"
export BUILDDIR="$HOME/builddir"
mkdir -p "$SRCDEST"
mkdir -p "$BUILDDIR"
if [ "$PLUGIN_AUTO_MAKEFLAGS" != "no" ]; then
echo "MAKEFLAGS='-j$(nproc)'" | sudo tee -a /etc/makepkg.conf
fi
echo "Upgrading image"
yay -Syu --noprogressbar --noconfirm --mflags=-A
if [ "$PLUGIN_INSTALL" != "" ]; then
echo "Installing packages before build: $PLUGIN_INSTALL"
yay -Syu --noprogressbar --noconfirm --mflags=-A $(echo "$PLUGIN_INSTALL" | tr ',' ' ')
fi
if [ "$PLUGIN_INSTALL_OUTPUTS" != "no" ] && [ -n "$(ls -A "$OUTDIR")" ]; then
echo "Installing previous build outputs"
yay -U --noprogressbar --noconfirm "$OUTDIR"/*
fi
# Clone package repo
if [ "$PLUGIN_AUR" != "" ]; then
echo "Building AUR package: $PLUGIN_AUR"
cd ~
git clone "$AUR_URL/$PLUGIN_AUR.git" package
cd package
elif [ "$PLUGIN_GIT" != "" ]; then
echo "Building package from git repository: $PLUGIN_GIT"
cd ~
git clone "$PLUGIN_GIT" package
cd package
else
echo "Building source repository"
fi
echo "Running build"
makepkg -sAc --skippgpcheck --noconfirm --noprogressbar
sudo chown -R root:root "$OUTDIR"