Skip to content

Commit

Permalink
Add Profile Checks
Browse files Browse the repository at this point in the history
  • Loading branch information
rusty-snake committed Oct 29, 2021
1 parent ac0f95a commit 0aa6664
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 21 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/profile-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Profile Checks

on:
push:
branches: [ master ]
paths:
- 'etc/**'
- 'ci/check/profiles/**'
- 'src/firecfg/firecfg.config'
- 'contrib/sort.py'
pull_request:
branches: [ master ]
paths:
- 'etc/**'
- 'ci/check/profiles/**'
- 'src/firecfg/firecfg.config'
- 'contrib/sort.py'

jobs:
profile-checks:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: sort.py
run: ./ci/check/profiles/sort.py etc/inc/*.inc etc/{profile-a-l,profile-m-z}/*.profile
- name: private-etc-always-required.sh
run: ./ci/check/profiles/private-etc-always-required.sh etc/inc/*.inc etc/{profile-a-l,profile-m-z}/*.profile
- name: sort-disable-programs.sh
run: ./ci/check/profiles/sort-disable-programs.sh etc/inc/disable-programs.inc
- name: sort-firecfg.config.sh
run: ./ci/check/profiles/sort-firecfg.config.sh src/firecfg/firecfg.config
21 changes: 0 additions & 21 deletions .github/workflows/sort.yml

This file was deleted.

15 changes: 15 additions & 0 deletions ci/check/profiles/private-etc-always-required.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

ALWAYS_REQUIRED=(alternatives ld.so.cache ld.so.preload)

error=0
while IFS=: read -r profile private_etc; do
for required in "${ALWAYS_REQUIRED[@]}"; do
if grep -q -v -E "( |,)$required(,|$)" <<<"$private_etc"; then
printf '%s misses %s\n' "$profile" "$required" >&2
error=1
fi
done
done < <(grep "^private-etc " "$@")

exit "$error"
2 changes: 2 additions & 0 deletions ci/check/profiles/sort-disable-programs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
tail -n +5 "$1" | LC_ALL=C sort -c -u
2 changes: 2 additions & 0 deletions ci/check/profiles/sort-firecfg.config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
tail -n +4 "$1" | sed 's/^# /#/' | LC_ALL=C sort -c -d
1 change: 1 addition & 0 deletions ci/check/profiles/sort.py

0 comments on commit 0aa6664

Please sign in to comment.