-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstate.sh
executable file
·39 lines (35 loc) · 962 Bytes
/
state.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/bash
#
# Print a list of old or outdated packages.
#
# Author: Alastair Hughes
# Contact: < hobbitalastair at yandex dot com >
# Initial setup.
VERSION="1.0"
USAGE="<config dir> [<target>]..."
source "$(dirname "$(realpath "$0")")/lib/libmain.sh"
source "$(dirname "$(realpath "$0")")/lib/libbuild.sh"
main() {
# Print the current status.
local configdir="$1"
shift
local target_list="$(get_target_list "${configdir}" $@)"
walk "${configdir}" "print_state" ${target_list}
}
# Parse the arguments.
CONFIGDIR="" # Set the initial config dir.
TARGETS="" # The set of targets to investigate.
parseargs "$@" # Initial argument parse.
# Manual argument parse.
for arg in "$@"; do
ignore_arg "${arg}" || \
case "${arg}" in
*) if [ "${CONFIGDIR}" == "" ]; then
CONFIGDIR="${arg}"
else
TARGETS+=" ${arg}"
fi;;
esac
done
setup "${CONFIGDIR}"
main "${CONFIGDIR}" ${TARGETS}