mirror of
https://github.com/riptidewave93/UNVR-NAS.git
synced 2025-02-14 19:41:55 +00:00
37 lines
1.1 KiB
Bash
Executable file
37 lines
1.1 KiB
Bash
Executable file
#!/bin/bash
|
|
set -e
|
|
|
|
# Source our common vars
|
|
scripts_path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
. ${scripts_path}/vars.sh
|
|
|
|
debug_msg "Starting 00_prereq_check.sh"
|
|
|
|
# Check for required utils
|
|
for bin in losetup docker wget sudo unsquashfs; do
|
|
if ! which ${bin} > /dev/null; then
|
|
error_msg "${bin} is missing! Exiting..."
|
|
exit 1
|
|
fi
|
|
done
|
|
|
|
# Make sure loop module is loaded
|
|
if [ ! -d /sys/module/loop ]; then
|
|
error_msg "Loop module isn't loaded into the kernel! This is REQUIRED! Exiting..."
|
|
exit 1
|
|
fi
|
|
|
|
# Validate FW is downloaded
|
|
if ! [ -f "${root_path}/unifi-firmware/${firmware_filename}" ]; then
|
|
echo "Error: File ${firmware_filename} does not exist in ./unifi-firmware! Exiting..."
|
|
exit 1
|
|
fi
|
|
|
|
# Does the checksum match?
|
|
file_md5=$(md5sum ${root_path}/unifi-firmware/${firmware_filename} | awk '{print $1}')
|
|
if [ "$file_md5" != "${firmware_md5}" ]; then
|
|
echo "Error: File ${firmware_filename} does not have the expected checksum! This is either the wrong file, or it's corrupted. Exiting..."
|
|
exit 1
|
|
fi
|
|
|
|
debug_msg "Finished 00_prereq_check.sh"
|