simplify and fix installation instructions

* install.md, install-manual.md, and easy-install.md had a lot of
  redundancy. Rework them so the common prefix and suffix are in
  install.md and it's clear when to navigate back and forth. This
  removes from very stale references to prep.sh and cameras.sql in
  install-manual.md (which never should have mentioned these scripts
  anyway).

* remove all the SAMPLE_MEDIA_DIR, SAMPLE_FILE_DIR, and
  SAMPLE_FILE_PATH stuff from the scripts. This was too complicated
  (one variable will suffice) and inconsistent in terminology (a
  couple "samples dir" occurrences slipped through review; they
  should have been "sample file dir"). It also wasn't really useful
  enough because the procedure for a mount point is manual anyway,
  and because some installs will have multiple sample file dirs
  anyway.

* in the mount point procedure, fix the paths to be consistent. Also
  describe the "nofail" and "Requires=" config I have on my machine.

* fix some incorrect info about how to use "moonfire-nvr config" and
  describe "flush_if_sec".
This commit is contained in:
Scott Lamb
2018-08-24 20:45:46 -07:00
parent 8dc5d64333
commit c5345c1e11
6 changed files with 111 additions and 373 deletions

View File

@@ -91,7 +91,7 @@ if ! cargo test; then
fi
if ! cargo build --release; then
echo_error -x "Server/release build failed." "Try to run the following manually for more info" \
"RUST_TEST_THREADS=1 cargo build --release --verbose" ''
"cargo build --release --verbose" ''
exit 1
fi

View File

@@ -157,8 +157,6 @@ initEnvironmentVars()
NVR_HOME="${NVR_HOME_BASE}/${NVR_USER}"
DB_NAME="${DB_NAME:-db}"
DB_DIR="${DB_DIR:-$NVR_HOME/${DB_NAME}}"
SAMPLE_FILE_DIR="${SAMPLE_FILE_DIR:-sample}"
SAMPLE_MEDIA_DIR="${SAMPLE_MEDIA_DIR:-$NVR_HOME}"
SERVICE_NAME="${SERVICE_NAME:-moonfire-nvr}"
SERVICE_DESC="${SERVICE_DESC:-Moonfire NVR}"
SERVICE_BIN="${SERVICE_BIN:-/usr/local/bin/moonfire-nvr}"
@@ -177,8 +175,6 @@ makePrepConfig()
cat >"${MOONFIRE_DIR}/prep.config" <<-EOF_CONFIG
NVR_USER=$NVR_USER
NVR_PORT=$NVR_PORT
SAMPLE_FILE_DIR=$SAMPLE_FILE_DIR
#SAMPLE_MEDIA_DIR=/mount/media
SERVICE_NAME=$SERVICE_NAME
SERVICE_DESC="$SERVICE_DESC"
EOF_CONFIG
@@ -292,38 +288,10 @@ setup_db()
#
fix_ownership()
{
sudo chown -R ${NVR_USER}.${NVR_USER} "$1"
sudo chown -R ${NVR_USER}:${NVR_USER} "$1"
echo_info -x "Fix ownership of files in \"$1\"..."
}
# Make sure samples directory is ready
#
prep_sample_file_dir()
{
if [ -z "${SAMPLE_MEDIA_DIR}" ]; then
echo_fatal -x "SAMPLE_MEDIA_DIR variable not configured. Check configuration."
exit 1
fi
SAMPLE_FILE_PATH="${SAMPLE_MEDIA_DIR}/${SAMPLE_FILE_DIR}"
if [ "${SAMPLE_FILE_PATH##${NVR_HOME}}" != "${SAMPLE_FILE_PATH}" ]; then
# Under the home directory, create if not there
if [ ! -d "${SAMPLE_FILE_PATH}" ]; then
echo_info -x "Created sample file directory: \"$SAMPLE_FILE_PATH\"..."
mkdir_moonfire -p "${SAMPLE_FILE_PATH}"
fi
else
if [ ! -d "${SAMPLE_FILE_PATH}" ]; then
read_lines <<-MSG1
Samples directory $SAMPLE_FILE_PATH does not exist.
If a mounted file system, make sure /etc/fstab is properly configured,
and file system is mounted and directory created.
MSG1
echo_fatal -L
fi
fi
fix_ownership "${SAMPLE_FILE_PATH}"
}
# Create user and groups if not there
#
prep_moonfire_user()
@@ -358,7 +326,5 @@ pre_install_prep()
{
prep_moonfire_user
setup_db
prep_sample_file_dir
fix_localtime
}