From 25c3f6c8484d5e1e058770112184048db34f7822 Mon Sep 17 00:00:00 2001 From: David Thurstenson Date: Tue, 24 Jan 2017 09:42:41 -0600 Subject: [PATCH] initial commit --- PKGBUILD | 18 ++++++++++++++++++ tl-makepkg | 31 +++++++++++++++++++++++++++++++ tl-makepkg.conf | 15 +++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 PKGBUILD create mode 100644 tl-makepkg create mode 100644 tl-makepkg.conf diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..83f420d --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,18 @@ +# Maintainer: David Thurstenson +pkgname=tl-makepkg +pkgver=0.1 +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=('makepkg' 'repose') +backup=(etc/tl-makepkg.conf) +source=('tl-makepkg' + 'tl-makepkg.conf') +md5sums=() + +package() { + install -Dm755 tl-makepkg ${pkgdir}/usr/bin/tl-makepkg + install -Dm644 tl-makepkg.conf ${pkgdir}/etc/tl-makepkg.conf +} diff --git a/tl-makepkg b/tl-makepkg new file mode 100644 index 0000000..2336ae7 --- /dev/null +++ b/tl-makepkg @@ -0,0 +1,31 @@ +#!/bin/bash + +declare -A config + +errmsg() { + echo "Error in ${FUNCNAME[1]}: $1" >&2 +} + +config_parse() { + # Parses 'name=value' pairs from the input file to the config array + 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 '#' + config[${line%%=*}]=${line##*=} # ref: http://wiki.bash-hackers.org/syntax/pe#substring_removal + done < "$1" +} + +makepkg_run() { + PKGDEST="${config[REPO_DIR]}" makepkg ${config[MAKEPKG_OPTS]} "$@" +} + +repose_run() { + repose ${config[REPOSE_OPTS]} --pool "${config[REPO_DIR]}" "${config[DB_FILE]}" +} + +config_parse "${CONFIG_FILE:-/etc/tl-makepkg.conf}" +makepkg_run "$@" +repose_run diff --git a/tl-makepkg.conf b/tl-makepkg.conf new file mode 100644 index 0000000..d0441b1 --- /dev/null +++ b/tl-makepkg.conf @@ -0,0 +1,15 @@ +# /etc/tl-makepkg.conf +# +# All options should be in a 'NAME=VALUE' format. +# +# 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 + +REPOSE_OPTS=--verbose --files --xz +MAKEPKG_OPTS= + + +# vim: set ft=dosini