shrub/.travis/get-or-build-pill.sh

63 lines
1.6 KiB
Bash
Raw Normal View History

2017-12-02 06:20:24 +03:00
#!/bin/bash
2017-12-02 08:55:19 +03:00
set -euo pipefail
2018-03-09 06:02:03 +03:00
set -x
2018-11-06 06:42:59 +03:00
# add urbit-runner to $PATH
PATH=./node_modules/.bin/:$PATH
2017-12-02 06:20:24 +03:00
# XX use -s instead of hash pill
HASH=$(git -C .. log -1 HEAD --format=%H -- sys/)
2017-12-02 06:20:24 +03:00
export PILL_NAME="git-${HASH:0:10}"
2017-12-02 08:55:19 +03:00
if [ ! ${PILL_FORCE:-} ]; then
2018-03-09 06:02:03 +03:00
: Trying pill for commit
2017-12-02 06:20:24 +03:00
wget https://bootstrap.urbit.org/$PILL_NAME.pill -O urbit.pill && exit 0
fi
# if wget failed
2017-12-02 06:57:11 +03:00
2017-12-02 08:55:19 +03:00
if [ ${TRAVIS_COMMIT:-} ] && [ $TRAVIS_COMMIT != $HASH ]; then
2018-03-09 06:02:03 +03:00
: Directory sys/ not modified in commit $TRAVIS_COMMIT
: FIXME ignoring, as current sys/ commits are unlikely to contain the pill-build code
:
# : For auto-build please tag and push $HASH
2017-12-02 06:57:11 +03:00
# exit 1
fi
2017-12-02 06:20:24 +03:00
mkdir prev
2017-12-02 07:52:41 +03:00
{
2018-03-09 06:02:03 +03:00
: Pilling: trying pinned fakezod
2017-12-02 08:55:19 +03:00
wget -i pin-parent-pill-pier.url -O - | tar xvz -C prev/ &&
2018-03-09 06:02:03 +03:00
: Downloaded prev/zod &&
2018-11-06 06:42:59 +03:00
urbit-runner -S prev/zod <<' .'
|autoload |
|mount %
.
[ $? = 0 ] && cp -r ../sys prev/zod/home/ && cp ../gen/solid.hoon prev/zod/home/gen/
2017-12-02 07:52:41 +03:00
} || {
2018-03-09 06:02:03 +03:00
: Pilling: Parent-pill pier not available, trying preceding pill commit
2017-12-02 07:52:41 +03:00
HASH2=$(git -C .. log -2 $HASH --format=%H -- sys/ | tail -1)
PILL_NAME2="git-${HASH2:0:10}"
wget https://bootstrap.urbit.org/$PILL_NAME2.pill -O prev/urbit.pill &&
2018-09-27 02:57:10 +03:00
([ -d prev/zod ] && rm -r prev/zod || true) &&
2018-11-06 06:42:59 +03:00
urbit-runner -A .. -B prev/urbit.pill -cSF zod prev/zod <<' .'
%booted-prev-zod
.
2017-12-02 07:52:41 +03:00
} || {
2018-03-09 06:02:03 +03:00
: Pilling: Out of ideas
2017-12-02 07:52:41 +03:00
exit 1
}
2017-12-02 06:20:24 +03:00
2018-03-09 06:02:03 +03:00
: Pier created, soliding actual pill
2018-11-06 06:42:59 +03:00
urbit-runner -S prev/zod <<.
|label %home %$PILL_NAME
.urbit/pill +solid /==/$PILL_NAME/sys, =dub &
.
2017-12-02 06:20:24 +03:00
cp prev/zod/.urb/put/urbit.pill urbit.pill
mkdir built-pill; cp urbit.pill built-pill/$PILL_NAME.pill
2017-12-02 07:57:53 +03:00
2018-03-09 06:02:03 +03:00
:
: Created $PILL_NAME.pill, to be uploaded if tests pass
: