You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
889 B

#!/bin/sh
set -e
# Functions
set_vars() {
printf 'Setting vars...\n' >&2
for i in "$@"; do
sed -r \
-e "s%@CONFIG@%${CONFIG}%" \
-e "s%@LOGDIR@%${LOGDIR}%" \
-e "s%@BASH@%${BASH}%" \
< "$i".in > "$i"
done
}
do_tell() {
printf 'Executing: %s\n' "$*"
"$@"
}
# Targets
target_userrc() {
target='userrc'
printf '%s\n' "Building $target..."
set_vars "$target"
do_tell chmod 755 "$target"
}
target_clean() {
do_tell rm -f userrc
}
target_install() {
mkdir -p "$BINDIR"
do_tell cp userrc "${BINDIR}/userrc"
do_tell chmod 755 "${BINDIR}/userrc"
}
target_all() {
target_userrc
}
main() {
while [ -n "$1" ]; do
case "$1" in
*=*) export "${1%%=*}=${1#*=}";;
--) shift; break;;
*) break;;
esac
shift
done
target="${1:-all}"
# Build configuration
. './config.mk.sh'
printf '%s\n' "Building target: $target"
"target_$target"
}
main "$@"