Moved to the MUCH easier pacini for filtering config files. Thanks Alad!
This commit is contained in:
parent
aed15cff8b
commit
7df9f7b920
8
PKGBUILD
8
PKGBUILD
|
@ -1,17 +1,17 @@
|
||||||
# Maintainer: David Thurstenson <thurstylark@gmail.com>
|
# Maintainer: David Thurstenson <thurstylark@gmail.com>
|
||||||
pkgname=tl-makepkg
|
pkgname=tl-makepkg
|
||||||
pkgver=0.3
|
pkgver=0.4
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Small utility for running makepkg, then repose to add a local non-AUR package to a custom repo"
|
pkgdesc="Small utility for running makepkg, then repose to add a local non-AUR package to a custom repo"
|
||||||
arch=('any')
|
arch=('any')
|
||||||
url="https://git.thurstylark.com/tl-makepkg.git/"
|
url="https://git.thurstylark.com/tl-makepkg.git/"
|
||||||
license=('GPL')
|
license=('GPL')
|
||||||
depends=('repose')
|
depends=('repose' 'pacutils')
|
||||||
backup=(etc/tl-makepkg.conf)
|
backup=(etc/tl-makepkg.conf)
|
||||||
source=('tl-makepkg'
|
source=('tl-makepkg'
|
||||||
'tl-makepkg.conf')
|
'tl-makepkg.conf')
|
||||||
md5sums=('737c5a07560428863b8242af4f80a1e4'
|
md5sums=('6f1d3fa62e88d68ab683bc4ee8755737'
|
||||||
'90f485bc5e44599a2e2e7b8c49a140fc')
|
'bd876524e71c61fd6682041351a192c4')
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
install -Dm755 tl-makepkg ${pkgdir}/usr/bin/tl-makepkg
|
install -Dm755 tl-makepkg ${pkgdir}/usr/bin/tl-makepkg
|
||||||
|
|
25
tl-makepkg
25
tl-makepkg
|
@ -6,28 +6,33 @@ errmsg() {
|
||||||
echo "Error in ${FUNCNAME[1]}: $1" >&2
|
echo "Error in ${FUNCNAME[1]}: $1" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
config_parse() {
|
config_parse() { # Usage: config_parse <CONFIG_FILE>
|
||||||
# Parses 'name=value' pairs from the input file to the config array
|
|
||||||
if [[ ! -f "$1" ]]; then
|
if [[ ! -f "$1" ]]; then
|
||||||
errmsg "config file '$1' doesn't exist"
|
errmsg "config file '$1' doesn't exist"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
while IFS='' read -r line || [[ -n "$line" ]]; do
|
while IFS='' read -r line || [[ -n "$line" ]]; do
|
||||||
#[[ "$line" =~ ^#.*$ ]] && continue # Skip lines that start with '#'
|
|
||||||
local option=${line%%= *}
|
local option=${line%%= *}
|
||||||
local value=${line##* =} # ref: http://wiki.bash-hackers.org/syntax/pe#substring_removal
|
local value=${line##* =} # ref: http://wiki.bash-hackers.org/syntax/pe#substring_removal
|
||||||
config["$option"]=$value
|
config["$option"]=$value
|
||||||
done < <(sed '/^$/d;/^#.*$/d' "$1")
|
done < <(pacini "$1") # Thanks to alad for showing me pacini
|
||||||
}
|
}
|
||||||
|
|
||||||
makepkg_run() {
|
makepkg_run() { # Usage: makepkg_run <RepoDir> <MakepkgOpts>
|
||||||
PKGDEST="${config[REPO_DIR]}" makepkg ${config[MAKEPKG_OPTS]} "$@"
|
PKGDEST="$1"
|
||||||
|
shift 1
|
||||||
|
makepkg "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
repose_run() {
|
repose_run() { # Usage: repose_run <ReposeOpts> <RepoDir> <DBFile>
|
||||||
repose ${config[REPOSE_OPTS]} --root "${config[REPO_DIR]}" --pool "${config[REPO_DIR]}" "${config[DB_FILE]}"
|
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}"
|
config_parse "${CONFIG_FILE:-/etc/tl-makepkg.conf}"
|
||||||
makepkg_run "$@"
|
makepkg_run "${config[RepoDir]}" "${config[MakepkgOpts]} $@"
|
||||||
repose_run
|
repose_run "${config[ReposeOpts]}" "${config[RepoDir]}" "${config[DBFile]}"
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
# /etc/tl-makepkg.conf
|
# /etc/tl-makepkg.conf
|
||||||
#
|
#
|
||||||
# All options should be in a 'NAME=VALUE' format.
|
# All options should be in a 'NAME=VALUE' format.
|
||||||
|
# Syntax shamelessly copied from pacman.conf(5).
|
||||||
#
|
#
|
||||||
# Any lines that start with '#' are ignored.
|
# Any lines that start with '#' are ignored.
|
||||||
# Inline comments are NOT supported
|
# Inline comments are NOT supported
|
||||||
|
|
||||||
REPO_DIR=/var/cache/pacman/tl
|
RepoDir = /var/cache/pacman/tl
|
||||||
DB_FILE=/var/cache/pacman/tl/tl.db
|
DBFile = /var/cache/pacman/tl/tl.db
|
||||||
|
|
||||||
REPOSE_OPTS=--verbose --files --xz
|
ReposeOpts = --verbose --files --xz
|
||||||
MAKEPKG_OPTS=
|
MakepkgOpts =
|
||||||
|
|
||||||
|
|
||||||
# vim: set ft=dosini:
|
# vim: set ft=dosini:
|
||||||
|
|
Loading…
Reference in New Issue