Skip to content

Commit

Permalink
writeimage.sh: added port option; partprobe is now used to re-read pa…
Browse files Browse the repository at this point in the history
…rtition table
  • Loading branch information
ccrisan committed Sep 24, 2014
1 parent 5d00272 commit f28ca94
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
18 changes: 16 additions & 2 deletions board/raspberrypi/writeimage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@


function usage() {
echo "Usage: $0 <-d sdcard_dev> <-i image_file> [-l] [-n ssid:psk] [-o none|modest|medium|high|turbo] [-s ip/cidr:gw:dns]" 1>&2
echo "Usage: $0 <-d sdcard_dev> <-i image_file> [-l] [-n ssid:psk] [-o none|modest|medium|high|turbo] [-p port] [-s ip/cidr:gw:dns]" 1>&2
echo " -d sdcard_dev - indicates the path to the sdcard block device (e.g. -d /dev/mmcblk0)"
echo " -i image_file - indicates the path to the image file (e.g. -i /home/user/Download/motionPie.img)"
echo " -l - disables the LED of the CSI camera module"
echo " -n ssid:psk - sets the wireless network name and key (e.g. -n mynet:mykey1234)"
echo " -o none|modest|medium|high|turbo - overclocks the PI according to a preset (e.g. -o high)"
echo " -p port - listen on the given port rather than on 80 (e.g. -p 8080)"
echo " -s ip/cidr:gw:dns - sets a static IP configuration instead of DHCP (e.g. -s 192.168.3.107/24:192.168.3.1:8.8.8.8)"
exit 1
}
Expand All @@ -22,7 +23,7 @@ function msg() {
echo ":: $1"
}

while getopts "d:i:ln:o:s:" o; do
while getopts "d:i:ln:o:p:s:" o; do
case "$o" in
d)
SDCARD_DEV=$OPTARG
Expand All @@ -41,6 +42,9 @@ while getopts "d:i:ln:o:s:" o; do
o)
OC_PRESET=$OPTARG
;;
p)
PORT=$OPTARG
;;
s)
IFS=":" S_IP=($OPTARG)
IP=${S_IP[0]}
Expand Down Expand Up @@ -79,6 +83,11 @@ msg "writing disk image to sdcard"
dd if=$DISK_IMG of=$SDCARD_DEV bs=1M
sync

if which partprobe > /dev/null 2>&1; then
msg "re-reading sdcard partition table"
partprobe ${SDCARD_DEV}
fi

msg "mounting sdcard"
mkdir -p $BOOT
mkdir -p $ROOT
Expand Down Expand Up @@ -165,6 +174,11 @@ if [ -n "$IP" ] && [ -n "$GW" ] && [ -n "$DNS" ]; then
echo "static_dns=\"$DNS\"" >> $conf
fi

if [ -n "$PORT" ]; then
msg "setting server port to $PORT"
sed -i "s%PORT = 80%PORT = $PORT%" $ROOT/programs/motioneye/settings.py
fi

msg "unmounting sdcard"
sync
umount $BOOT
Expand Down
2 changes: 1 addition & 1 deletion package/motioneye/S95motioneye
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

watch_timeout=120
port=80
port=$(cat /programs/motioneye/settings.py | grep PORT | tr -d ' ' | cut -d '=' -f 2)

responsive() {
if wget -q -t 1 -T 2 -O - http://127.0.0.1:$port/static/img/motioneye-logo.svg >/dev/null 2>&1; then
Expand Down
4 changes: 2 additions & 2 deletions package/motioneye/motioneye.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
#
#############################################################

MOTIONEYE_VERSION = 2979d28
MOTIONPIE_VERSION = 20140910
MOTIONEYE_VERSION = ac58873
MOTIONPIE_VERSION = 20140924
MOTIONEYE_SITE = https://bitbucket.org/ccrisan/motioneye/get/
MOTIONEYE_SOURCE = $(MOTIONEYE_VERSION).tar.gz
MOTIONEYE_LICENSE = GPLv3
Expand Down

0 comments on commit f28ca94

Please sign in to comment.