mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-03 04:40:50 +03:00
nix: fix ivory-header error conditions (detecting lfs pointers)
This commit is contained in:
parent
f30e1d9993
commit
46934cef17
@ -1,13 +1,6 @@
|
||||
source $stdenv/setup
|
||||
|
||||
set -ex
|
||||
|
||||
cleanup () {
|
||||
echo "done"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
set -e
|
||||
|
||||
if ! [ -f "$IVORY" ]; then
|
||||
echo "$IVORY doesn't exist"
|
||||
@ -18,16 +11,19 @@ fi
|
||||
# heuristics to confirm the ivory pill is valid
|
||||
#
|
||||
|
||||
# greater than 10KB
|
||||
#
|
||||
if [ $(du -k $IVORY | cut -f1) -gt 10 ]; then
|
||||
echo "$IVORY is less than 10KB"
|
||||
fi
|
||||
|
||||
# first 7 bytes != "version" (start of an lfs pointer)
|
||||
#
|
||||
if [ "$(cat $(IVORY) | head -c 7)" = "version" ]; then
|
||||
echo "$IVORY starts with 'version'; it's an LFS pointer"
|
||||
if [ "$(cat "$IVORY" | head -c 7)" = "version" ]; then
|
||||
echo "$IVORY is an LFS pointer (it starts with 'version')"
|
||||
echo "to fix, run: git lfs install"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# greater than 10KB
|
||||
#
|
||||
if ! [ $(du -k "$IVORY" | cut -f1) -gt 10 ]; then
|
||||
echo "$IVORY is less than 10KB"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat $IVORY > u3_Ivory.pill
|
||||
@ -37,5 +33,3 @@ mkdir -p $out/include
|
||||
|
||||
mv ivory.h $out/include
|
||||
rm u3_Ivory.pill
|
||||
|
||||
set +x
|
||||
|
Loading…
Reference in New Issue
Block a user