32 lines
754 B
Bash
32 lines
754 B
Bash
#!/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
|