shrub/.travis/get-or-build-pill.sh
2018-03-28 21:10:40 -07:00

59 lines
1.5 KiB
Bash

#!/bin/bash
set -euo pipefail
set -x
# XX use -s instead of hash pill
HASH=$(git -C .. log -1 HEAD --format=%H -- sys/)
export PILL_NAME="git-${HASH:0:10}"
if [ ! ${PILL_FORCE:-} ]; then
: Trying pill for commit
wget https://bootstrap.urbit.org/$PILL_NAME.pill -O urbit.pill && exit 0
fi
# if wget failed
if [ ${TRAVIS_COMMIT:-} ] && [ $TRAVIS_COMMIT != $HASH ]; then
: 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
# exit 1
fi
mkdir prev
{
: Pilling: trying pinned fakezod
wget -i pin-parent-pill-pier.url -O - | tar xvz -C prev/ &&
: Downloaded prev/zod &&
lsc ./in-urbit.ls -FI zod prev/zod <<' .'
|autoload |
|mount %
.
[ $? = 0 ] && cp -r ../sys prev/zod/home/
} || {
: Pilling: Parent-pill pier not available, trying preceding pill commit
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 &&
lsc ./in-urbit.ls -A .. -B prev/urbit.pill -cFI zod prev/zod <<' .'
%booted-prev-zod
.
} || {
: Pilling: Out of ideas
exit 1
}
: Pier created, soliding actual pill
lsc ./in-urbit.ls -FI zod prev/zod <<.
|label %home %$PILL_NAME
.urbit/pill +solid /==/$PILL_NAME/sys, =dub &
.
cp prev/zod/.urb/put/urbit.pill urbit.pill
mkdir built-pill; cp urbit.pill built-pill/$PILL_NAME.pill
:
: Created $PILL_NAME.pill, to be uploaded if tests pass
: