Skip to content

Commit 474b540

Browse files
authored
Merge pull request #6 from dolfs/rust
Enhancements to the prep.sh script
2 parents 632358b + c739bd7 commit 474b540

File tree

2 files changed

+20
-5
lines changed

2 files changed

+20
-5
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ cameras.sql
33
.settings
44
*.swp
55
target
6+
prep.config

prep.sh

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/bash -x
22
#
33
# This file is part of Moonfire NVR, a security camera network video recorder.
44
# Copyright (C) 2016 Scott Lamb <[email protected]>
@@ -39,8 +39,12 @@
3939
#
4040

4141
# Configuration variables. Should only need minimal, or zero, changes.
42-
# Empty values will use defaults.
42+
# Empty values will use defaults. For convenience, we attempt to read
43+
# customizations from prep.config first
4344
#
45+
if [ -r prep.config ]; then
46+
. prep.config
47+
fi
4448

4549
# User and group
4650
# Default: or whatever is in $NVR_USER (default "moonfire-nvr")
@@ -61,7 +65,7 @@
6165

6266
# Set to mountpoint of media directory, empty to stay in home directory
6367
# Default: empty
64-
#SAMPLES_DIR=
68+
#SAMPLES_DIR=/media/nvr/samples
6569

6670
# Set to path for media directory relative to mountpoint
6771
# Default: "samples"
@@ -154,8 +158,18 @@ if [ ! -x "${SERVICE_BIN}" ]; then
154158
echo
155159
exit 1
156160
fi
157-
RUST_TEST_THREADS=1 cargo test
158-
cargo build --release
161+
if ! RUST_TEST_THREADS=1 cargo test; then
162+
echo "test failed. Try to run the following manually for more info"
163+
echo "RUST_TEST_THREADS=1 cargo test --verbose"
164+
echo
165+
exit 1
166+
fi
167+
if ! cargo build --release; then
168+
echo "Build failed."
169+
echo "RUST_TEST_THREADS=1 cargo build --release --verbose"
170+
echo
171+
exit 1
172+
fi
159173
sudo install -m 755 target/release/moonfire-nvr ${SERVICE_BIN}
160174
if [ -x "${SERVICE_BIN}" ]; then
161175
echo "Binary installed..."; echo

0 commit comments

Comments
 (0)