aboutsummaryrefslogtreecommitdiff
path: root/snag/get_pkg_attrs.sh
blob: bb804182b76b20cd5bb90f58ae285ade1a9dd28d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/sh

# reads a package description script and outputs the attributes in a format easy
# for the snag program to read. it does not do any other validation, and should
# not be used by other programs

if [ -z "$1" ]; then
    echo "Usage: $0 <description script>" >&2
    exit 1
fi

# load the description script
. $1

# output package attributes (type char, value, null delimiter)
echoatt() { [ -n "$2" ] && printf "$1$2\0"; }
echoatt i "$pkg_id"
echoatt n "$pkg_name"
echoatt d "$pkg_desc"