aboutsummaryrefslogtreecommitdiff
path: root/snag/scripts/run_pkg_build.sh
blob: 5b98cfde8b29a8c6ea7bf83feb1a9e95f09ac859 (plain)
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
#!/bin/sh

# reads a package description script and runs the configure, build, and install
# steps. intended only for use by snag program
if [ -z "$1" -a -z "$2" -a -z "$3" ]; then
    echo "Usage: $0 <description script>" >&2
    exit 1
fi
if [ -z "$1" ]; then
    echo "Usage: $0 <description script>" >&2
    exit 1
fi

api_send=$1
api_recv=$2

getvar() {
    eval "printf '\x03\x00\x00\x00$1' >&$api_send"
    IFS= read -r data 0<&"$api_recv"
    echo "$data"
}

# should remove
eval "printf '\x02\x00\x00\x00' >&$api_send"
IFS= read -r data 0<&"$api_recv"
echo "data=$data"

root=$(getvar root)

# load the description script
. $3

# run all install steps for package
configure
build
install
eval "printf '\x01\x00\x00\x00' >&$api_send"