FS-Mod/dist/arch/PKGBUILD
Einhard Leichtfuß d13c81814e
Fix tmpfiles.d setup
There was an error due to /var/cache/mediawiki being owned by http and
/var/cache/mediawiki/extensions being created as owned by root.

This could be fixed by explicitly creating the latter as owned by http,
but it seems cleaner to me now to set up a new cache dir.  Imagine
MediaWiki emptying its cache dir recursively.
2020-04-25 13:08:30 +02:00

130 lines
3.4 KiB
Bash

# Maintainer: Einhard Leichtfuß <alguien@respiranto.de>
_ensemble_name=FS-Mod
_mw_extnames=('Erstifahrt' 'FSMail' 'FSMod' 'StudiRegistration')
_mw_pkgdescs=(
'Mediawiki extension for the ErstiFahrt'
'MediaWiki extension to allow for access to the Mail Archive'
'MediaWiki extension for some parser tags and user images'
'MediaWiki extension for Student Registration')
_mw_extnames_lower=( "${_mw_extnames[@],,}" )
_mw_pkgnames_base=( "${_mw_extnames_lower[@]/#/mediawiki-extension-}" )
_mw_backups=('' '' '' '')
# Cache dir, relative to the extension's root dir.
# A cache dir requires a corresponding entry in tmpfiles.conf
_mw_cachedir=('' '' 'cache' '')
_mw_tmpfiles_conf=('' '' 'yes' '')
_mw_deps=('mediawiki>=1.25')
_mw_n=${#_mw_extnames[@]}
_rc_plugins=('fslogin')
_rc_pkgdescs=('Roundcube plugin to allow access to the Mail Archive')
_rc_plugins_lower=( "${_rc_plugins[@],,}" )
_rc_pkgnames_base=( "${_rc_plugins_lower[@]/#/roundcubemail-plugin-}" )
_rc_backups=('usr/share/webapps/roundcubemail/plugins/fslogin/config.php')
_rc_deps=('roundcubemail')
_rc_n=${#_rc_plugins[@]}
_pkgnames_base=( "${_mw_pkgnames_base[@]}" "${_rc_pkgnames_base[@]}" )
_pkgdescs=( "${_mw_pkgdescs[@]}" "${_rc_pkgdescs[@]}" )
_backups=( "${_mw_backups[@]}" "${_rc_backups[@]}" )
_n=$((_mw_n + _rc_n))
pkgbase='fs-infmath-mod-git'
pkgname=( "${_pkgnames_base[@]/%/-git}" )
pkgver=r205.661dec9
pkgrel=1
pkgdesc="MediaWiki extensions and one Roundcube plugin for the Student's association of CS and Maths at CAU Kiel"
arch=('any')
url="https://www.fs-infmath.uni-kiel.de/git/FS-InfMath/FS-Mod"
license=('GPL')
depends=()
makedepends=('git')
provides=()
conflicts=()
source=("git+${url}.git"
'tmpfiles.mediawiki-extension-fsmod.conf'
)
sha512sums=('SKIP'
'c03d01b141921130ea71ffa763cc92aa7f52d67eb16c25b360d91a2bf9d40fc17ee9b1723e2029955d32342a261ecfbd9c8716ddfec30b48701133fa9c38866d')
pkgver()
{
cd "$_ensemble_name"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
# $1: index < _mw_n
# $2: index < _n
_package_mw()
{
depends=( "${_mw_deps[@]}" )
_package "$2"
cd "$_ensemble_name"
local ext_basedir="/usr/share/webapps/mediawiki/extensions"
install -d -m0755 "${pkgdir}${ext_basedir}"
cp -r "${_mw_extnames[$1]}" "${pkgdir}${ext_basedir}/"
if test -n "${_mw_cachedir[$1]}"
then
local cachedir_real="/var/cache/${_mw_pkgnames_base[$1]}"
local cachedir_logical="${ext_basedir}/${_mw_extnames[$1]}/${_mw_cachedir[$1]}"
rm -f "${pkgdir}${cachedir_logical}/.gitkeep"
rm -df "${pkgdir}${cachedir_logical}"
ln -s "$cachedir_real" "${pkgdir}$cachedir_logical"
fi
if [[ "${_mw_tmpfiles_conf[$1]}" == 'yes' ]]
then
install -D -m0644 "${srcdir}/tmpfiles.${_mw_pkgnames_base[$1]}.conf" \
"${pkgdir}/usr/lib/tmpfiles.d/${_mw_pkgnames_base[$1]}.conf"
fi
}
# $1: index < _rc_n
# $2: index < _n
_package_rc()
{
depends=( "${_rc_deps[@]}" )
_package "$2"
cd "$_ensemble_name"
local plugin_basedir="/usr/share/webapps/roundcubemail/plugins"
install -d -m0755 "${pkgdir}${plugin_basedir}"
cp -r "${_rc_plugins[$1]}" "${pkgdir}${plugin_basedir}/"
}
# $1: index < _n
_package()
{
pkgdesc="${_pkgdescs[$1]}"
provides="${_pkgnames_base[$1]}"
conflicts="${_pkgnames_base[$1]}"
backup=( ${_backups[$1]} )
}
for ((_i = 0; _i < _mw_n; _i++))
do
eval "package_${pkgname[_i]}() { _package_mw $_i $_i; }"
done
for ((_j = 0; _j < _rc_n; _i++, _j++))
do
eval "package_${pkgname[_i]}() { _package_rc $_j $_i; }"
done