Syncing Maat with current state; adding MaatIcon for favicon; updating install with maat user; moved maat-builder name to just maat
This commit is contained in:
parent
57eabd90a4
commit
5ef9cf1471
11
.gitignore
vendored
11
.gitignore
vendored
@ -1,5 +1,10 @@
|
|||||||
src/
|
# Testing outputs
|
||||||
web/
|
src/HelloWorld
|
||||||
|
src/HelloWorld/**
|
||||||
|
src/ascii-invaders
|
||||||
|
src/ascii-invaders/**
|
||||||
pkg/
|
pkg/
|
||||||
testing.log
|
testing.log
|
||||||
*.pkg.tar.xz
|
|
||||||
|
# Packaging outputs
|
||||||
|
*.pkg.tar.zst
|
||||||
|
BIN
MaatIcon.png
Normal file
BIN
MaatIcon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 41 KiB |
28
Makefile
28
Makefile
@ -1,24 +1,27 @@
|
|||||||
installDir = ${pkgdir}/usr/local/bin
|
installDir = ${pkgdir}/usr/local/bin
|
||||||
list = ./maat-builder
|
list = ./maat
|
||||||
systemdList = ./maat-builder.timer ./maat-builder.service
|
systemdList = ./maat.timer ./maat.service
|
||||||
serverRoot = /srv/maat/
|
serverRoot = /srv/maat/
|
||||||
owner=root
|
owner=maat
|
||||||
perms=0755
|
perms=0755
|
||||||
fileperms=0644
|
fileperms=0644
|
||||||
|
|
||||||
compile: /bin/bash
|
compile: /bin/bash
|
||||||
@echo Nothing to compile.
|
@echo Nothing to compile.
|
||||||
|
|
||||||
install: ${list}
|
install: ${list} MaatIcon.png
|
||||||
mkdir -p ${installDir}
|
mkdir -p ${installDir}
|
||||||
mkdir -p ${pkgdir}${serverRoot}/src
|
mkdir -p ${pkgdir}${serverRoot}/src
|
||||||
mkdir -p ${pkgdir}${serverRoot}/pkg
|
mkdir -p ${pkgdir}${serverRoot}/pkg
|
||||||
|
install -m ${fileperms} -o ${owner} ./MaatIcon.png ${pkgdir}${serverRoot}/pkg
|
||||||
mkdir -p ${pkgdir}/usr/lib/systemd/system
|
mkdir -p ${pkgdir}/usr/lib/systemd/system
|
||||||
for i in ${list}; do install -m ${perms} -o ${owner} $$i ${installDir}; done
|
for i in ${list}; do install -m ${perms} -o root $$i ${installDir}; done
|
||||||
|
install -m ${perms} -o ${owner} -d ${pkgdir}/usr/local/etc/Maat/
|
||||||
|
touch ${pkgdir}/usr/local/etc/Maat/aur.list; chown ${owner} ${pkgdir}/usr/local/etc/Maat/aur.list; chmod ${fileperms} ${pkgdir}/usr/local/etc/Maat/aur.list
|
||||||
for i in ${systemdList}; do install -m 0644 -o root $$i ${pkgdir}/usr/lib/systemd/system; done
|
for i in ${systemdList}; do install -m 0644 -o root $$i ${pkgdir}/usr/lib/systemd/system; done
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
cat .gitignore | xargs rm -Rf
|
cat .gitignore | sudo xargs rm -Rf
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
for i in ${list}; do rm -Rf ${installDir}/$$i; done
|
for i in ${list}; do rm -Rf ${installDir}/$$i; done
|
||||||
@ -27,21 +30,22 @@ uninstall:
|
|||||||
rmdir -p ${pkgdir}${serverRoot}/pkg
|
rmdir -p ${pkgdir}${serverRoot}/pkg
|
||||||
|
|
||||||
test: clean
|
test: clean
|
||||||
./maat-builder -T
|
sudo ./maat -u $$USER -T
|
||||||
test -d src
|
test -d src
|
||||||
test -d src/cower
|
test -d src/ascii-invaders
|
||||||
test -d src/cower/.git
|
test -d src/ascii-invaders/.git
|
||||||
test -d src/HelloWorld
|
test -d src/HelloWorld
|
||||||
test -d src/HelloWorld/.git
|
test -d src/HelloWorld/.git
|
||||||
test -d pkg
|
test -d pkg
|
||||||
test -d pkg/aur
|
test -d pkg/aur
|
||||||
test -f pkg/AniNIX.db
|
test -f pkg/AniNIX.db
|
||||||
test -f pkg/AniNIX.db.sig
|
test -f pkg/AniNIX.db.sig
|
||||||
test -f pkg/helloworld*.tar.xz
|
test -f pkg/HelloWorld*.tar.zst
|
||||||
test -f pkg/aur/aur.db
|
test -f pkg/aur/aur.db
|
||||||
test -f pkg/aur/aur.db.sig
|
test -f pkg/aur/aur.db.sig
|
||||||
test -f pkg/aur/cower*.tar.xz
|
test -f pkg/aur/ascii-invaders*.tar.zst
|
||||||
[ `wc -l pkg/index.html | cut -f 1 -d ' '` -eq 24 ]
|
[ `wc -l pkg/index.html | cut -f 1 -d ' '` -eq 24 ]
|
||||||
|
make clean
|
||||||
@echo
|
@echo
|
||||||
@echo Tests passed successfully.
|
@echo Tests passed successfully.
|
||||||
|
|
||||||
@ -54,4 +58,4 @@ reverse:
|
|||||||
checkperm:
|
checkperm:
|
||||||
chown -R ${owner}: ${pkgdir}${serverRoot}/src
|
chown -R ${owner}: ${pkgdir}${serverRoot}/src
|
||||||
chown -R ${owner}: ${pkgdir}${serverRoot}/pkg
|
chown -R ${owner}: ${pkgdir}${serverRoot}/pkg
|
||||||
for i in ${list}; do chown -R ${owner}: "${installDir}/$$i"; chmod ${perms} "${installDir}/$$i"; done
|
for i in ${list}; do chown -R ${owner}: "${installDir}/$$i"; sudo chmod ${perms} "${installDir}/$$i"; done
|
||||||
|
4
PKGBUILD
4
PKGBUILD
@ -19,7 +19,7 @@ conflicts=()
|
|||||||
replaces=("${pkgname,,}", "aninix-${pkgname,,}")
|
replaces=("${pkgname,,}", "aninix-${pkgname,,}")
|
||||||
backup=()
|
backup=()
|
||||||
options=()
|
options=()
|
||||||
install=
|
install=install
|
||||||
changelog=
|
changelog=
|
||||||
source=()
|
source=()
|
||||||
noextract=()
|
noextract=()
|
||||||
@ -28,7 +28,7 @@ validpgpkeys=()
|
|||||||
|
|
||||||
prepare() {
|
prepare() {
|
||||||
git pull
|
git pull
|
||||||
make -C .. test
|
make -C .. test && make -C .. clean
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
|
9
install
Normal file
9
install
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
pre_install() {
|
||||||
|
groupadd maat &>/dev/null
|
||||||
|
useradd -g maat -d /srv/maat -s /bin/false maat &> /dev/null
|
||||||
|
chown -R maat:maat /srv/maat &> /dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
pre_remove() {
|
||||||
|
getent passwd maat &>/dev/null && userdel maat &> /dev/null
|
||||||
|
}
|
@ -11,6 +11,10 @@
|
|||||||
# Author: DarkFeather
|
# Author: DarkFeather
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Arch keys to look for
|
||||||
|
pkgExt=".pkg.tar.zst"
|
||||||
|
deprivuser="maat"
|
||||||
|
|
||||||
### Printing defaults
|
### Printing defaults
|
||||||
passCell="<td style='color:green;'>PASS</td>";
|
passCell="<td style='color:green;'>PASS</td>";
|
||||||
failCell="<td style='color:red;'>FAIL</td>";
|
failCell="<td style='color:red;'>FAIL</td>";
|
||||||
@ -30,7 +34,7 @@ function Usage() {
|
|||||||
|
|
||||||
### Put the initial content in the webfile
|
### Put the initial content in the webfile
|
||||||
function SeedWebFile() {
|
function SeedWebFile() {
|
||||||
printf '<html>\n<head>\n<title>AniNIX/Maat -- Build Results</title>\n<link rel="icon" type="image/png" href="https://foundation.aninix.net/img/icons/MaatIcon.png" />\n<link rel="icon" type="image/png" href="https://foundation.aninix.net/img/icons/MaatIcon.png">\n<meta name="apple-mobile-web-app-capable" content="yes" />\n<link rel="stylesheet" type="text/css" href="https://foundation.aninix.net/css/theme-aninix.css">\n<link rel="apple-touch-icon" sizes="180x180" href="https://foundation.aninix.net/img/icons/MaatIcon.png" />\n</head>\n<body>\n<h1>AniNIX/Maat -- Build Status</h1>\nWEBSTATSGOHERE\n<h2>AnINIX Packages</h2>\n<p>These are packages written by the AniNIX. Their source is in <a href="https://foundation.aninix.net/" alt=AniNIX/Foundation>AniNIX/Foundation</a>.</p>\n' > "$webfile"
|
printf '<html>\n<head>\n<title>AniNIX/Maat -- Build Results</title>\n<link rel="icon" type="image/png" href="/MaatIcon.png" />\n<link rel="icon" type="image/png" href="/MaatIcon.png">\n<meta name="apple-mobile-web-app-capable" content="yes" />\n<link rel="stylesheet" type="text/css" href="https://aninix.net/assets/css/theme-aninix.css">\n<link rel="apple-touch-icon" sizes="180x180" href="/MaatIcon.png" />\n</head>\n<body>\n<h1>AniNIX/Maat -- Build Status</h1>\nWEBSTATSGOHERE\n<h2>AnINIX Packages</h2>\n<p>These are packages written by the AniNIX. Their source is in <a href="https://aninix.net/" alt=AniNIX/Foundation>AniNIX/Foundation</a>.</p>\n' > "$webfile"
|
||||||
printf "$tableHead" >> "$webfile"
|
printf "$tableHead" >> "$webfile"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +50,7 @@ function UpdateWebFile() {
|
|||||||
function BuildPackage() {
|
function BuildPackage() {
|
||||||
suffix="$1"
|
suffix="$1"
|
||||||
[ `pgrep -afc pacman` -eq 0 ] && rm -Rf /var/lib/pacman/db.lck
|
[ `pgrep -afc pacman` -eq 0 ] && rm -Rf /var/lib/pacman/db.lck
|
||||||
nice -n 10 timeout --preserve-status 20m sudo -u "depriv" /usr/sbin/makepkg -sfc --noconfirm --sign &>> "$pkgdir"/"$repodir".txt
|
nice -n 10 timeout --preserve-status 60m sudo -u "$deprivuser" /usr/sbin/makepkg -sfc --noconfirm --sign &>> "$pkgdir"/"$repodir".txt
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
# Build failed.
|
# Build failed.
|
||||||
printf "$failCell""$warnCell" >> "$webfile"
|
printf "$failCell""$warnCell" >> "$webfile"
|
||||||
@ -54,8 +58,10 @@ function BuildPackage() {
|
|||||||
# Build passed.
|
# Build passed.
|
||||||
printf "$passCell""<td>" >> "$webfile"
|
printf "$passCell""<td>" >> "$webfile"
|
||||||
# List passing versions
|
# List passing versions
|
||||||
for pkg in `find . -type f | egrep ".pkg.tar.xz$"`; do
|
for pkg in `find . -type f | grep -E "${pkgExt}""\$"`; do
|
||||||
printf "<a href=\"/$suffix/$pkg\">$pkg</a><br/>" >> "$webfile"
|
printf "<a href=\"/$suffix/$pkg\">$pkg</a><br/>" >> "$webfile"
|
||||||
|
pkgname="$(basename "$pkg" | cut -f 1 -d '.' | sed 's/-[[:digit:]]\+$//')"
|
||||||
|
find "${pkgdir}/${suffix}/" -name "${pkgname}-[0-9]*" -exec rm {} \;
|
||||||
mv "$pkg" "$pkgdir"/"$suffix";
|
mv "$pkg" "$pkgdir"/"$suffix";
|
||||||
mv "$pkg"".sig" "$pkgdir"/"$suffix";
|
mv "$pkg"".sig" "$pkgdir"/"$suffix";
|
||||||
done
|
done
|
||||||
@ -79,17 +85,24 @@ function BuildRepo() {
|
|||||||
cd "$repodir"
|
cd "$repodir"
|
||||||
git reset --hard origin &>/dev/null
|
git reset --hard origin &>/dev/null
|
||||||
output="$(git pull 2>&1)"
|
output="$(git pull 2>&1)"
|
||||||
chown -R "depriv": .
|
if [ -n "$incremental" ] && [ $( echo "$output" | grep -c 'Already up to date.' ) -eq 1 ]; then
|
||||||
|
return;
|
||||||
|
fi
|
||||||
|
|
||||||
|
chown -R "$deprivuser": .
|
||||||
echo "$output" > "$pkgdir"/"$repodir".txt
|
echo "$output" > "$pkgdir"/"$repodir".txt
|
||||||
# Find the PKGBuilds in the repo
|
# Find the PKGBuilds in the repo
|
||||||
for pkgbuild in `find . -type f -name PKGBUILD`; do
|
for pkgbuild in `find . -type f -name PKGBUILD`; do
|
||||||
cd "$(dirname "$pkgbuild")"
|
cd "$(dirname "$pkgbuild")"
|
||||||
# Tell the status file about it.
|
# Tell the status file about it.
|
||||||
printf '<tr style="border: 1px solid #FFF;"><td>'"<a href='$repo'>$repodir</a> -- $pkgbuild"'</td>' >> "$webfile"
|
printf '<tr style="border: 1px solid #FFF;"><td>'"<a href='$repo'>$repodir</a> -- $pkgbuild"'</td>' >> "$webfile"
|
||||||
if [ -f Makefile ] && [ `egrep -c '^test:' Makefile` -ge 1 ]; then
|
if [ -f Makefile ] && [ `grep -E -c '^test:' Makefile` -ge 1 ]; then
|
||||||
|
# Have to try to install dependencies first
|
||||||
|
for dep in $(grep makedepends PKGBUILD | cut -f 2 -d '(' | cut -f 1 -d ')' | sed "s/'//g"); do
|
||||||
|
pacman -Sy "$dep" --noconfirm --needed
|
||||||
|
done
|
||||||
# Check test status.
|
# Check test status.
|
||||||
timeout --preserve-status "$timeout" sudo -u "depriv" /bin/bash -l -c 'make test' &>> "$pkgdir"/"$repodir".txt
|
timeout --preserve-status "$timeout" sudo -u "$deprivuser" /bin/bash -l -c "cd $PWD; make test" &>> "$pkgdir"/"$repodir".txt
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
# Testing failed.
|
# Testing failed.
|
||||||
printf "$failCell""$warnCell""$warnCell" >> "$webfile"
|
printf "$failCell""$warnCell""$warnCell" >> "$webfile"
|
||||||
@ -115,19 +128,19 @@ function BuildRepo() {
|
|||||||
function UpdateLocalRepo() {
|
function UpdateLocalRepo() {
|
||||||
set -x
|
set -x
|
||||||
cd "$pkgdir"
|
cd "$pkgdir"
|
||||||
chown -R "depriv": .
|
chown -R "$deprivuser": .
|
||||||
# TODO Add deduplication of updated files -- keep latest 3 versions.
|
# TODO Add deduplication of updated files -- keep latest 3 versions.
|
||||||
rm -Rf AniNIX.[db,files]*
|
rm -Rf AniNIX.[db,files]*
|
||||||
sudo -u "depriv" repo-add --sign ./AniNIX.db.tar.xz `ls -1 *".pkg.tar.xz"`
|
sudo -u "$deprivuser" repo-add --sign ./AniNIX.db.tar.zst `ls -1 *"${pkgExt}"`
|
||||||
cd aur/
|
cd aur/
|
||||||
rm -Rf aur.[db,files]*
|
rm -Rf aur.[db,files]*
|
||||||
sudo -u "depriv" repo-add --sign ./aur.db.tar.xz `ls -1 *".pkg.tar.xz"`
|
sudo -u "$deprivuser" repo-add --sign ./aur.db.tar.zst `ls -1 *"${pkgExt}"`
|
||||||
set +x
|
set +x
|
||||||
}
|
}
|
||||||
|
|
||||||
# Clear variables
|
# Clear variables
|
||||||
aurconf='/usr/local/etc/Maat/aur.list'
|
aurconf='/usr/local/etc/Maat/aur.list'
|
||||||
baseurl='https://foundation.aninix.net/AniNIX'
|
baseurl='https://aninix.net/AniNIX'
|
||||||
homedir="/srv/maat/"
|
homedir="/srv/maat/"
|
||||||
unset incremental
|
unset incremental
|
||||||
unset skipPatching
|
unset skipPatching
|
||||||
@ -138,7 +151,7 @@ timeout="90s"
|
|||||||
starttime=`date +%s`
|
starttime=`date +%s`
|
||||||
|
|
||||||
# Parse arguments
|
# Parse arguments
|
||||||
while getopts 'b:c:hil:st:Tv' OPTION; do
|
while getopts 'b:c:hil:st:Tu:v' OPTION; do
|
||||||
case "${OPTION}" in
|
case "${OPTION}" in
|
||||||
b) homedir="${OPTARG}" ;;
|
b) homedir="${OPTARG}" ;;
|
||||||
c) aurconf="${OPTARG}" ;;
|
c) aurconf="${OPTARG}" ;;
|
||||||
@ -147,7 +160,8 @@ while getopts 'b:c:hil:st:Tv' OPTION; do
|
|||||||
l) cmdstring="$0"; for arg in $@; do if [ "$arg" != "-l" ] && [ "$arg" != "${OPTARG}" ]; then cmdstring="$cmdstring \"${arg}\""; fi; done; exec /bin/bash -c "$cmdstring | tee -a \"${OPTARG}\""; ;;
|
l) cmdstring="$0"; for arg in $@; do if [ "$arg" != "-l" ] && [ "$arg" != "${OPTARG}" ]; then cmdstring="$cmdstring \"${arg}\""; fi; done; exec /bin/bash -c "$cmdstring | tee -a \"${OPTARG}\""; ;;
|
||||||
s) skipPatching=1 ;;
|
s) skipPatching=1 ;;
|
||||||
t) timeout="${OPTARG}" ;;
|
t) timeout="${OPTARG}" ;;
|
||||||
T) export MAATTESTINGVAR=1; exec $0 -l ./testing.log -v -s -c <(echo https://aur.archlinux.org/cower.git) -b . ;;
|
T) export MAATTESTINGVAR=1; exec $0 -l ./testing.log -u "$deprivuser" -v -s -c <(echo https://aur.archlinux.org/ascii-invaders.git) -b . ;;
|
||||||
|
u) deprivuser="${OPTARG}" ;;
|
||||||
v) set -x ;;
|
v) set -x ;;
|
||||||
*) usage; exit 1 ;;
|
*) usage; exit 1 ;;
|
||||||
esac
|
esac
|
||||||
@ -155,7 +169,8 @@ done
|
|||||||
|
|
||||||
# Ensure we are up to date -- otherwise, building is not a good plan.
|
# Ensure we are up to date -- otherwise, building is not a good plan.
|
||||||
if [ -x `which pacman` ] && [ -z "$skipPatching" ]; then
|
if [ -x `which pacman` ] && [ -z "$skipPatching" ]; then
|
||||||
pacman -Syu --noconfirm;
|
pacman -Sc --noconfirm
|
||||||
|
pacman -Syu --noconfirm
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Self patching failed -- please investigate!" 1>&2
|
echo "Self patching failed -- please investigate!" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
@ -163,7 +178,7 @@ if [ -x `which pacman` ] && [ -z "$skipPatching" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure work directories live
|
# Ensure work directories live
|
||||||
if [ $( echo "$homedir" | egrep -c '^/') -ne 1 ]; then
|
if [ $( echo "$homedir" | grep -E -c '^/') -ne 1 ]; then
|
||||||
homedir="${PWD}/${homedir}"
|
homedir="${PWD}/${homedir}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -190,7 +205,7 @@ printf "$tableHead" >> "$webfile"
|
|||||||
|
|
||||||
# Build AUR
|
# Build AUR
|
||||||
for repo in `cat "$aurconf"`; do
|
for repo in `cat "$aurconf"`; do
|
||||||
BuildRepo "$repo" aur/;
|
BuildRepo "$repo" aur;
|
||||||
if [ ! -z "$MAATTESTINGVAR" ]; then break; fi
|
if [ ! -z "$MAATTESTINGVAR" ]; then break; fi
|
||||||
done
|
done
|
||||||
|
|
@ -1,10 +1,10 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=AniNIX::Maat \\ Builder Service
|
Description=AniNIX/Maat | Builder Service
|
||||||
ConditionPathExists=|!/srv/maat/pkg/.lock
|
ConditionPathExists=|!/srv/maat/pkg/.lock
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
ExecStartPre=/usr/sbin/mkdir /srv/maat/pkg/.lock
|
ExecStartPre=/usr/sbin/mkdir /srv/maat/pkg/.lock
|
||||||
ExecStart=/usr/local/bin/maat-builder
|
ExecStart=/usr/local/bin/maat
|
||||||
ExecStopPost=/usr/sbin/rmdir /srv/maat/pkg/.lock
|
ExecStopPost=/usr/sbin/rmdir /srv/maat/pkg/.lock
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
RemainAfterExit=no
|
RemainAfterExit=no
|
@ -1,5 +1,5 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=AniNIX::Maat \\ Builder Timer
|
Description=AniNIX/Maat | Builder Timer
|
||||||
|
|
||||||
[Timer]
|
[Timer]
|
||||||
OnCalendar=daily
|
OnCalendar=daily
|
Loading…
Reference in New Issue
Block a user