From 7e2abe2d068367f2fcdf638a4482c953111df156 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 7 May 2019 09:09:54 +0000 Subject: ci: include some scripts to make CI easier This should make it easier to test a bunch of package installation profiles across whatever OS isolation one chooses (chroots, containers, jails, VMs). --- ci/profiles.sh | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100755 ci/profiles.sh (limited to 'ci/profiles.sh') diff --git a/ci/profiles.sh b/ci/profiles.sh new file mode 100755 index 00000000..31140f35 --- /dev/null +++ b/ci/profiles.sh @@ -0,0 +1,72 @@ +#!/bin/sh +# Copyright (C) 2019 all contributors +# License: AGPL-3.0+ + +# Prints OS-specific package profiles to stdout (one per-newline) to use +# as command-line args for ci/deps.perl. Called automatically by ci/run.sh + +# set by os-release(5) or similar +ID= VERSION_ID= +case $(uname -o) in +GNU/Linux) + for f in /etc/os-release /usr/lib/os-release + do + test -f $f || continue + . $f + + # Debian sid (and testing) have no VERSION_ID + case $ID--$VERSION_ID in + debian--) + case $PRETTY_NAME in + */sid) VERSION_ID=sid ;; + *) + echo >&2 "$ID, but no VERSION_ID" + echo >&2 "==> $f <==" + cat >&2 $f + exit 1 + ;; + esac + ;; + esac + + case $ID--$VERSION_ID in + -|*--|--*) continue ;; + *--*) break ;; + esac + done + ;; +FreeBSD) + ID=freebsd + VERSION_ID=$(uname -r | cut -d . -f 1) + test "$VERSION_ID" -lt 11 && { + echo >&2 "ID=$ID $(uname -r) too old to support"; + exit 1 + } +esac + +case $ID in +freebsd) PKG_FMT=pkg ;; +debian|ubuntu) PKG_FMT=deb ;; +centos|redhat|fedora) PKG_FMT=rpm ;; +*) echo >&2 "PKG_FMT undefined for ID=$ID in $0" +esac + +case $ID-$VERSION_ID in +freebsd-11|freebsd-12) sed "s/^/$PKG_FMT /" <