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

View File

@ -3,7 +3,7 @@
declare -A config declare -A config
errmsg() { 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> config_parse() { # Usage: config_parse <CONFIG_FILE>
@ -12,11 +12,9 @@ config_parse() { # Usage: config_parse <CONFIG_FILE>
exit 1 exit 1
fi fi
while IFS='' read -r line || [[ -n "$line" ]]; do while IFS== read -r option value <(pacini "$1"); do
local option=${line%%= *}
local value=${line##* =} # ref: http://wiki.bash-hackers.org/syntax/pe#substring_removal
config["$option"]=$value config["$option"]=$value
done < <(pacini "$1") # Thanks to alad for showing me pacini done
} }
makepkg_run() { # Usage: makepkg_run <RepoDir> <MakepkgOpts> makepkg_run() { # Usage: makepkg_run <RepoDir> <MakepkgOpts>
@ -25,14 +23,10 @@ makepkg_run() { # Usage: makepkg_run <RepoDir> <MakepkgOpts>
makepkg "$@" makepkg "$@"
} }
repose_run() { # Usage: repose_run <ReposeOpts> <RepoDir> <DBFile>
repose $1 --root "$2" --pool "$2" "$3"
}
# If not running interactively, don't do anything # If not running interactively, don't do anything
# Allows for using these functions as commands by sourcing this script # Allows for using these functions as commands by sourcing this script
[[ $- != *i* ]] && return [[ $- != *i* ]] && return
config_parse "${CONFIG_FILE:-/etc/tl-makepkg.conf}" config_parse "${CONFIG_FILE:-/etc/tl-makepkg.conf}"
makepkg_run "${config[RepoDir]}" "${config[MakepkgOpts]} $@" 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]}"

View File

@ -1,6 +1,6 @@
# /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). # Syntax shamelessly copied from pacman.conf(5).
# #
# Any lines that start with '#' are ignored. # Any lines that start with '#' are ignored.