Moved to the MUCH easier pacini for filtering config files. Thanks Alad!

This commit is contained in:
David Thurstenson 2017-01-26 17:54:50 -06:00
parent aed15cff8b
commit 7df9f7b920
3 changed files with 26 additions and 20 deletions

View File

@ -1,17 +1,17 @@
# Maintainer: David Thurstenson <thurstylark@gmail.com>
pkgname=tl-makepkg
pkgver=0.3
pkgver=0.4
pkgrel=1
pkgdesc="Small utility for running makepkg, then repose to add a local non-AUR package to a custom repo"
arch=('any')
url="https://git.thurstylark.com/tl-makepkg.git/"
license=('GPL')
depends=('repose')
depends=('repose' 'pacutils')
backup=(etc/tl-makepkg.conf)
source=('tl-makepkg'
'tl-makepkg.conf')
md5sums=('737c5a07560428863b8242af4f80a1e4'
'90f485bc5e44599a2e2e7b8c49a140fc')
md5sums=('6f1d3fa62e88d68ab683bc4ee8755737'
'bd876524e71c61fd6682041351a192c4')
package() {
install -Dm755 tl-makepkg ${pkgdir}/usr/bin/tl-makepkg

View File

@ -6,28 +6,33 @@ errmsg() {
echo "Error in ${FUNCNAME[1]}: $1" >&2
}
config_parse() {
# Parses 'name=value' pairs from the input file to the config array
config_parse() { # Usage: config_parse <CONFIG_FILE>
if [[ ! -f "$1" ]]; then
errmsg "config file '$1' doesn't exist"
exit 1
fi
while IFS='' read -r line || [[ -n "$line" ]]; do
#[[ "$line" =~ ^#.*$ ]] && continue # Skip lines that start with '#'
local option=${line%%=*}
local value=${line##*=} # ref: http://wiki.bash-hackers.org/syntax/pe#substring_removal
local option=${line%%= *}
local value=${line##* =} # ref: http://wiki.bash-hackers.org/syntax/pe#substring_removal
config["$option"]=$value
done < <(sed '/^$/d;/^#.*$/d' "$1")
done < <(pacini "$1") # Thanks to alad for showing me pacini
}
makepkg_run() {
PKGDEST="${config[REPO_DIR]}" makepkg ${config[MAKEPKG_OPTS]} "$@"
makepkg_run() { # Usage: makepkg_run <RepoDir> <MakepkgOpts>
PKGDEST="$1"
shift 1
makepkg "$@"
}
repose_run() {
repose ${config[REPOSE_OPTS]} --root "${config[REPO_DIR]}" --pool "${config[REPO_DIR]}" "${config[DB_FILE]}"
repose_run() { # Usage: repose_run <ReposeOpts> <RepoDir> <DBFile>
repose $1 --root "$2" --pool "$2" "$3"
}
# If not running interactively, don't do anything
# Allows for using these functions as commands by sourcing this script
[[ $- != *i* ]] && return
config_parse "${CONFIG_FILE:-/etc/tl-makepkg.conf}"
makepkg_run "$@"
repose_run
makepkg_run "${config[RepoDir]}" "${config[MakepkgOpts]} $@"
repose_run "${config[ReposeOpts]}" "${config[RepoDir]}" "${config[DBFile]}"

View File

@ -1,15 +1,16 @@
# /etc/tl-makepkg.conf
#
# All options should be in a 'NAME=VALUE' format.
# Syntax shamelessly copied from pacman.conf(5).
#
# Any lines that start with '#' are ignored.
# Inline comments are NOT supported
REPO_DIR=/var/cache/pacman/tl
DB_FILE=/var/cache/pacman/tl/tl.db
RepoDir = /var/cache/pacman/tl
DBFile = /var/cache/pacman/tl/tl.db
REPOSE_OPTS=--verbose --files --xz
MAKEPKG_OPTS=
ReposeOpts = --verbose --files --xz
MakepkgOpts =
# vim: set ft=dosini: