2018-06-06 20:02:00 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
cd $(dirname $0)/..
|
|
|
|
|
2018-08-21 21:42:03 +00:00
|
|
|
if [ -d lib/"rice-box.go" ]; then
|
|
|
|
rm -rf lib/rice-box.go
|
2018-08-06 04:15:57 +00:00
|
|
|
fi
|
|
|
|
|
2018-06-06 20:02:00 +00:00
|
|
|
if [ "$USE_DOCKER" != "" ]; then
|
|
|
|
if [ -d "frontend/dist" ]; then
|
|
|
|
rm -rf frontend/dist
|
|
|
|
fi;
|
2018-04-18 15:27:28 +00:00
|
|
|
|
|
|
|
if [ "$WDIR" = "" ]; then
|
|
|
|
WDIR="/go/src/github.com/filebrowser/filebrowser"
|
|
|
|
fi;
|
2018-06-06 20:02:00 +00:00
|
|
|
|
2018-08-20 09:41:06 +00:00
|
|
|
if [ "$(command -v git)" != "" ]; then
|
|
|
|
COMMIT_SHA="$(git rev-parse HEAD | cut -c1-8)"
|
|
|
|
else
|
|
|
|
COMMIT_SHA="untracked"
|
|
|
|
fi
|
|
|
|
|
2018-06-06 20:02:00 +00:00
|
|
|
$(command -v winpty) docker run -it \
|
|
|
|
--name filebrowser-tmp \
|
|
|
|
-v /$(pwd):/src:z \
|
2018-04-18 15:27:28 +00:00
|
|
|
-w /${WDIR} \
|
2018-08-20 09:41:06 +00:00
|
|
|
-e COMMIT_SHA=$COMMIT_SHA \
|
2018-06-06 20:02:00 +00:00
|
|
|
filebrowser/dev \
|
|
|
|
sh -c "\
|
2018-04-18 15:27:28 +00:00
|
|
|
cp -r //src/* /$WDIR && \
|
2018-06-06 20:02:00 +00:00
|
|
|
cd build && \
|
|
|
|
dos2unix build_assets.sh && \
|
|
|
|
dos2unix build.sh && \
|
|
|
|
./build_assets.sh && \
|
|
|
|
./build.sh \
|
|
|
|
"
|
|
|
|
exitcode=$?
|
|
|
|
|
|
|
|
if [ $exitcode -eq 0 ]; then
|
|
|
|
for d in "dist/" "node_modules/"; do
|
2018-04-18 15:27:28 +00:00
|
|
|
docker cp filebrowser-tmp:/$WDIR/frontend/$d frontend
|
2018-06-06 20:02:00 +00:00
|
|
|
done
|
2018-08-21 21:42:03 +00:00
|
|
|
docker cp filebrowser-tmp:/$WDIR/cli/filebrowser ./filebrowser
|
|
|
|
docker cp filebrowser-tmp:/$WDIR/lib/rice-box.go ./lib/rice-box.go
|
2018-06-06 20:02:00 +00:00
|
|
|
fi
|
|
|
|
docker rm -f filebrowser-tmp
|
|
|
|
else
|
2018-08-20 09:41:06 +00:00
|
|
|
set -e
|
2018-06-06 20:02:00 +00:00
|
|
|
./build/build_assets.sh
|
|
|
|
./build/build.sh
|
|
|
|
fi
|