Added option fswebcam

This commit is contained in:
AGG2017 2024-02-15 14:04:08 -05:00
parent eead8cf0d6
commit e741cb8f18
3 changed files with 75 additions and 5 deletions

Binary file not shown.

View file

@ -0,0 +1,67 @@
#!/bin/bash
# global definitions:
RED='\033[0;31m'
NC='\033[0m'
# check the parameters
if [ $# != 2 ]; then
echo "usage : $0 <project_root> <fswebcam_package>"
exit 1
fi
project_root="$1"
fswebcam_package=$(echo "$2" | sed -e 's/^"//' -e 's/"$//')
# check the required tools
TOOL_LIST=("unzip")
i=0
part_num=${#TOOL_LIST[*]}
while [ $i -lt $((part_num)) ]; do
echo "Checking tool: ${TOOL_LIST[$i]}"
t=$(which "${TOOL_LIST[$i]}")
if [ -z "$t" ]; then
if [ ! -f "TOOLS/${TOOL_LIST[$i]}" ]; then
echo -e "${RED}ERROR: Missing tool '${TOOL_LIST[$i]}' ${NC}"
exit 2
fi
fi
i=$(($i + 1))
done
# check the project root folder
if [ ! -d "$project_root" ]; then
echo -e "${RED}ERROR: Cannot find the folder '$project_root' ${NC}"
exit 3
fi
# check the fswebcam package folder
fswebcam_package_folder="${project_root}/RESOURCES/OPTIONS/fswebcam/${fswebcam_package}"
if [ ! -d "$fswebcam_package_folder" ]; then
echo -e "${RED}ERROR: Cannot find the folder '$fswebcam_package_folder' ${NC}"
exit 4
fi
# check the fswebcam package file
fswebcam_package_file="${fswebcam_package_folder}/fswebcam.zip"
if [ ! -f "$fswebcam_package_file" ]; then
echo -e "${RED}ERROR: Cannot find the file '$fswebcam_package_file' ${NC}"
exit 5
fi
# check the target folder
target_folder="$project_root/unpacked/squashfs-root"
if [ ! -d "$target_folder" ]; then
echo -e "${RED}ERROR: Cannot find the target folder '$target_folder' ${NC}"
exit 6
fi
# enable the selected fswebcam package
current_folder="$PWD"
cd "$target_folder" || exit 7
unzip -o "$fswebcam_package_file"
# extend the PATH to $project_root/unpacked/squashfs-root/etc/profile
sed -i 's#export PATH="/usr/sbin:/usr/bin:/sbin:/bin"#export PATH="/usr/sbin:/usr/bin:/sbin:/bin:/opt/sbin:/opt/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin"#' "$project_root/unpacked/squashfs-root/etc/profile"
cd "$current_folder" || exit 8
exit 0

View file

@ -14,19 +14,19 @@
custom_update="@/RESOURCES/KEYS/swupdate_public.pem"
# Enable root access by providing a custom root password hash (default password 'toor')
# Providing an empty string will allow root access without a password
# Providing an empty string will allow root access without a password (not recommended)
root_access="$1$///xTLYF$krWXTe62/dm.crd6CH4HW0"
# Enable opkg (+5MB to the update, +10MB to the rootfs)
opkg="default"
# Enable the UART at boot for access the uboot shell and for root login
# Use uboot from version '2.3.9' (recommended)
# From version 3.0.3 the UART is disabled
uart="2.3.9"
# Enable the SSH server, use 'dropbear' type ssh (recommended)
#ssh="dropbear"
ssh="dropbear"
# Enable opkg (+5MB to the update, +10MB to the rootfs)
#opkg="default"
# Enable custom webcam support. Use 'default' package. Support for firmware ver 3.0.9+ only
# When you need remote video monitoring from ssh shell execute 'camera.py' to start the webserver
@ -35,6 +35,9 @@ uart="2.3.9"
# Use CTRL-C or close the ssh shell to stop the webserver
#webcam="default"
# Webcam cli tool for taking pictures from connected USB webcam
#fswebcam="default"
# Enable the web interface Kobra Unleashed
# More information: https://github.com/anjomro/kobra-unleashed
# Replace the URL below with the URL of your MQTT server