2019-03-05 03:43:53 +03:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
case $# in
|
2019-05-02 23:13:48 +03:00
|
|
|
0) ship=zod; target=./zod;;
|
|
|
|
1) ship=$1; target=./$1;;
|
|
|
|
2) ship=$1; target=$2;;
|
|
|
|
*) echo "Usage: $0 [ship] [target-dir]" >&2
|
2019-03-05 03:43:53 +03:00
|
|
|
exit 1;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
if [ -e "$target" ]
|
|
|
|
then echo "Target directory '$target' already exists." >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-05-02 23:13:48 +03:00
|
|
|
pkg=$(nix-build nix/ops/boot-ship.nix --arg ship "\"$ship\"" --no-out-link)
|
2019-03-05 03:43:53 +03:00
|
|
|
|
|
|
|
mkdir -p "$(dirname "$target")"
|
2019-04-12 20:27:35 +03:00
|
|
|
cp -r $pkg/ $target
|
2019-03-05 03:43:53 +03:00
|
|
|
chmod -R u+rw $target
|