initial commit

This commit is contained in:
David Thurstenson 2017-01-24 09:42:41 -06:00
commit 25c3f6c848
3 changed files with 64 additions and 0 deletions

18
PKGBUILD Normal file
View File

@ -0,0 +1,18 @@
# Maintainer: David Thurstenson <thurstylark@gmail.com>
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
}

31
tl-makepkg Normal file
View File

@ -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

15
tl-makepkg.conf Normal file
View File

@ -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