Thinned out unnecessary complications to config_parse. Removed repose_run()

This commit is contained in:
David Thurstenson 2017-01-26 19:01:39 -06:00
parent 7df9f7b920
commit 2b693c3ebb
3 changed files with 9 additions and 15 deletions

View File

@ -1,17 +1,17 @@
# Maintainer: David Thurstenson <thurstylark@gmail.com>
pkgname=tl-makepkg
pkgver=0.4
pkgver=0.5
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' 'pacutils')
backup=(etc/tl-makepkg.conf)
backup=('etc/tl-makepkg.conf')
source=('tl-makepkg'
'tl-makepkg.conf')
md5sums=('6f1d3fa62e88d68ab683bc4ee8755737'
'bd876524e71c61fd6682041351a192c4')
md5sums=('bdaea613965516d9fbab7f688d75c859'
'938de8daea15f68500e969df422fd7fa')
package() {
install -Dm755 tl-makepkg ${pkgdir}/usr/bin/tl-makepkg

View File

@ -3,7 +3,7 @@
declare -A config
errmsg() {
echo "Error in ${FUNCNAME[1]}: $1" >&2
printf "Error in %s: %s\n" "${FUNCNAME[1]}" "$1" >&2
}
config_parse() { # Usage: config_parse <CONFIG_FILE>
@ -12,11 +12,9 @@ config_parse() { # Usage: config_parse <CONFIG_FILE>
exit 1
fi
while IFS='' read -r line || [[ -n "$line" ]]; do
local option=${line%%= *}
local value=${line##* =} # ref: http://wiki.bash-hackers.org/syntax/pe#substring_removal
while IFS== read -r option value <(pacini "$1"); do
config["$option"]=$value
done < <(pacini "$1") # Thanks to alad for showing me pacini
done
}
makepkg_run() { # Usage: makepkg_run <RepoDir> <MakepkgOpts>
@ -25,14 +23,10 @@ makepkg_run() { # Usage: makepkg_run <RepoDir> <MakepkgOpts>
makepkg "$@"
}
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 "${config[RepoDir]}" "${config[MakepkgOpts]} $@"
repose_run "${config[ReposeOpts]}" "${config[RepoDir]}" "${config[DBFile]}"
repose "${config[ReposeOpts]}" --root "${config[MakepkgOpts]}" --pool "${config[MakepkgOpts]}" "${config[DBFile]}"