Ok I have multiple Pi's and camera's but I cant figure out how to use any of them on any Pi. Yes I'm a noob so... I'm currently using a Pi4B with the Raspiberry Module 2 Camera, I loaded the 64bit Rasbian (Bookworm). I have tried for days to figure out how to actually make any of the camera's I bought work and apparently "MotionEyeOS seems to be the program I need to use. Under this is a Code I found that is supposed to auto load "motionEyeOS to a Linux system, or sd card or both I really have no clue..
How do I use this ?? I think its written in C and unfortunately I only know how to put Python in Thonny and run it to do anything other then simple commands like Sudo apt update or Sudo apt full-install and so forth. I'm trying to follow the install but when I insert another storage device I cant tell which one is which or even how to write to the correct one. I read that MotionEyeOS can be run on a Pi5 with 64bit bookworm already written to it or do I have to somehow write the MotionEye to a separate SD card/Storage device and use that to run it from??
Thank you in advance
Krampapas
Code:
#!/bin/bash -efunction usage() { echo "Usage: $0 [options...]" echo "" echo "Available options:" echo " <-i image_file> - indicates the path to the image file (e.g. -i /home/user/Download/file.img.gz)" echo " <-d sdcard_dev> - indicates the path to the sdcard block device (e.g. -d /dev/mmcblk0)" echo " [-m modem:apn:user:pwd:pin] - configures the mobile network modem (e.g. -m ttyUSB0:internet)" echo " [-n ssid:psk] - sets the wireless network name and key (e.g. -n mynet:mykey1234)" echo " [-s ip/cidr:gw:dns] - sets a static IP configuration instead of DHCP (e.g. -s 192.168.1.101/24:192.168.1.1:8.8.8.8)" exit 1}if [ -z "$1" ]; then usage 1>&2fiif [[ $(id -u) -ne 0 ]]; then echo "please run as root"; exit 1; fifunction msg() { echo " * $1"}while getopts "a:d:f:h:i:lm:n:o:p:s:w" o; do case "$o" in d) SDCARD_DEV=$OPTARG ;; i) DISK_IMG=$OPTARG ;; m) IFS=":" SETTINGS=($OPTARG) MODEM=${SETTINGS[0]} APN=${SETTINGS[1]} MUSER=${SETTINGS[2]} MPWD=${SETTINGS[3]} PIN=${SETTINGS[4]} ;; n) IFS=":" NETWORK=($OPTARG) SSID=${NETWORK[0]} PSK=${NETWORK[1]} ;; s) IFS=":" S_IP=($OPTARG) IP=${S_IP[0]} GW=${S_IP[1]} DNS=${S_IP[2]} ;; *) usage 1>&2 ;; esacdoneif [ -z "$SDCARD_DEV" ] || [ -z "$DISK_IMG" ]; then usage 1>&2fifunction cleanup { set +e # unmount sdcard umount ${SDCARD_DEV}* >/dev/null 2>&1}trap cleanup EXITBOOT=$(dirname $0)/.bootif ! [ -f $DISK_IMG ]; then echo "could not find image file $DISK_IMG" exit 1figunzip=$(which unpigz 2> /dev/null || which gunzip 2> /dev/null || true)unxz=$(which unxz 2> /dev/null || true)if [[ $DISK_IMG == *.gz ]]; then if [ -z "$gunzip" ]; then msg "make sure you have the gzip package installed" exit 1 fi msg "decompressing the .gz compressed image" $gunzip -c $DISK_IMG > ${DISK_IMG%???} DISK_IMG=${DISK_IMG%???}elif [[ $DISK_IMG == *.xz ]]; then if [ -z "$unxz" ]; then msg "make sure you have the xz package installed" exit 1 fi msg "decompressing the .xz compressed image" $unxz -T 0 -c $DISK_IMG > ${DISK_IMG%???} DISK_IMG=${DISK_IMG%???}fiumount ${SDCARD_DEV}* 2>/dev/null || truemsg "writing disk image to sdcard"dd if=$DISK_IMG of=$SDCARD_DEV bs=1048576syncif which partprobe > /dev/null 2>&1; then msg "re-reading sdcard partition table" partprobe ${SDCARD_DEV} sleep 1fimsg "mounting sdcard"mkdir -p $BOOTif [ `uname` == "Darwin" ]; then BOOT_DEV=${SDCARD_DEV}s1 # e.g. /dev/disk4s1 diskutil unmountDisk ${SDCARD_DEV} mount -ft msdos $BOOT_DEV $BOOTelse # assuming Linux BOOT_DEV=${SDCARD_DEV}p1 # e.g. /dev/mmcblk0p1 if ! [ -e ${SDCARD_DEV}p1 ]; then BOOT_DEV=${SDCARD_DEV}1 # e.g. /dev/sdc1 fi mount $BOOT_DEV $BOOTfi# wifiif [ -n "$SSID" ]; then msg "creating wireless configuration" conf=$BOOT/wpa_supplicant.conf echo "update_config=1" > $conf echo "ctrl_interface=/var/run/wpa_supplicant" >> $conf echo "network={" >> $conf echo " scan_ssid=1" >> $conf echo " ssid=\"$SSID\"" >> $conf if [ -n "$PSK" ]; then echo " psk=\"$PSK\"" >> $conf fi echo "}" >> $conf echo "" >> $conffi# modemif [ -n "$MODEM" ]; then msg "creating mobile network configuration" conf=$BOOT/ppp mkdir -p $conf echo $MODEM > $conf/modem echo "AT+CGDCONT=1,\"IP\",\"$APN\"" > $conf/apn echo > $conf/extra echo > $conf/auth echo > $conf/pin if [ -n "$MUSER" ]; then echo "user \"$MUSER\"" > $conf/auth echo "password \"$MPWD\"" >> $conf/auth fi if [ -n "$PIN" ]; then echo "AT+CPIN=$PIN" > $conf/pin fifi# static ipif [ -n "$IP" ] && [ -n "$GW" ] && [ -n "$DNS" ]; then msg "setting static IP configuration" conf=$BOOT/static_ip.conf echo "STATIC_IP=\"$IP\"" > $conf echo "STATIC_GW=\"$GW\"" >> $conf echo "STATIC_DNS=\"$DNS\"" >> $conffimsg "unmounting sdcard"syncumount $BOOTrmdir $BOOTmsg "you can now remove the sdcard"Thank you in advance
Krampapas
Statistics: Posted by Krampapas — Fri May 02, 2025 10:47 pm