This repository has been archived by the owner on Oct 29, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathagno_mk
executable file
·80 lines (68 loc) · 1.82 KB
/
agno_mk
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/sh -e
# load our vars
. $HOME/agno/agnorc || exit 1
if [ ! -e ./Pkgfile ]; then
echo "ERROR: There's no Pkgfile in the current dir!"
exit 1
else
. ./Pkgfile
fi
PKGFILE_DIR=$PWD
# re-define vars with new info
PKGNAME=$name\#$version-$release
AGNO_SOURCE=$AGNO_SOURCE/$PKGNAME
AGNO_DESTDIR=$AGNO_DESTDIR/$PKGNAME
AGNO_WORK=$AGNO_WORK/$PKGNAME
# download source files (if necessary)
if [ -n "$source" ]; then
test -d $AGNO_SOURCE || mkdir -p $AGNO_SOURCE
cd $AGNO_SOURCE
# loop through our sources
for src in $source; do
# looks like a URL, want to download this
if echo $src | grep -qE '^(http|ftp)s?://'; then
# if file by the same name already exists
if [ -e "${src##*/}" ]; then
echo "Skipping download of '$src'."
else
curl --ssl -L -O $src
fi
# looks like git, we want to handle this differently
elif echo $src | grep -qE '^git://'; then
# if we've already got a dir by that name
if cd $name-git; then
# reset state of local repo
git fetch -q
git reset --hard origin/master
else
# don't clone the whole thing, we don't need it
git clone --depth 1 $src $name-git
fi
# we've got ourselves a normal file
else
cp -fR $PKGFILE_DIR/$src $AGNO_SOURCE
fi
done
fi
# reset/create necessary dirs for build
rm -rf $AGNO_DESTDIR $AGNO_WORK
mkdir -p $AGNO_DESTDIR $AGNO_WORK
# unpack / copy source files if there are any
if [ -n "$(\ls $AGNO_SOURCE 2>/dev/null)" ]; then
cp -fR $AGNO_SOURCE/* $AGNO_WORK
cd $AGNO_WORK
$AGNO_HOME/unboop *
fi
# run build function
cd $AGNO_WORK
agno_build
# gotta install that shiz diz
cd $AGNO_WORK
agno_install
# let's make a package out of the result
cd $AGNO_DESTDIR
tar -czvf $AGNO_PACKAGES/$PKGNAME.tar.gz .
# we're done! let's cleanup
rm -rf $AGNO_WORK $AGNO_DESTDIR
# notice
echo "Built '$PKGNAME' successfully (i.e. without errors)"