mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-29 06:06:32 +00:00
Merge pull request #1775 from ccrisan/thingos-next
Improve boot init scripts & more
This commit is contained in:
commit
39dfdccc5a
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cp $IMG_DIR/rootfs.cpio.uboot $BOARD_DIR/uInitrd
|
cp ${IMG_DIR}/rootfs.cpio.uboot ${BOARD_DIR}/uInitrd
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
BOARD_DIR=$(dirname $0)
|
BOARD_DIR=$(dirname $0)
|
||||||
COMMON_DIR=$BOARD_DIR/../common
|
COMMON_DIR=${BOARD_DIR}/../common
|
||||||
|
|
||||||
export BOARD=$(basename $BOARD_DIR)
|
export BOARD=$(basename ${BOARD_DIR})
|
||||||
export IMG_DIR=$BOARD_DIR/../../output/$BOARD/images/
|
export IMG_DIR=${BOARD_DIR}/../../output/${BOARD}/images/
|
||||||
export UBOOT_BIN=$IMG_DIR/u-boot-sunxi-with-spl.bin
|
export UBOOT_BIN=${IMG_DIR}/u-boot-sunxi-with-spl.bin
|
||||||
export UBOOT_SEEK=16
|
export UBOOT_SEEK=16
|
||||||
|
|
||||||
$COMMON_DIR/mkimage.sh
|
${COMMON_DIR}/mkimage.sh
|
||||||
|
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
UBOOT_HOST_DIR=$TARGET/../build/host-uboot-tools-*
|
UBOOT_HOST_DIR=${TARGET}/../build/host-uboot-tools-*
|
||||||
|
|
||||||
cp $IMG_DIR/uImage $BOOT_DIR
|
cp ${IMG_DIR}/uImage ${BOOT_DIR}
|
||||||
cp $IMG_DIR/sun7i-a20-bananapi.dtb $BOOT_DIR
|
cp ${IMG_DIR}/sun7i-a20-bananapi.dtb ${BOOT_DIR}
|
||||||
|
|
||||||
$UBOOT_HOST_DIR/tools/mkimage -C none -A arm -T script -d $BOARD_DIR/boot.cmd $BOOT_DIR/boot.scr
|
${UBOOT_HOST_DIR}/tools/mkimage -C none -A arm -T script -d ${BOARD_DIR}/boot.cmd ${BOOT_DIR}/boot.scr
|
||||||
$UBOOT_HOST_DIR/tools/mkimage -C none -A arm -T script -d $BOARD_DIR/boot-fwupdater.cmd $BOOT_DIR/boot-fwupdater.scr
|
${UBOOT_HOST_DIR}/tools/mkimage -C none -A arm -T script -d ${BOARD_DIR}/boot-fwupdater.cmd ${BOOT_DIR}/boot-fwupdater.scr
|
||||||
|
|
||||||
cp $BOARD_DIR/uInitrd $BOOT_DIR
|
cp ${BOARD_DIR}/uInitrd ${BOOT_DIR}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Automatically generated make config: don't edit
|
# Automatically generated make config: don't edit
|
||||||
# Busybox version: 1.29.2
|
# Busybox version: 1.29.2
|
||||||
# Wed Nov 14 23:22:52 2018
|
# Fri Jan 25 20:24:12 2019
|
||||||
#
|
#
|
||||||
CONFIG_HAVE_DOT_CONFIG=y
|
CONFIG_HAVE_DOT_CONFIG=y
|
||||||
|
|
||||||
@ -525,7 +525,7 @@ CONFIG_FEATURE_NOLOGIN=y
|
|||||||
CONFIG_FEATURE_SECURETTY=y
|
CONFIG_FEATURE_SECURETTY=y
|
||||||
CONFIG_PASSWD=y
|
CONFIG_PASSWD=y
|
||||||
# CONFIG_FEATURE_PASSWD_WEAK_CHECK is not set
|
# CONFIG_FEATURE_PASSWD_WEAK_CHECK is not set
|
||||||
# CONFIG_SU is not set
|
CONFIG_SU=y
|
||||||
# CONFIG_FEATURE_SU_SYSLOG is not set
|
# CONFIG_FEATURE_SU_SYSLOG is not set
|
||||||
# CONFIG_FEATURE_SU_CHECKS_SHELLS is not set
|
# CONFIG_FEATURE_SU_CHECKS_SHELLS is not set
|
||||||
# CONFIG_FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY is not set
|
# CONFIG_FEATURE_SU_BLANK_PW_NEEDS_SECURE_TTY is not set
|
||||||
|
@ -1,212 +1,221 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if [ -z "$TARGET" ]; then
|
if [ -z "${TARGET}" ]; then
|
||||||
echo "this script must be invoked from postscript.sh"
|
echo "this script must be invoked from postscript.sh"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
find $TARGET -name '.empty' | xargs -r rm
|
find ${TARGET} -name '.empty' | xargs -r rm
|
||||||
|
|
||||||
# /etc stuff
|
# /etc stuff
|
||||||
rm -rf $TARGET/etc/network/
|
rm -rf ${TARGET}/etc/network/
|
||||||
rm -rf $TARGET/etc/dhcp/
|
rm -rf ${TARGET}/etc/dhcp/
|
||||||
rm -rf $TARGET/etc/ssh/
|
rm -rf ${TARGET}/etc/ssh/
|
||||||
rm -rf $TARGET/etc/rc_keymaps/
|
rm -rf ${TARGET}/etc/rc_keymaps/
|
||||||
rm -rf $TARGET/etc/default/
|
rm -rf ${TARGET}/etc/default/
|
||||||
rm -rf $TARGET/etc/ctdb/
|
rm -rf ${TARGET}/etc/ctdb/
|
||||||
rm -rf $TARGET/etc/sudoers.d/
|
rm -rf ${TARGET}/etc/sudoers.d/
|
||||||
rm -rf $TARGET/etc/ssl/man
|
rm -rf ${TARGET}/etc/ssl/man
|
||||||
rm -rf $TARGET/etc/ssl/misc
|
rm -rf ${TARGET}/etc/ssl/misc
|
||||||
rm -rf $TARGET/etc/ssl/private
|
rm -rf ${TARGET}/etc/ssl/private
|
||||||
rm -rf $TARGET/etc/logrotate.d
|
rm -rf ${TARGET}/etc/logrotate.d
|
||||||
|
|
||||||
rm -f $TARGET/etc/rc_maps.cfg
|
rm -f ${TARGET}/etc/rc_maps.cfg
|
||||||
rm -f $TARGET/etc/udev/hwdb.d/20-pci-vendor-model.hwdb
|
rm -f ${TARGET}/etc/udev/hwdb.d/20-pci-vendor-model.hwdb
|
||||||
rm -f $TARGET/etc/hostname
|
rm -f ${TARGET}/etc/hostname
|
||||||
rm -f $TARGET/etc/os-release
|
rm -f ${TARGET}/etc/os-release
|
||||||
rm -f $TARGET/etc/hostapd.conf
|
rm -f ${TARGET}/etc/hostapd.conf
|
||||||
|
|
||||||
# /usr/share stuff
|
# /usr/share stuff
|
||||||
rm -rf $TARGET/usr/share/bash-completion/
|
rm -rf ${TARGET}/usr/share/bash-completion/
|
||||||
rm -rf $TARGET/usr/share/locale/*
|
rm -rf ${TARGET}/usr/share/locale/*
|
||||||
rm -rf $TARGET/usr/share/ffmpeg/
|
rm -rf ${TARGET}/usr/share/ffmpeg/
|
||||||
rm -rf $TARGET/usr/share/perl5/
|
rm -rf ${TARGET}/usr/share/perl5/
|
||||||
rm -rf $TARGET/usr/share/common-lisp/
|
rm -rf ${TARGET}/usr/share/common-lisp/
|
||||||
|
|
||||||
# various binaries
|
# various binaries
|
||||||
rm -f $TARGET/bin/more
|
rm -f ${TARGET}/bin/more
|
||||||
rm -f $TARGET/bin/wdctl
|
rm -f ${TARGET}/bin/wdctl
|
||||||
rm -f $TARGET/usr/sbin/readprofile
|
rm -f ${TARGET}/usr/sbin/readprofile
|
||||||
rm -f $TARGET/sbin/nologin
|
rm -f ${TARGET}/sbin/nologin
|
||||||
rm -f $TARGET/bin/mountpoint
|
rm -f ${TARGET}/bin/mountpoint
|
||||||
rm -f $TARGET/sbin/ldattach
|
rm -f ${TARGET}/sbin/ldattach
|
||||||
rm -f $TARGET/usr/sbin/ldattach
|
rm -f ${TARGET}/usr/sbin/ldattach
|
||||||
rm -f $TARGET/sbin/slattach
|
rm -f ${TARGET}/sbin/slattach
|
||||||
rm -f $TARGET/sbin/plipconfig
|
rm -f ${TARGET}/sbin/plipconfig
|
||||||
rm -f $TARGET/sbin/fstrim
|
rm -f ${TARGET}/sbin/fstrim
|
||||||
rm -f $TARGET/usr/sbin/rtcwake
|
rm -f ${TARGET}/usr/sbin/rtcwake
|
||||||
rm -f $TARGET/bin/lsblk
|
rm -f ${TARGET}/bin/lsblk
|
||||||
rm -f $TARGET/usr/bin/col
|
rm -f ${TARGET}/usr/bin/col
|
||||||
rm -f $TARGET/sbin/fdformat
|
rm -f ${TARGET}/sbin/fdformat
|
||||||
rm -f $TARGET/sbin/ctrlaltdel
|
rm -f ${TARGET}/sbin/ctrlaltdel
|
||||||
rm -f $TARGET/bin/findmnt
|
rm -f ${TARGET}/bin/findmnt
|
||||||
rm -f $TARGET/usr/bin/colcrt
|
rm -f ${TARGET}/usr/bin/colcrt
|
||||||
rm -f $TARGET/sbin/fsfreeze
|
rm -f ${TARGET}/sbin/fsfreeze
|
||||||
rm -f $TARGET/usr/bin/colrm
|
rm -f ${TARGET}/usr/bin/colrm
|
||||||
rm -f $TARGET/usr/sbin/addpart
|
rm -f ${TARGET}/usr/sbin/addpart
|
||||||
rm -f $TARGET/sbin/blkdiscard
|
rm -f ${TARGET}/sbin/blkdiscard
|
||||||
rm -f $TARGET/usr/sbin/delpart
|
rm -f ${TARGET}/usr/sbin/delpart
|
||||||
rm -f $TARGET/usr/bin/column
|
rm -f ${TARGET}/usr/bin/column
|
||||||
rm -f $TARGET/sbin/swapon
|
rm -f ${TARGET}/sbin/swapon
|
||||||
rm -f $TARGET/usr/sbin/resizepart
|
rm -f ${TARGET}/usr/sbin/resizepart
|
||||||
rm -f $TARGET/usr/bin/hexdump
|
rm -f ${TARGET}/usr/bin/hexdump
|
||||||
rm -f $TARGET/sbin/swapoff
|
rm -f ${TARGET}/sbin/swapoff
|
||||||
rm -f $TARGET/usr/bin/rev
|
rm -f ${TARGET}/usr/bin/rev
|
||||||
rm -f $TARGET/sbin/chcpu
|
rm -f ${TARGET}/sbin/chcpu
|
||||||
rm -f $TARGET/usr/bin/tailf
|
rm -f ${TARGET}/usr/bin/tailf
|
||||||
rm -f $TARGET/usr/bin/pg
|
rm -f ${TARGET}/usr/bin/pg
|
||||||
rm -f $TARGET/sbin/blkid
|
rm -f ${TARGET}/sbin/blkid
|
||||||
rm -f $TARGET/usr/bin/ul
|
rm -f ${TARGET}/usr/bin/ul
|
||||||
rm -f $TARGET/sbin/findfs
|
rm -f ${TARGET}/sbin/findfs
|
||||||
rm -f $TARGET/sbin/wipefs
|
rm -f ${TARGET}/sbin/wipefs
|
||||||
rm -f $TARGET/usr/bin/script
|
rm -f ${TARGET}/usr/bin/script
|
||||||
rm -f $TARGET/usr/bin/scriptreplay
|
rm -f ${TARGET}/usr/bin/scriptreplay
|
||||||
rm -f $TARGET/sbin/fsck.minix
|
rm -f ${TARGET}/sbin/fsck.minix
|
||||||
rm -f $TARGET/sbin/mkfs.minix
|
rm -f ${TARGET}/sbin/mkfs.minix
|
||||||
rm -f $TARGET/usr/bin/setterm
|
rm -f ${TARGET}/usr/bin/setterm
|
||||||
rm -f $TARGET/usr/bin/flock
|
rm -f ${TARGET}/usr/bin/flock
|
||||||
rm -f $TARGET/sbin/mkfs
|
rm -f ${TARGET}/sbin/mkfs
|
||||||
rm -f $TARGET/usr/bin/ipcmk
|
rm -f ${TARGET}/usr/bin/ipcmk
|
||||||
rm -f $TARGET/sbin/mkfs.bfs
|
rm -f ${TARGET}/sbin/mkfs.bfs
|
||||||
rm -f $TARGET/usr/bin/ipcrm
|
rm -f ${TARGET}/usr/bin/ipcrm
|
||||||
rm -f $TARGET/usr/bin/ipcs
|
rm -f ${TARGET}/usr/bin/ipcs
|
||||||
rm -f $TARGET/sbin/mkswap
|
rm -f ${TARGET}/sbin/mkswap
|
||||||
rm -f $TARGET/usr/bin/renice
|
rm -f ${TARGET}/usr/bin/renice
|
||||||
rm -f $TARGET/sbin/swaplabel
|
rm -f ${TARGET}/sbin/swaplabel
|
||||||
rm -f $TARGET/usr/bin/setsid
|
rm -f ${TARGET}/usr/bin/setsid
|
||||||
rm -f $TARGET/sbin/blockdev
|
rm -f ${TARGET}/sbin/blockdev
|
||||||
rm -f $TARGET/usr/bin/cytune
|
rm -f ${TARGET}/usr/bin/cytune
|
||||||
rm -f $TARGET/usr/bin/setarch
|
rm -f ${TARGET}/usr/bin/setarch
|
||||||
rm -f $TARGET/sbin/sfdisk
|
rm -f ${TARGET}/sbin/sfdisk
|
||||||
rm -f $TARGET/usr/bin/prlimit
|
rm -f ${TARGET}/usr/bin/prlimit
|
||||||
rm -f $TARGET/sbin/cfdisk
|
rm -f ${TARGET}/sbin/cfdisk
|
||||||
rm -f $TARGET/usr/bin/lscpu
|
rm -f ${TARGET}/usr/bin/lscpu
|
||||||
rm -f $TARGET/usr/bin/unshare
|
rm -f ${TARGET}/usr/bin/unshare
|
||||||
rm -f $TARGET/usr/bin/nsenter
|
rm -f ${TARGET}/usr/bin/nsenter
|
||||||
rm -f $TARGET/usr/bin/cal
|
rm -f ${TARGET}/usr/bin/cal
|
||||||
rm -f $TARGET/usr/bin/look
|
rm -f ${TARGET}/usr/bin/look
|
||||||
rm -f $TARGET/usr/bin/mcookie
|
rm -f ${TARGET}/usr/bin/mcookie
|
||||||
rm -f $TARGET/usr/bin/namei
|
rm -f ${TARGET}/usr/bin/namei
|
||||||
rm -f $TARGET/usr/bin/whereis
|
rm -f ${TARGET}/usr/bin/whereis
|
||||||
rm -f $TARGET/usr/bin/lslocks
|
rm -f ${TARGET}/usr/bin/lslocks
|
||||||
rm -f $TARGET/usr/bin/uuidgen
|
rm -f ${TARGET}/usr/bin/uuidgen
|
||||||
rm -f $TARGET/usr/bin/getopt
|
rm -f ${TARGET}/usr/bin/getopt
|
||||||
rm -f $TARGET/bin/isosize
|
rm -f ${TARGET}/bin/isosize
|
||||||
rm -f $TARGET/usr/sbin/fdformat
|
rm -f ${TARGET}/usr/sbin/fdformat
|
||||||
rm -f $TARGET/usr/bin/linux32
|
rm -f ${TARGET}/usr/bin/linux32
|
||||||
rm -f $TARGET/usr/bin/linux64
|
rm -f ${TARGET}/usr/bin/linux64
|
||||||
rm -f $TARGET/usr/bin/uname26
|
rm -f ${TARGET}/usr/bin/uname26
|
||||||
rm -f $TARGET/bin/zcat
|
rm -f ${TARGET}/bin/zcat
|
||||||
rm -f $TARGET/bin/zcmp
|
rm -f ${TARGET}/bin/zcmp
|
||||||
rm -f $TARGET/bin/zdiff
|
rm -f ${TARGET}/bin/zdiff
|
||||||
rm -f $TARGET/bin/zegrep
|
rm -f ${TARGET}/bin/zegrep
|
||||||
rm -f $TARGET/bin/zfgrep
|
rm -f ${TARGET}/bin/zfgrep
|
||||||
rm -f $TARGET/bin/zforce
|
rm -f ${TARGET}/bin/zforce
|
||||||
rm -f $TARGET/bin/zgrep
|
rm -f ${TARGET}/bin/zgrep
|
||||||
rm -f $TARGET/bin/zless
|
rm -f ${TARGET}/bin/zless
|
||||||
rm -f $TARGET/bin/zmore
|
rm -f ${TARGET}/bin/zmore
|
||||||
rm -f $TARGET/bin/znew
|
rm -f ${TARGET}/bin/znew
|
||||||
rm -f $TARGET/bin/gzexe
|
rm -f ${TARGET}/bin/gzexe
|
||||||
rm -f $TARGET/bin/uncompress
|
rm -f ${TARGET}/bin/uncompress
|
||||||
rm -f $TARGET/usr/bin/slogin
|
rm -f ${TARGET}/usr/bin/slogin
|
||||||
rm -f $TARGET/usr/bin/ssh-keyscan
|
rm -f ${TARGET}/usr/bin/ssh-keyscan
|
||||||
rm -f $TARGET/usr/bin/ssh-add
|
rm -f ${TARGET}/usr/bin/ssh-add
|
||||||
rm -f $TARGET/usr/bin/ssh-agent
|
rm -f ${TARGET}/usr/bin/ssh-agent
|
||||||
rm -f $TARGET/usr/bin/xmllint
|
rm -f ${TARGET}/usr/bin/xmllint
|
||||||
|
|
||||||
rm -f $TARGET/usr/libexec/ssh-keysign
|
rm -f ${TARGET}/usr/libexec/ssh-keysign
|
||||||
rm -f $TARGET/usr/libexec/ssh-pkcs11-helper
|
rm -f ${TARGET}/usr/libexec/ssh-pkcs11-helper
|
||||||
rm -f $TARGET/usr/libexec/rmt
|
rm -f ${TARGET}/usr/libexec/rmt
|
||||||
|
|
||||||
# samba4 unneeded stuff
|
# samba4 unneeded stuff
|
||||||
rm -f $TARGET/usr/bin/cifsdd
|
rm -f ${TARGET}/usr/bin/cifsdd
|
||||||
rm -f $TARGET/usr/bin/containers_*
|
rm -f ${TARGET}/usr/bin/containers_*
|
||||||
rm -f $TARGET/usr/bin/ctdb*
|
rm -f ${TARGET}/usr/bin/ctdb*
|
||||||
rm -f $TARGET/usr/bin/dbwrap_tool
|
rm -f ${TARGET}/usr/bin/dbwrap_tool
|
||||||
rm -f $TARGET/usr/bin/eventlogadm
|
rm -f ${TARGET}/usr/bin/eventlogadm
|
||||||
rm -f $TARGET/usr/bin/event_rpcgen.py
|
rm -f ${TARGET}/usr/bin/event_rpcgen.py
|
||||||
rm -f $TARGET/usr/bin/gentest
|
rm -f ${TARGET}/usr/bin/gentest
|
||||||
rm -f $TARGET/usr/bin/ldb*
|
rm -f ${TARGET}/usr/bin/ldb*
|
||||||
rm -f $TARGET/usr/bin/locktest
|
rm -f ${TARGET}/usr/bin/locktest
|
||||||
rm -f $TARGET/usr/bin/ltdbtool
|
rm -f ${TARGET}/usr/bin/ltdbtool
|
||||||
rm -f $TARGET/usr/bin/masktest
|
rm -f ${TARGET}/usr/bin/masktest
|
||||||
rm -f $TARGET/usr/bin/ndrdump
|
rm -f ${TARGET}/usr/bin/ndrdump
|
||||||
rm -f $TARGET/usr/bin/net
|
rm -f ${TARGET}/usr/bin/net
|
||||||
rm -f $TARGET/usr/bin/ntdb*
|
rm -f ${TARGET}/usr/bin/ntdb*
|
||||||
rm -f $TARGET/usr/bin/ntlm_auth
|
rm -f ${TARGET}/usr/bin/ntlm_auth
|
||||||
rm -f $TARGET/usr/bin/oLschema2ldif
|
rm -f ${TARGET}/usr/bin/oLschema2ldif
|
||||||
rm -f $TARGET/usr/bin/onnode
|
rm -f ${TARGET}/usr/bin/onnode
|
||||||
rm -f $TARGET/usr/bin/pdbedit
|
rm -f ${TARGET}/usr/bin/pdbedit
|
||||||
rm -f $TARGET/usr/bin/pidl
|
rm -f ${TARGET}/usr/bin/pidl
|
||||||
rm -f $TARGET/usr/bin/ping_pong
|
rm -f ${TARGET}/usr/bin/ping_pong
|
||||||
rm -f $TARGET/usr/bin/profiles
|
rm -f ${TARGET}/usr/bin/profiles
|
||||||
rm -f $TARGET/usr/bin/reg*
|
rm -f ${TARGET}/usr/bin/reg*
|
||||||
rm -f $TARGET/usr/bin/rpcclient
|
rm -f ${TARGET}/usr/bin/rpcclient
|
||||||
rm -f $TARGET/usr/bin/samba-regedit
|
rm -f ${TARGET}/usr/bin/samba-regedit
|
||||||
rm -f $TARGET/usr/bin/sharesec
|
rm -f ${TARGET}/usr/bin/sharesec
|
||||||
rm -f $TARGET/usr/bin/smbcacls
|
rm -f ${TARGET}/usr/bin/smbcacls
|
||||||
rm -f $TARGET/usr/bin/smbcontrol
|
rm -f ${TARGET}/usr/bin/smbcontrol
|
||||||
rm -f $TARGET/usr/bin/smbcquotas
|
rm -f ${TARGET}/usr/bin/smbcquotas
|
||||||
rm -f $TARGET/usr/bin/smbget
|
rm -f ${TARGET}/usr/bin/smbget
|
||||||
rm -f $TARGET/usr/bin/smbspool
|
rm -f ${TARGET}/usr/bin/smbspool
|
||||||
rm -f $TARGET/usr/bin/smbstatus
|
rm -f ${TARGET}/usr/bin/smbstatus
|
||||||
rm -f $TARGET/usr/bin/smbta-util
|
rm -f ${TARGET}/usr/bin/smbta-util
|
||||||
rm -f $TARGET/usr/bin/smbtar
|
rm -f ${TARGET}/usr/bin/smbtar
|
||||||
rm -f $TARGET/usr/bin/smbtree
|
rm -f ${TARGET}/usr/bin/smbtree
|
||||||
rm -f $TARGET/usr/bin/smnotify
|
rm -f ${TARGET}/usr/bin/smnotify
|
||||||
rm -f $TARGET/usr/bin/tdb*
|
rm -f ${TARGET}/usr/bin/tdb*
|
||||||
rm -f $TARGET/usr/bin/testparm
|
rm -f ${TARGET}/usr/bin/testparm
|
||||||
rm -f $TARGET/usr/bin/wbinfo
|
rm -f ${TARGET}/usr/bin/wbinfo
|
||||||
rm -f $TARGET/usr/sbin/winbindd
|
rm -f ${TARGET}/usr/sbin/winbindd
|
||||||
rm -rf $TARGET/usr/share/ctdb
|
rm -rf ${TARGET}/usr/share/ctdb
|
||||||
|
|
||||||
# useless mongodb binaries
|
# unused mongodb binaries
|
||||||
rm -f $TARGET/usr/bin/mongos
|
rm -f ${TARGET}/usr/bin/mongos
|
||||||
rm -f $TARGET/usr/bin/mongoperf
|
rm -f ${TARGET}/usr/bin/mongoperf
|
||||||
|
|
||||||
|
# unused redis binaries
|
||||||
|
rm -f $TARGET/usr/bin/redis-check-aof
|
||||||
|
rm -f $TARGET/usr/bin/redis-check-rdb
|
||||||
|
rm -f $TARGET/usr/bin/redis-benchmark
|
||||||
|
rm -f $TARGET/usr/bin/redis-cli
|
||||||
|
rm -f $TARGET/usr/bin/redis-sentinel
|
||||||
|
|
||||||
# v4l-utils
|
# v4l-utils
|
||||||
rm -f $TARGET/usr/bin/cec-compliance
|
rm -f ${TARGET}/usr/bin/cec-compliance
|
||||||
rm -f $TARGET/usr/bin/cec-ctl
|
rm -f ${TARGET}/usr/bin/cec-ctl
|
||||||
rm -f $TARGET/usr/bin/cec-follower
|
rm -f ${TARGET}/usr/bin/cec-follower
|
||||||
rm -f $TARGET/usr/bin/dvb-fe-tool
|
rm -f ${TARGET}/usr/bin/dvb-fe-tool
|
||||||
rm -f $TARGET/usr/bin/dvb-format-convert
|
rm -f ${TARGET}/usr/bin/dvb-format-convert
|
||||||
rm -f $TARGET/usr/bin/dvbv5-daemon
|
rm -f ${TARGET}/usr/bin/dvbv5-daemon
|
||||||
rm -f $TARGET/usr/bin/dvbv5-scan
|
rm -f ${TARGET}/usr/bin/dvbv5-scan
|
||||||
rm -f $TARGET/usr/bin/dvbv5-zap
|
rm -f ${TARGET}/usr/bin/dvbv5-zap
|
||||||
rm -f $TARGET/usr/bin/media-ctl
|
rm -f ${TARGET}/usr/bin/media-ctl
|
||||||
rm -f $TARGET/usr/bin/rds-ctl
|
rm -f ${TARGET}/usr/bin/rds-ctl
|
||||||
rm -f $TARGET/usr/bin/v4l2-compliance
|
rm -f ${TARGET}/usr/bin/v4l2-compliance
|
||||||
|
|
||||||
# unused python folders
|
# unused python folders
|
||||||
rm -rf $TARGET/usr/lib/python2.7/site-packages/samba/
|
rm -rf ${TARGET}/usr/lib/python2.7/site-packages/samba/
|
||||||
rm -rf $TARGET/usr/lib/python2.7/ensurepip/
|
rm -rf ${TARGET}/usr/lib/python2.7/ensurepip/
|
||||||
rm -rf $TARGET/usr/lib/python2.7/config/
|
rm -rf ${TARGET}/usr/lib/python2.7/config/
|
||||||
rm -rf $TARGET/usr/lib/python2.7/unittest/
|
rm -rf ${TARGET}/usr/lib/python2.7/unittest/
|
||||||
|
|
||||||
# buildroot default startup scripts
|
# buildroot default startup scripts
|
||||||
rm -f $TARGET/etc/init.d/S01logging
|
rm -f ${TARGET}/etc/init.d/S01logging
|
||||||
rm -f $TARGET/etc/init.d/S10udev
|
rm -f ${TARGET}/etc/init.d/S10udev
|
||||||
rm -f $TARGET/etc/init.d/S15watchdog
|
rm -f ${TARGET}/etc/init.d/S15watchdog
|
||||||
rm -f $TARGET/etc/init.d/S20urandom
|
rm -f ${TARGET}/etc/init.d/S20urandom
|
||||||
rm -f $TARGET/etc/init.d/S49ntp
|
rm -f ${TARGET}/etc/init.d/S49ntp
|
||||||
rm -f $TARGET/etc/init.d/S50sshd
|
rm -f ${TARGET}/etc/init.d/S50sshd
|
||||||
rm -f $TARGET/etc/init.d/S50proftpd
|
rm -f ${TARGET}/etc/init.d/S50proftpd
|
||||||
rm -f $TARGET/etc/init.d/S80dhcp-relay
|
rm -f ${TARGET}/etc/init.d/S50postgresql
|
||||||
rm -f $TARGET/etc/init.d/S80dhcp-server
|
rm -f ${TARGET}/etc/init.d/S50redis
|
||||||
rm -f $TARGET/etc/init.d/S80dnsmasq
|
rm -f ${TARGET}/etc/init.d/S80dhcp-relay
|
||||||
rm -f $TARGET/etc/init.d/S91smb
|
rm -f ${TARGET}/etc/init.d/S80dhcp-server
|
||||||
rm -f $TARGET/etc/init.d/S99motion
|
rm -f ${TARGET}/etc/init.d/S80dnsmasq
|
||||||
|
rm -f ${TARGET}/etc/init.d/S91smb
|
||||||
|
rm -f ${TARGET}/etc/init.d/S99motion
|
||||||
|
|
||||||
# other unwanted dirs
|
# other unwanted dirs
|
||||||
rm -rf $TARGET/data/*
|
rm -rf ${TARGET}/data/*
|
||||||
rm -rf $TARGET/run
|
rm -rf ${TARGET}/run
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
if [ -z "$IMG_DIR" ] || [ -z "$BOARD" ]; then
|
if [ -z "${IMG_DIR}" ] || [ -z "${BOARD}" ]; then
|
||||||
echo "this script must be invoked from board specific mkimage.sh"
|
echo "this script must be invoked from board specific mkimage.sh"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
test "root" != "$USER" && exec sudo -E $0 "$@"
|
test "root" != "${USER}" && exec sudo -E $0 "$@"
|
||||||
|
|
||||||
function msg() {
|
function msg() {
|
||||||
echo " * $1"
|
echo " * $1"
|
||||||
@ -13,115 +13,115 @@ function msg() {
|
|||||||
|
|
||||||
BOOT_START=${BOOT_START:-1} # MB
|
BOOT_START=${BOOT_START:-1} # MB
|
||||||
|
|
||||||
BOOT_SRC=$IMG_DIR/boot
|
BOOT_SRC=${IMG_DIR}/boot
|
||||||
BOOT=$IMG_DIR/.boot
|
BOOT=${IMG_DIR}/.boot
|
||||||
BOOT_IMG=$IMG_DIR/boot.img
|
BOOT_IMG=${IMG_DIR}/boot.img
|
||||||
BOOT_SIZE="30" # MB - reserved up to 100 MB
|
BOOT_SIZE="30" # MB - reserved up to 100 MB
|
||||||
|
|
||||||
ROOT_START="100" # MB
|
ROOT_START="100" # MB
|
||||||
ROOT_SRC=$IMG_DIR/rootfs.tar
|
ROOT_SRC=${IMG_DIR}/rootfs.tar
|
||||||
ROOT=$IMG_DIR/.root
|
ROOT=${IMG_DIR}/.root
|
||||||
ROOT_IMG=$IMG_DIR/root.img
|
ROOT_IMG=${IMG_DIR}/root.img
|
||||||
ROOT_SIZE="200" # MB
|
ROOT_SIZE="200" # MB
|
||||||
|
|
||||||
GUARD_SIZE="10" # MB
|
GUARD_SIZE="10" # MB
|
||||||
DISK_SIZE=$((ROOT_START + ROOT_SIZE + GUARD_SIZE))
|
DISK_SIZE=$((ROOT_START + ROOT_SIZE + GUARD_SIZE))
|
||||||
|
|
||||||
COMMON_DIR=$(cd $IMG_DIR/../../../board/common; pwd)
|
COMMON_DIR=$(cd ${IMG_DIR}/../../../board/common; pwd)
|
||||||
OS_NAME=$(source $COMMON_DIR/overlay/etc/version && echo $os_short_name)
|
OS_NAME=$(source ${COMMON_DIR}/overlay/etc/version && echo ${OS_SHORT_NAME})
|
||||||
|
|
||||||
# boot filesystem
|
# boot filesystem
|
||||||
msg "creating boot loop device"
|
msg "creating boot loop device"
|
||||||
dd if=/dev/zero of=$BOOT_IMG bs=1M count=$BOOT_SIZE
|
dd if=/dev/zero of=${BOOT_IMG} bs=1M count=${BOOT_SIZE}
|
||||||
loop_dev=$(losetup -f --show $BOOT_IMG)
|
loop_dev=$(losetup -f --show ${BOOT_IMG})
|
||||||
|
|
||||||
msg "creating boot filesystem"
|
msg "creating boot filesystem"
|
||||||
mkfs.vfat -F16 $loop_dev
|
mkfs.vfat -F16 ${loop_dev}
|
||||||
|
|
||||||
msg "mounting boot loop device"
|
msg "mounting boot loop device"
|
||||||
mkdir -p $BOOT
|
mkdir -p ${BOOT}
|
||||||
mount -o loop $loop_dev $BOOT
|
mount -o loop ${loop_dev} ${BOOT}
|
||||||
|
|
||||||
msg "copying boot filesystem contents"
|
msg "copying boot filesystem contents"
|
||||||
cp -r $BOOT_SRC/* $BOOT
|
cp -r ${BOOT_SRC}/* ${BOOT}
|
||||||
sync
|
sync
|
||||||
|
|
||||||
msg "unmounting boot filesystem"
|
msg "unmounting boot filesystem"
|
||||||
umount $BOOT
|
umount ${BOOT}
|
||||||
|
|
||||||
msg "destroying boot loop device ($loop_dev)"
|
msg "destroying boot loop device (${loop_dev})"
|
||||||
losetup -d $loop_dev
|
losetup -d ${loop_dev}
|
||||||
sync
|
sync
|
||||||
|
|
||||||
# root filesystem
|
# root filesystem
|
||||||
msg "creating root loop device"
|
msg "creating root loop device"
|
||||||
dd if=/dev/zero of=$ROOT_IMG bs=1M count=$ROOT_SIZE
|
dd if=/dev/zero of=${ROOT_IMG} bs=1M count=${ROOT_SIZE}
|
||||||
loop_dev=$(losetup -f --show $ROOT_IMG)
|
loop_dev=$(losetup -f --show ${ROOT_IMG})
|
||||||
|
|
||||||
msg "creating root filesystem"
|
msg "creating root filesystem"
|
||||||
mkfs.ext4 $loop_dev
|
mkfs.ext4 ${loop_dev}
|
||||||
tune2fs -O^has_journal $loop_dev
|
tune2fs -O^has_journal ${loop_dev}
|
||||||
|
|
||||||
msg "mounting root loop device"
|
msg "mounting root loop device"
|
||||||
mkdir -p $ROOT
|
mkdir -p ${ROOT}
|
||||||
mount -o loop $loop_dev $ROOT
|
mount -o loop ${loop_dev} ${ROOT}
|
||||||
|
|
||||||
msg "copying root filesystem contents"
|
msg "copying root filesystem contents"
|
||||||
tar -xpsf $ROOT_SRC -C $ROOT
|
tar -xpsf ${ROOT_SRC} -C ${ROOT}
|
||||||
|
|
||||||
# set internal OS name, prefix and version according to env variables
|
# set internal OS name, prefix and version according to env variables
|
||||||
if [ -f $ROOT/etc/version ]; then
|
if [ -f ${ROOT}/etc/version ]; then
|
||||||
if [ -n "$THINGOS_NAME" ]; then
|
if [ -n "${THINGOS_NAME}" ]; then
|
||||||
msg "setting OS name to $THINGOS_NAME"
|
msg "setting OS name to ${THINGOS_NAME}"
|
||||||
sed -ri "s/os_name=\".*\"/os_name=\"$THINGOS_NAME\"/" $ROOT/etc/version
|
sed -ri "s/OS_NAME=\".*\"/OS_NAME=\"${THINGOS_NAME}\"/" ${ROOT}/etc/version
|
||||||
fi
|
fi
|
||||||
if [ -n "$THINGOS_SHORT_NAME" ]; then
|
if [ -n "${THINGOS_SHORT_NAME}" ]; then
|
||||||
msg "setting OS short name to $THINGOS_SHORT_NAME"
|
msg "setting OS short name to ${THINGOS_SHORT_NAME}"
|
||||||
sed -ri "s/os_short_name=\".*\"/os_short_name=\"$THINGOS_SHORT_NAME\"/" $ROOT/etc/version
|
sed -ri "s/OS_SHORT_NAME=\".*\"/OS_SHORT_NAME=\"${THINGOS_SHORT_NAME}\"/" ${ROOT}/etc/version
|
||||||
fi
|
fi
|
||||||
if [ -n "$THINGOS_PREFIX" ]; then
|
if [ -n "${THINGOS_PREFIX}" ]; then
|
||||||
msg "setting OS prefix to $THINGOS_PREFIX"
|
msg "setting OS prefix to ${THINGOS_PREFIX}"
|
||||||
sed -ri "s/os_prefix=\".*\"/os_prefix=\"$THINGOS_PREFIX\"/" $ROOT/etc/version
|
sed -ri "s/OS_PREFIX=\".*\"/OS_PREFIX=\"${THINGOS_PREFIX}\"/" ${ROOT}/etc/version
|
||||||
fi
|
fi
|
||||||
if [ -n "$THINGOS_VERSION" ]; then
|
if [ -n "${THINGOS_VERSION}" ]; then
|
||||||
msg "setting OS version to $THINGOS_VERSION"
|
msg "setting OS version to ${THINGOS_VERSION}"
|
||||||
sed -ri "s/os_version=\".*\"/os_version=\"$THINGOS_VERSION\"/" $ROOT/etc/version
|
sed -ri "s/OS_VERSION=\".*\"/OS_VERSION=\"${THINGOS_VERSION}\"/" ${ROOT}/etc/version
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg "unmounting root filesystem"
|
msg "unmounting root filesystem"
|
||||||
umount $ROOT
|
umount ${ROOT}
|
||||||
|
|
||||||
msg "destroying root loop device ($loop_dev)"
|
msg "destroying root loop device (${loop_dev})"
|
||||||
losetup -d $loop_dev
|
losetup -d ${loop_dev}
|
||||||
sync
|
sync
|
||||||
|
|
||||||
DISK_IMG=$IMG_DIR/disk.img
|
DISK_IMG=${IMG_DIR}/disk.img
|
||||||
BOOT_IMG=$IMG_DIR/boot.img
|
BOOT_IMG=${IMG_DIR}/boot.img
|
||||||
ROOT_IMG=$IMG_DIR/root.img
|
ROOT_IMG=${IMG_DIR}/root.img
|
||||||
|
|
||||||
if ! [ -r $BOOT_IMG ]; then
|
if ! [ -r ${BOOT_IMG} ]; then
|
||||||
echo "boot image missing"
|
echo "boot image missing"
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -r $ROOT_IMG ]; then
|
if ! [ -r ${ROOT_IMG} ]; then
|
||||||
echo "root image missing"
|
echo "root image missing"
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# disk image
|
# disk image
|
||||||
msg "creating disk loop device"
|
msg "creating disk loop device"
|
||||||
dd if=/dev/zero of=$DISK_IMG bs=1M count=$DISK_SIZE
|
dd if=/dev/zero of=${DISK_IMG} bs=1M count=${DISK_SIZE}
|
||||||
if [ -n "$UBOOT_BIN" ] && [ -n "$UBOOT_SEEK" ]; then
|
if [ -n "${UBOOT_BIN}" ] && [ -n "${UBOOT_SEEK}" ]; then
|
||||||
msg "copying u-boot image"
|
msg "copying u-boot image"
|
||||||
dd conv=notrunc if=$UBOOT_BIN of=$DISK_IMG bs=512 seek=$UBOOT_SEEK
|
dd conv=notrunc if=${UBOOT_BIN} of=${DISK_IMG} bs=512 seek=${UBOOT_SEEK}
|
||||||
fi
|
fi
|
||||||
loop_dev=$(losetup -f --show $DISK_IMG)
|
loop_dev=$(losetup -f --show ${DISK_IMG})
|
||||||
|
|
||||||
msg "partitioning disk"
|
msg "partitioning disk"
|
||||||
set +e
|
set +e
|
||||||
fdisk -u=sectors $loop_dev <<END
|
fdisk -u=sectors ${loop_dev} <<END
|
||||||
o
|
o
|
||||||
n
|
n
|
||||||
p
|
p
|
||||||
@ -145,36 +145,36 @@ set -e
|
|||||||
sync
|
sync
|
||||||
|
|
||||||
msg "reading partition offsets"
|
msg "reading partition offsets"
|
||||||
boot_offs=$(fdisk -u=sectors -l $loop_dev | grep -E 'loop([[:digit:]])+p1' | tr -d '*' | tr -s ' ' | cut -d ' ' -f 2)
|
boot_offs=$(fdisk -u=sectors -l ${loop_dev} | grep -E 'loop([[:digit:]])+p1' | tr -d '*' | tr -s ' ' | cut -d ' ' -f 2)
|
||||||
root_offs=$(fdisk -u=sectors -l $loop_dev | grep -E 'loop([[:digit:]])+p2' | tr -d '*' | tr -s ' ' | cut -d ' ' -f 2)
|
root_offs=$(fdisk -u=sectors -l ${loop_dev} | grep -E 'loop([[:digit:]])+p2' | tr -d '*' | tr -s ' ' | cut -d ' ' -f 2)
|
||||||
|
|
||||||
msg "destroying disk loop device ($loop_dev)"
|
msg "destroying disk loop device (${loop_dev})"
|
||||||
losetup -d $loop_dev
|
losetup -d ${loop_dev}
|
||||||
|
|
||||||
msg "creating boot loop device"
|
msg "creating boot loop device"
|
||||||
loop_dev=$(losetup -f --show -o $(($boot_offs * 512)) $DISK_IMG)
|
loop_dev=$(losetup -f --show -o $((${boot_offs} * 512)) ${DISK_IMG})
|
||||||
|
|
||||||
msg "copying boot image"
|
msg "copying boot image"
|
||||||
dd if=$BOOT_IMG of=$loop_dev
|
dd if=${BOOT_IMG} of=${loop_dev}
|
||||||
sync
|
sync
|
||||||
|
|
||||||
msg "destroying boot loop device ($loop_dev)"
|
msg "destroying boot loop device (${loop_dev})"
|
||||||
losetup -d $loop_dev
|
losetup -d ${loop_dev}
|
||||||
|
|
||||||
msg "creating root loop device"
|
msg "creating root loop device"
|
||||||
loop_dev=$(losetup -f --show -o $(($root_offs * 512)) $DISK_IMG)
|
loop_dev=$(losetup -f --show -o $((${root_offs} * 512)) ${DISK_IMG})
|
||||||
sync
|
sync
|
||||||
|
|
||||||
msg "copying root image"
|
msg "copying root image"
|
||||||
dd if=$ROOT_IMG of=$loop_dev
|
dd if=${ROOT_IMG} of=${loop_dev}
|
||||||
sync
|
sync
|
||||||
|
|
||||||
msg "destroying root loop device ($loop_dev)"
|
msg "destroying root loop device (${loop_dev})"
|
||||||
losetup -d $loop_dev
|
losetup -d ${loop_dev}
|
||||||
sync
|
sync
|
||||||
|
|
||||||
mv $DISK_IMG $(dirname $DISK_IMG)/$OS_NAME-$BOARD.img
|
mv ${DISK_IMG} $(dirname ${DISK_IMG})/${OS_NAME}-${BOARD}.img
|
||||||
DISK_IMG=$(dirname $DISK_IMG)/$OS_NAME-$BOARD.img
|
DISK_IMG=$(dirname ${DISK_IMG})/${OS_NAME}-${BOARD}.img
|
||||||
|
|
||||||
msg "$(realpath "$DISK_IMG") is ready"
|
msg "$(realpath "${DISK_IMG}") is ready"
|
||||||
|
|
||||||
|
@ -25,20 +25,20 @@ fi
|
|||||||
msg "Waiting for sdcard"
|
msg "Waiting for sdcard"
|
||||||
count=0
|
count=0
|
||||||
while true; do
|
while true; do
|
||||||
if [ $count -ge $DISK_TIMEOUT ]; then
|
if [ ${count} -ge ${DISK_TIMEOUT} ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
if [ -b $ROOT_DEV ]; then
|
if [ -b ${ROOT_DEV} ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
count=$(($count + 1))
|
count=$((${count} + 1))
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
msg "Disk device is $DISK_DEV"
|
msg "Disk device is ${DISK_DEV}"
|
||||||
msg "Boot device is $BOOT_DEV"
|
msg "Boot device is ${BOOT_DEV}"
|
||||||
msg "Root device is $ROOT_DEV"
|
msg "Root device is ${ROOT_DEV}"
|
||||||
msg "Data device is $DATA_DEV"
|
msg "Data device is ${DATA_DEV}"
|
||||||
|
|
||||||
FW_DIR=/data/.fwupdate
|
FW_DIR=/data/.fwupdate
|
||||||
FW_FILE=firmware.img.gz
|
FW_FILE=firmware.img.gz
|
||||||
@ -74,41 +74,41 @@ if [ -x /prepare_initramfs ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
msg "Mounting boot partition"
|
msg "Mounting boot partition"
|
||||||
mount $BOOT_DEV /boot
|
mount ${BOOT_DEV} /boot
|
||||||
|
|
||||||
msg "Mounting data partition"
|
msg "Mounting data partition"
|
||||||
mount $DATA_DEV /data
|
mount ${DATA_DEV} /data
|
||||||
|
|
||||||
if ! [ -r $FW_DIR/$FW_FILE_EXTR ]; then
|
if ! [ -r ${FW_DIR}/${FW_FILE_EXTR} ]; then
|
||||||
if [ -r $LEGACY_FW_DIR/$LEGACY_FW_FILE_EXTR ]; then
|
if [ -r ${LEGACY_FW_DIR}/${LEGACY_FW_FILE_EXTR} ]; then
|
||||||
msg "Detected legacy firmware path"
|
msg "Detected legacy firmware path"
|
||||||
mkdir -p $FW_DIR
|
mkdir -p ${FW_DIR}
|
||||||
mv $LEGACY_FW_DIR/$LEGACY_FW_FILE_EXTR $FW_DIR/$FW_FILE_EXTR
|
mv ${LEGACY_FW_DIR}/${LEGACY_FW_FILE_EXTR} ${FW_DIR}/${FW_FILE_EXTR}
|
||||||
|
|
||||||
msg "Computing root partition info"
|
msg "Computing root partition info"
|
||||||
root_start=$(fdisk -l $FW_DIR/$FW_FILE_EXTR | grep ${FW_FILE_EXTR}2 | tr -s ' ' | cut -d ' ' -f 4)
|
root_start=$(fdisk -l ${FW_DIR}/${FW_FILE_EXTR} | grep ${FW_FILE_EXTR}2 | tr -s ' ' | cut -d ' ' -f 4)
|
||||||
root_start=$(($root_start / 2048))
|
root_start=$((${root_start} / 2048))
|
||||||
root_size=$(fdisk -l $FW_DIR/$FW_FILE_EXTR | grep ${FW_FILE_EXTR}2 | tr -s ' ' | cut -d ' ' -f 6)
|
root_size=$(fdisk -l ${FW_DIR}/${FW_FILE_EXTR} | grep ${FW_FILE_EXTR}2 | tr -s ' ' | cut -d ' ' -f 6)
|
||||||
root_size=$(($root_size / 2048))
|
root_size=$((${root_size} / 2048))
|
||||||
|
|
||||||
echo $root_start $root_size > $FW_DIR/$ROOT_INFO_FILE
|
echo ${root_start} ${root_size} > ${FW_DIR}/${ROOT_INFO_FILE}
|
||||||
else
|
else
|
||||||
msg "No firmware found, aborting"
|
msg "No firmware found, aborting"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -r $FW_DIR/$ROOT_INFO_FILE ]; then
|
if ! [ -r ${FW_DIR}/${ROOT_INFO_FILE} ]; then
|
||||||
msg "No root partition info, aborting"
|
msg "No root partition info, aborting"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg "Copying root image"
|
msg "Copying root image"
|
||||||
root_start=$(cat $FW_DIR/$ROOT_INFO_FILE | cut -d ' ' -f 1)
|
root_start=$(cat ${FW_DIR}/${ROOT_INFO_FILE} | cut -d ' ' -f 1)
|
||||||
root_size=$(cat $FW_DIR/$ROOT_INFO_FILE | cut -d ' ' -f 2)
|
root_size=$(cat ${FW_DIR}/${ROOT_INFO_FILE} | cut -d ' ' -f 2)
|
||||||
|
|
||||||
dd if=$FW_DIR/$FW_FILE_EXTR skip=$root_start of=$ROOT_DEV bs=1048576 count=$root_size || exit 1
|
dd if=${FW_DIR}/${FW_FILE_EXTR} skip=${root_start} of=${ROOT_DEV} bs=1048576 count=${root_size} || exit 1
|
||||||
|
|
||||||
msg "Cleaning up"
|
msg "Cleaning up"
|
||||||
rm -rf $FW_DIR
|
rm -rf ${FW_DIR}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
mkdir -p /var/lib/samba/private
|
mkdir -p /var/lib/samba/private
|
||||||
echo -e "$PASSWORD\n$PASSWORD\n" | /usr/bin/smbpasswd -a admin -s > /dev/null
|
echo -e "${PASSWORD}\n${PASSWORD}\n" | /usr/bin/smbpasswd -a admin -s > /dev/null
|
||||||
|
|
||||||
|
@ -1,26 +1,26 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
msg_begin "Detecting disk device"
|
msg_begin "Detecting disk device"
|
||||||
root_dev=$(cat /proc/cmdline | grep -oE 'root=[/a-z0-9]+' | cut -d '=' -f 2)
|
root_dev=$(cat /proc/cmdline | grep -oE 'root=[/a-z0-9]+' | cut -d '=' -f 2)
|
||||||
if [[ "$root_dev" =~ ^([/a-z0-9]+)(p[0-9])$ ]]; then # e.g. /dev/mmcblk0p2
|
if [[ "${root_dev}" =~ ^([/a-z0-9]+)(p[0-9])$ ]]; then # e.g. /dev/mmcblk0p2
|
||||||
disk_dev=${BASH_REMATCH[1]}
|
disk_dev=${BASH_REMATCH[1]}
|
||||||
boot_dev=${disk_dev}p1
|
boot_dev=${disk_dev}p1
|
||||||
data_dev=${disk_dev}p3
|
data_dev=${disk_dev}p3
|
||||||
elif [[ "$root_dev" =~ ^([/a-z0-9]+)([0-9])$ ]]; then # e.g. /dev/sdc2
|
elif [[ "${root_dev}" =~ ^([/a-z0-9]+)([0-9])$ ]]; then # e.g. /dev/sdc2
|
||||||
disk_dev=${BASH_REMATCH[1]}
|
disk_dev=${BASH_REMATCH[1]}
|
||||||
boot_dev=${disk_dev}1
|
boot_dev=${disk_dev}1
|
||||||
data_dev=${disk_dev}3
|
data_dev=${disk_dev}3
|
||||||
else
|
else
|
||||||
msg_fail "unknown ($root_dev)"
|
msg_fail "unknown (${root_dev})"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
msg_done "$disk_dev"
|
msg_done "${disk_dev}"
|
||||||
|
|
||||||
test -b $data_dev && exit 0
|
test -b ${data_dev} && exit 0
|
||||||
|
|
||||||
msg_begin "Creating data partition"
|
msg_begin "Creating data partition"
|
||||||
data_start=$((1024 * 2048)) # up to 1024MB reserved for boot + root
|
data_start=$((1024 * 2048)) # up to 1024MB reserved for boot + root
|
||||||
@ -29,12 +29,12 @@ case "$1" in
|
|||||||
3
|
3
|
||||||
${data_start}
|
${data_start}
|
||||||
\n
|
\n
|
||||||
w" | /sbin/fdisk $disk_dev &>/dev/null
|
w" | /sbin/fdisk ${disk_dev} &>/dev/null
|
||||||
partx -a $disk_dev &>/dev/null
|
partx -a ${disk_dev} &>/dev/null
|
||||||
test -b $data_dev && msg_done || msg_fail
|
test -b ${data_dev} && msg_done || msg_fail
|
||||||
|
|
||||||
msg_begin "Formatting data partition"
|
msg_begin "Formatting data partition"
|
||||||
mkfs.ext4 -q $data_dev
|
mkfs.ext4 -q ${data_dev}
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
|
|
||||||
msg_begin "Mounting data partition"
|
msg_begin "Mounting data partition"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
mount_fs() {
|
mount_fs() {
|
||||||
msg_begin "Mounting filesystems"
|
msg_begin "Mounting filesystems"
|
||||||
@ -22,8 +22,8 @@ remount_rw() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mk_tty_login() {
|
mk_tty_login() {
|
||||||
test -z "$os_tty_login" && os_tty_login=tty1
|
test -z "${OS_TTY_LOGIN}" && OS_TTY_LOGIN=tty1
|
||||||
ln -sf /dev/$os_tty_login /dev/ttylogin
|
ln -sf /dev/${OS_TTY_LOGIN} /dev/ttylogin
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
@ -31,8 +31,8 @@ case "$1" in
|
|||||||
mount_fs
|
mount_fs
|
||||||
|
|
||||||
# we need to source conf again, now that /data is available
|
# we need to source conf again, now that /data is available
|
||||||
test -n "$os_debug" || source /etc/init.d/conf
|
source /etc/init.d/os_conf
|
||||||
test "$os_debug" == "true" && remount_rw
|
test "${OS_DEBUG}" == "true" && remount_rw
|
||||||
mk_tty_login
|
mk_tty_login
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -1,20 +1,26 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
sys_modules_file="/etc/modules"
|
SYS_MODULES_FILE="/etc/modules"
|
||||||
modules_file="/data/etc/modules"
|
BOOT_MODULES_FILE="/boot/modules"
|
||||||
|
MODULES_FILE="/data/etc/modules"
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
msg_begin "Loading kernel modules"
|
msg_begin "Loading kernel modules"
|
||||||
|
|
||||||
if [[ -r $sys_modules_file ]]; then
|
if [[ -r ${SYS_MODULES_FILE} ]]; then
|
||||||
cat $sys_modules_file | while read line; do test -n "$line" && /sbin/modprobe $line &>/dev/null; done
|
cat ${SYS_MODULES_FILE} | while read line; do test -n "${line}" && /sbin/modprobe ${line} &>/dev/null; done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -r $modules_file ]]; then
|
if [[ -r ${BOOT_MODULES_FILE} ]]; then
|
||||||
cat $modules_file | while read line; do test -n "$line" && /sbin/modprobe $line &>/dev/null; done
|
cat ${BOOT_MODULES_FILE} | while read line; do test -n "${line}" && /sbin/modprobe ${line} &>/dev/null; done
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -r ${MODULES_FILE} ]]; then
|
||||||
|
cat ${MODULES_FILE} | while read line; do test -n "${line}" && /sbin/modprobe ${line} &>/dev/null; done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
msg_done
|
msg_done
|
||||||
|
@ -1,31 +1,26 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
sys_hostname_file="/etc/hostname"
|
SYS_HOSTNAME_FILE="/etc/hostname"
|
||||||
boot_hostname_file="/boot/hostname"
|
BOOT_HOSTNAME_FILE="/boot/hostname"
|
||||||
hostname_file="/data/etc/hostname"
|
HOSTNAME_FILE="/data/etc/hostname"
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
msg_begin "Setting hostname"
|
msg_begin "Setting hostname"
|
||||||
|
|
||||||
if ! [[ -f $hostname_file ]]; then
|
prepare_conf ${HOSTNAME_FILE} ${SYS_HOSTNAME_FILE} ${BOOT_HOSTNAME_FILE}
|
||||||
if [[ -f $boot_hostname_file ]]; then
|
|
||||||
cp $boot_hostname_file $hostname_file
|
|
||||||
elif [[ -f $sys_hostname_file ]]; then
|
|
||||||
cp $sys_hostname_file $hostname_file
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -f $hostname_file ]]; then
|
if [[ -f ${HOSTNAME_FILE} ]]; then
|
||||||
hostname=$(cat $hostname_file)
|
hostname=$(cat ${HOSTNAME_FILE})
|
||||||
else
|
else
|
||||||
hostname="$os_prefix-$board_sn"
|
hostname="${OS_PREFIX}-${BOARD_SN}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
/bin/hostname $hostname
|
/bin/hostname ${hostname}
|
||||||
echo "127.0.0.1 localhost $hostname" > /etc/hosts
|
echo "127.0.0.1 localhost ${hostname}" > /etc/hosts
|
||||||
|
|
||||||
msg_done
|
msg_done
|
||||||
;;
|
;;
|
||||||
|
@ -1,23 +1,28 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
PROG="/sbin/syslogd"
|
||||||
|
PROG_D="/bin/dmesg"
|
||||||
|
|
||||||
|
DMESG_LOG="/var/log/dmesg.log"
|
||||||
|
|
||||||
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
dmesg_log="/var/log/dmesg.log"
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
msg_begin "Starting syslogd"
|
msg_begin "Starting syslogd"
|
||||||
syslogd
|
${PROG}
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
echo "---- booting $os_name $os_version ----" >> $dmesg_log
|
echo "---- booting ${OS_NAME} ${OS_VERSION} ----" >> ${DMESG_LOG}
|
||||||
dmesg -T -w >> $dmesg_log &
|
${PROG_D} -T -w >> ${DMESG_LOG} &
|
||||||
;;
|
;;
|
||||||
|
|
||||||
stop)
|
stop)
|
||||||
msg_begin "Stopping syslogd"
|
msg_begin "Stopping syslogd"
|
||||||
killall syslogd &>/dev/null
|
killall -q $(basename ${PROG})
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
killall dmesg &>/dev/null
|
killall -q $(basename ${PROG_D})
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
|
@ -1,28 +1,35 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
test -f /etc/udev/udev.conf || exit 0
|
CONF="/etc/udev/udev.conf"
|
||||||
|
PROG="/sbin/udevd"
|
||||||
|
PROG_UA="/sbin/udevadm"
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
|
||||||
|
|
||||||
source /etc/udev/udev.conf
|
test -f ${PROG} || exit 0
|
||||||
|
test -f ${CONF} || exit 0
|
||||||
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
|
source ${CONF}
|
||||||
|
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
msg_begin "Starting eudev"
|
msg_begin "Starting eudev"
|
||||||
echo '\000\000\000\000' > /proc/sys/kernel/hotplug
|
echo '\000\000\000\000' > /proc/sys/kernel/hotplug
|
||||||
/sbin/udevd --daemon --resolve-names=never
|
${PROG} --daemon --resolve-names=never
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
|
|
||||||
/sbin/udevadm trigger --type=subsystems --action=add
|
${PROG_UA} trigger --type=subsystems --action=add
|
||||||
/sbin/udevadm trigger --type=devices --action=add
|
${PROG_UA} trigger --type=devices --action=add
|
||||||
/sbin/udevadm settle --timeout=30
|
${PROG_UA} settle --timeout=30
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
msg_begin "Stopping eudev"
|
msg_begin "Stopping eudev"
|
||||||
udevadm control --stop-exec-queue
|
${PROG_UA} control --stop-exec-queue
|
||||||
killall udevd &>/dev/null
|
killall -q $(basename ${PROG})
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,13 +1,20 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
test -c /dev/watchdog || exit 0
|
DEV="/dev/watchdog"
|
||||||
|
|
||||||
|
PROG="/sbin/watchdog"
|
||||||
|
|
||||||
|
|
||||||
|
test -c ${PROG} || exit 0
|
||||||
|
test -c ${DEV} || exit 0
|
||||||
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
msg_begin "Starting watchdog"
|
msg_begin "Starting watchdog"
|
||||||
watchdog -t 5 /dev/watchdog
|
${PROG} -t 5 ${DEV}
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@ -17,7 +24,7 @@ case "$1" in
|
|||||||
|
|
||||||
reallystop)
|
reallystop)
|
||||||
msg_begin "Stopping watchdog"
|
msg_begin "Stopping watchdog"
|
||||||
killall watchdog &>/dev/null
|
killall -q $(basename ${PROG})
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -1,19 +1,18 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
SYS_VERSION_FILE="/etc/version"
|
||||||
|
VERSION_FILE="/data/etc/version"
|
||||||
|
POST_UPGRADE_DIR="/usr/share/post-upgrade"
|
||||||
|
|
||||||
sys_version_file="/etc/version"
|
|
||||||
version_file="/data/etc/version"
|
|
||||||
post_upgrade_dir="/usr/share/post-upgrade"
|
|
||||||
sys_os_conf="/etc/os.conf"
|
|
||||||
os_conf="/data/etc/os.conf"
|
|
||||||
|
|
||||||
hash=$(md5sum $version_file 2>/dev/null | cut -d ' ' -f 1)
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
sys_hash=$(md5sum $sys_version_file 2>/dev/null | cut -d ' ' -f 1)
|
|
||||||
|
|
||||||
test "$hash" == "$sys_hash" && exit 0
|
hash=$(md5sum ${VERSION_FILE} 2>/dev/null | cut -d ' ' -f 1)
|
||||||
|
sys_hash=$(md5sum ${SYS_VERSION_FILE} 2>/dev/null | cut -d ' ' -f 1)
|
||||||
|
|
||||||
test -d $post_upgrade_dir || exit 0
|
test "${hash}" == "${sys_hash}" && exit 0
|
||||||
|
|
||||||
|
test -d ${POST_UPGRADE_DIR} || exit 0
|
||||||
|
|
||||||
function version_gt() {
|
function version_gt() {
|
||||||
if [[ "$1" != "$2" ]] && [[ $(echo -e "$2\n$1" | sort -t . | head -n 1) == "$2" ]]; then
|
if [[ "$1" != "$2" ]] && [[ $(echo -e "$2\n$1" | sort -t . | head -n 1) == "$2" ]]; then
|
||||||
@ -24,28 +23,16 @@ function version_gt() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function run_post_upgrade() {
|
function run_post_upgrade() {
|
||||||
version="$(source $version_file 2>/dev/null && echo $os_version)"
|
version="$(source ${VERSION_FILE} 2>/dev/null && echo ${OS_VERSION})"
|
||||||
sys_version="$(source $sys_version_file 2>/dev/null && echo $os_version)"
|
sys_version="$(source ${SYS_VERSION_FILE} 2>/dev/null && echo ${OS_VERSION})"
|
||||||
|
|
||||||
versions=$(ls -1 $post_upgrade_dir | cut -d '.' -f 1)
|
versions=$(ls -1 ${POST_UPGRADE_DIR} | cut -d '.' -f 1)
|
||||||
for v in $versions; do
|
for v in ${versions}; do
|
||||||
if [[ -z "$version" ]] || version_gt $v $version; then
|
if [[ -z "${version}" ]] || version_gt ${v} ${version}; then
|
||||||
msg_begin "Post-upgrading to version $v"
|
msg_begin "Post-upgrading to version ${v}"
|
||||||
out=$($post_upgrade_dir/$v.sh 2>&1)
|
out=$(${POST_UPGRADE_DIR}/${v}.sh 2>&1)
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
echo "$out" | logger -t post-upgrade
|
echo "${out}" | logger -t post-upgrade
|
||||||
fi
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
function update_os_conf() {
|
|
||||||
source $sys_os_conf
|
|
||||||
sys_vars=$(cat $sys_os_conf | cut -d '=' -f 1)
|
|
||||||
for var in $sys_vars; do
|
|
||||||
if ! grep "$var=" $os_conf &>/dev/null; then
|
|
||||||
msg_begin "Adding $var to os.conf"
|
|
||||||
echo "$var=\"${!var}\"" >> $os_conf
|
|
||||||
msg_done
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -53,8 +40,7 @@ function update_os_conf() {
|
|||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
run_post_upgrade
|
run_post_upgrade
|
||||||
cp $sys_version_file $version_file
|
cp ${SYS_VERSION_FILE} ${VERSION_FILE}
|
||||||
update_os_conf
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
stop)
|
stop)
|
||||||
|
@ -1,15 +1,21 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
sys_btconf="/etc/bluetooth.conf"
|
SYS_BTCONF="/etc/bluetooth.conf"
|
||||||
boot_btconf="/boot/bluetooth.conf"
|
BOOT_BTCONF="/boot/bluetooth.conf"
|
||||||
btconf="/data/etc/bluetooth.conf"
|
BTCONF="/data/etc/bluetooth.conf"
|
||||||
|
|
||||||
|
PROG="/usr/bin/dbus-daemon"
|
||||||
|
PROG_UG="/usr/bin/dbus-uuidgen"
|
||||||
|
PROG_UA="/usr/bin/udevadm"
|
||||||
|
|
||||||
|
|
||||||
|
test -x ${PROG} || exit 0
|
||||||
|
|
||||||
# dbus is currently only used by bluez
|
# dbus is currently only used by bluez
|
||||||
test -f $btconf || test -f $boot_btconf || test -f $sys_btconf || exit 0
|
test -f ${BTCONF} || test -f ${BOOT_BTCONF} || test -f ${SYS_BTCONF} || exit 0
|
||||||
|
|
||||||
test -x /usr/bin/dbus-daemon || exit 0
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
mkdir -p /tmp/dbus
|
mkdir -p /tmp/dbus
|
||||||
@ -17,16 +23,16 @@ start() {
|
|||||||
|
|
||||||
msg_begin "Starting dbus"
|
msg_begin "Starting dbus"
|
||||||
|
|
||||||
dbus-uuidgen --ensure
|
${PROG_UG} --ensure
|
||||||
dbus-daemon --system
|
${PROG} --system
|
||||||
|
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
msg_begin "Stopping dbus"
|
msg_begin "Stopping dbus"
|
||||||
udevadm control --stop-exec-queue
|
${PROG_UA} control --stop-exec-queue
|
||||||
killall dbus-daemon &>/dev/null
|
killall -q $(basename ${PROG})
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
|
|
||||||
rm -f /var/run/messagebus.pid
|
rm -f /var/run/messagebus.pid
|
||||||
|
@ -1,30 +1,27 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
sys_conf="/etc/hostapd.conf"
|
SYS_CONF="/etc/hostapd.conf"
|
||||||
boot_conf="/boot/hostapd.conf"
|
BOOT_CONF="/boot/hostapd.conf"
|
||||||
conf="/data/etc/hostapd.conf"
|
CONF="/data/etc/hostapd.conf"
|
||||||
|
|
||||||
log="/var/log/hostapd.log"
|
LOG="/var/log/hostapd.log"
|
||||||
prog="/usr/sbin/hostapd"
|
PROG="/usr/sbin/hostapd"
|
||||||
|
|
||||||
watch_conf="/data/etc/watch.conf"
|
WATCH_CONF="/data/etc/watch.conf"
|
||||||
|
|
||||||
link_watch=yes
|
LINK_WATCH=yes
|
||||||
link_watch_timeout=20
|
LINK_WATCH_TIMEOUT=20
|
||||||
|
|
||||||
test -f $watch_conf && source $watch_conf
|
|
||||||
|
|
||||||
if ! [[ -f $conf ]]; then
|
test -x ${PROG} || exit 0
|
||||||
if [[ -f $boot_conf ]]; then
|
|
||||||
cp $boot_conf $conf
|
|
||||||
elif [[ -f $sys_conf ]]; then
|
|
||||||
cp $sys_conf $conf
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
test -f $conf || exit 0
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
|
prepare_conf ${CONF} ${SYS_CONF} ${BOOT_CONF}
|
||||||
|
test -f ${CONF} || exit 0
|
||||||
|
|
||||||
|
test -f ${WATCH_CONF} && source ${WATCH_CONF}
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
|
||||||
|
|
||||||
running() {
|
running() {
|
||||||
killall -0 hostapd &> /dev/null
|
killall -0 hostapd &> /dev/null
|
||||||
@ -46,26 +43,26 @@ start() {
|
|||||||
|
|
||||||
# wait up to 5 seconds for interface
|
# wait up to 5 seconds for interface
|
||||||
count=0
|
count=0
|
||||||
while ! ifconfig $iface >/dev/null 2>&1; do
|
while ! ifconfig ${iface} >/dev/null 2>&1; do
|
||||||
sleep 1
|
sleep 1
|
||||||
count=$(($count + 1))
|
count=$((${count} + 1))
|
||||||
if [[ $count -ge 5 ]]; then
|
if [[ ${count} -ge 5 ]]; then
|
||||||
msg_fail "no device"
|
msg_fail "no device"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
iface=$(cat $conf | grep interface | cut -d '=' -f 2)
|
iface=$(cat ${CONF} | grep interface | cut -d '=' -f 2)
|
||||||
module=$(basename $(readlink /sys/class/net/$iface/device/driver/module 2>/dev/null) 2>/dev/null)
|
module=$(basename $(readlink /sys/class/net/${iface}/device/driver/module 2>/dev/null) 2>/dev/null)
|
||||||
|
|
||||||
iwconfig $iface power off &> /dev/null
|
iwconfig ${iface} power off &> /dev/null
|
||||||
$prog $conf &> $log &
|
${PROG} ${CONF} &> ${LOG} &
|
||||||
|
|
||||||
if [[ "$link_watch" == "yes" ]]; then
|
if [[ "${LINK_WATCH}" == "yes" ]]; then
|
||||||
watch &
|
watch &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
test -n "$module" && msg_done "done ($module)"|| msg_done
|
test -n "${module}" && msg_done "done (${module})"|| msg_done
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
|
@ -1,56 +1,36 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
sys_conf="/etc/wpa_supplicant.conf"
|
SYS_CONF="/etc/wpa_supplicant.conf"
|
||||||
boot_conf="/boot/wpa_supplicant.conf"
|
BOOT_CONF="/boot/wpa_supplicant.conf"
|
||||||
conf="/data/etc/wpa_supplicant.conf"
|
CONF="/data/etc/wpa_supplicant.conf"
|
||||||
|
|
||||||
log="/var/log/wpa_supplicant.log"
|
LOG="/var/log/wpa_supplicant.log"
|
||||||
prog="/usr/sbin/wpa_supplicant"
|
PROG="/usr/sbin/wpa_supplicant"
|
||||||
driver=nl80211,wext
|
DRIVER=nl80211,wext
|
||||||
|
|
||||||
sys_watch_conf="/etc/watch.conf"
|
SYS_WATCH_CONF="/etc/watch.conf"
|
||||||
boot_watch_conf="/boot/watch.conf"
|
BOOT_WATCH_CONF="/boot/watch.conf"
|
||||||
watch_conf="/data/etc/watch.conf"
|
WATCH_CONF="/data/etc/watch.conf"
|
||||||
|
|
||||||
if ! [[ -f $watch_conf ]]; then
|
|
||||||
if [[ -f $boot_watch_conf ]]; then
|
|
||||||
cp $boot_watch_conf $watch_conf
|
|
||||||
elif [[ -f $sys_watch_conf ]]; then
|
|
||||||
cp $sys_watch_conf $watch_conf
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
source $watch_conf
|
test -x ${PROG} || exit 0
|
||||||
|
|
||||||
if [[ -f $boot_conf ]]; then
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
cp -f $boot_conf $conf
|
|
||||||
grep -E "/boot .*ro[\s,]" /proc/mounts
|
|
||||||
RO=$?
|
|
||||||
test $RO == 0 && mount -o remount,rw /boot
|
|
||||||
rm -f $boot_conf
|
|
||||||
test $RO == 0 && mount -o remount,ro /boot
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! [[ -f $conf ]]; then
|
prepare_conf ${WATCH_CONF} ${SYS_WATCH_CONF} ${BOOT_WATCH_CONF}
|
||||||
if [[ -f $sys_conf ]]; then
|
source ${WATCH_CONF}
|
||||||
cp $sys_conf $conf
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
test -f $conf || exit 0
|
prepare_conf ${CONF} ${SYS_CONF} ${BOOT_CONF}
|
||||||
|
test -f ${CONF} || exit 0
|
||||||
|
|
||||||
# we want only Unix newlines here
|
ssid=$(cat ${CONF} | grep ssid | grep -v scan_ssid | cut -d '"' -f 2)
|
||||||
sed -i 's/\r//g' $conf
|
test -n "${ssid}" || exit 0
|
||||||
|
|
||||||
ssid=$(cat $conf | grep ssid | grep -v scan_ssid | cut -d '"' -f 2)
|
test "${OS_NETWORKLESS}" == "true" && exit 0
|
||||||
test -n "$ssid" || exit 0
|
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
|
||||||
|
|
||||||
test "$os_networkless" == "true" && exit 0
|
|
||||||
|
|
||||||
connected() {
|
connected() {
|
||||||
ip link show dev $os_wlan 2>&1 | grep LOWER_UP &> /dev/null && return 0 || return 1
|
ip link show dev ${OS_WLAN} 2>&1 | grep LOWER_UP &> /dev/null && return 0 || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
watch() {
|
watch() {
|
||||||
@ -60,11 +40,11 @@ watch() {
|
|||||||
if connected; then
|
if connected; then
|
||||||
count=0
|
count=0
|
||||||
else
|
else
|
||||||
if [[ $count -lt $link_watch_timeout ]]; then
|
if [[ ${count} -lt ${LINK_WATCH_TIMEOUT} ]]; then
|
||||||
count=$(($count + 5))
|
count=$((${count} + 5))
|
||||||
logger -t wifi -s "disconnected"
|
logger -t wifi -s "disconnected"
|
||||||
else
|
else
|
||||||
logger -t wifi -s "disconnected for $link_watch_timeout seconds, calling panic action"
|
logger -t wifi -s "disconnected for ${LINK_WATCH_TIMEOUT} seconds, calling panic action"
|
||||||
panic_action wifi
|
panic_action wifi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -72,26 +52,26 @@ watch() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
test -n "$os_country" && iw reg set $os_country
|
test -n "${OS_COUNTRY}" && iw reg set ${OS_COUNTRY}
|
||||||
|
|
||||||
msg_begin "Starting wpa_supplicant"
|
msg_begin "Starting wpa_supplicant"
|
||||||
|
|
||||||
# wait up to 5 seconds for interface
|
# wait up to 5 seconds for interface
|
||||||
count=0
|
count=0
|
||||||
while ! ifconfig $os_wlan >/dev/null 2>&1; do
|
while ! ifconfig ${OS_WLAN} >/dev/null 2>&1; do
|
||||||
sleep 1
|
sleep 1
|
||||||
count=$(($count + 1))
|
count=$((${count} + 1))
|
||||||
if [[ $count -ge 5 ]]; then
|
if [[ ${count} -ge 5 ]]; then
|
||||||
msg_fail "no device"
|
msg_fail "no device"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
module=$(basename $(readlink /sys/class/net/$os_wlan/device/driver/module 2>/dev/null) 2>/dev/null)
|
module=$(basename $(readlink /sys/class/net/${OS_WLAN}/device/driver/module 2>/dev/null) 2>/dev/null)
|
||||||
|
|
||||||
iwconfig $os_wlan power off &> /dev/null
|
iwconfig ${OS_WLAN} power off &> /dev/null
|
||||||
iw $os_wlan set power_save off &> /dev/null
|
iw ${OS_WLAN} set power_save off &> /dev/null
|
||||||
$prog -i$os_wlan -c$conf -D$driver -B &> $log
|
${PROG} -i${OS_WLAN} -c${CONF} -D${DRIVER} -B &> ${LOG}
|
||||||
count=0
|
count=0
|
||||||
while true; do
|
while true; do
|
||||||
sleep 1
|
sleep 1
|
||||||
@ -100,19 +80,19 @@ start() {
|
|||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $count -gt $link_watch_timeout ]] || ! pidof wpa_supplicant > /dev/null; then
|
if [[ ${count} -gt ${LINK_WATCH_TIMEOUT} ]] || ! pidof wpa_supplicant > /dev/null; then
|
||||||
test -n "$module" && msg_fail "failed ($module)"|| msg_fail
|
test -n "${module}" && msg_fail "failed (${module})"|| msg_fail
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
count=$(($count + 1))
|
count=$((${count} + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ "$link_watch" == "true" ]]; then
|
if [[ "${LINK_WATCH}" == "true" ]]; then
|
||||||
watch &
|
watch &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
test -n "$module" && msg_done "done ($module)"|| msg_done
|
test -n "${module}" && msg_done "done (${module})"|| msg_done
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
|
@ -1,33 +1,31 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
sys_conf="/etc/ppp/default"
|
SYS_CONF="/etc/ppp/default"
|
||||||
boot_conf="/boot/ppp"
|
BOOT_CONF="/boot/ppp"
|
||||||
conf="/data/etc/ppp"
|
CONF="/data/etc/ppp"
|
||||||
|
|
||||||
prog="/usr/sbin/pppd"
|
PROG="/usr/sbin/pppd"
|
||||||
provider="mobile"
|
PROVIDER="mobile"
|
||||||
|
|
||||||
watch_conf="/data/etc/watch.conf"
|
WATCH_CONF="/data/etc/watch.conf"
|
||||||
|
|
||||||
source $watch_conf
|
|
||||||
|
|
||||||
if ! [[ -d $conf ]]; then
|
test -x ${PROG} || exit 0
|
||||||
if [[ -d $boot_conf ]]; then
|
|
||||||
cp -r $boot_conf $conf
|
|
||||||
elif [[ -d $sys_conf ]]; then
|
|
||||||
cp -r $sys_conf $conf
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
test -e $conf/modem || exit 0
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
test -e $conf/apn || exit 0
|
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
prepare_conf ${CONF} ${SYS_CONF} ${BOOT_CONF}
|
||||||
|
|
||||||
|
test -e ${CONF}/modem || exit 0
|
||||||
|
test -e ${CONF}/apn || exit 0
|
||||||
|
|
||||||
|
source ${WATCH_CONF}
|
||||||
|
|
||||||
|
test "${OS_NETWORKLESS}" == "true" && exit 0
|
||||||
|
|
||||||
test "$os_networkless" == "true" && exit 0
|
|
||||||
|
|
||||||
connected() {
|
connected() {
|
||||||
ifconfig | grep $os_ppp &>/dev/null && return 0 || return 1
|
ifconfig | grep ${OS_PPP} &>/dev/null && return 0 || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
watch() {
|
watch() {
|
||||||
@ -37,11 +35,11 @@ watch() {
|
|||||||
if connected; then
|
if connected; then
|
||||||
count=0
|
count=0
|
||||||
else
|
else
|
||||||
if [[ $count -lt $link_watch_timeout ]]; then
|
if [[ ${count} -lt ${LINK_WATCH_TIMEOUT} ]]; then
|
||||||
count=$(($count + 5))
|
count=$((${count} + 5))
|
||||||
logger -t ppp -s "disconnected"
|
logger -t ppp -s "disconnected"
|
||||||
else
|
else
|
||||||
logger -t ppp -s "disconnected for $link_watch_timeout seconds, calling panic action"
|
logger -t ppp -s "disconnected for ${LINK_WATCH_TIMEOUT} seconds, calling panic action"
|
||||||
panic_action ppp
|
panic_action ppp
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -55,35 +53,35 @@ udev_trigger_add() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
test -e $conf/auth || touch $conf/auth
|
test -e ${CONF}/auth || touch ${CONF}/auth
|
||||||
test -e $conf/extra || touch $conf/extra
|
test -e ${CONF}/extra || touch ${CONF}/extra
|
||||||
test -e $conf/pin || touch $conf/pin
|
test -e ${CONF}/pin || touch ${CONF}/pin
|
||||||
mknod /dev/ppp c 108 0 &>/dev/null
|
mknod /dev/ppp c 108 0 &>/dev/null
|
||||||
|
|
||||||
msg_begin "Starting pppd"
|
msg_begin "Starting pppd"
|
||||||
|
|
||||||
# wait for modem
|
# wait for modem
|
||||||
modem=$(head -n 1 $conf/modem)
|
modem=$(head -n 1 ${CONF}/modem)
|
||||||
if ! [[ -e /dev/$modem ]]; then
|
if ! [[ -e /dev/${modem} ]]; then
|
||||||
udev_trigger_add 4 &
|
udev_trigger_add 4 &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
count=0
|
count=0
|
||||||
while true; do
|
while true; do
|
||||||
if [[ -e /dev/$modem ]] || [[ $count -gt $link_watch_timeout ]]; then
|
if [[ -e /dev/${modem} ]] || [[ ${count} -gt ${LINK_WATCH_TIMEOUT} ]]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
count=$(($count + 1))
|
count=$((${count} + 1))
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
if ! [[ -e /dev/$modem ]]; then
|
if ! [[ -e /dev/${modem} ]]; then
|
||||||
msg_fail "modem /dev/$modem not present"
|
msg_fail "modem /dev/${modem} not present"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$prog call $provider
|
${PROG} call ${PROVIDER}
|
||||||
count=0
|
count=0
|
||||||
while true; do
|
while true; do
|
||||||
sleep 1
|
sleep 1
|
||||||
@ -92,15 +90,15 @@ start() {
|
|||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $count -gt $link_watch_timeout ]] || ! pidof pppd > /dev/null; then
|
if [[ ${count} -gt ${LINK_WATCH_TIMEOUT} ]] || ! pidof $(basename ${PROG}) > /dev/null; then
|
||||||
msg_fail
|
msg_fail
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
count=$(($count + 1))
|
count=$((${count} + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ "$link_watch" == "true" ]]; then
|
if [[ "${LINK_WATCH}" == "true" ]]; then
|
||||||
watch &
|
watch &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -109,7 +107,7 @@ start() {
|
|||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
msg_begin "Stopping pppd"
|
msg_begin "Stopping pppd"
|
||||||
killall pppd &>/dev/null
|
killall -q $(basename ${PROG})
|
||||||
ps | grep ppp | grep -v $$ | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill
|
ps | grep ppp | grep -v $$ | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill
|
||||||
msg_done
|
msg_done
|
||||||
}
|
}
|
||||||
|
@ -1,41 +1,37 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
sys_conf="/etc/bluetooth.conf"
|
SYS_CONF="/etc/bluetooth.conf"
|
||||||
boot_conf="/boot/bluetooth.conf"
|
BOOT_CONF="/boot/bluetooth.conf"
|
||||||
conf="/data/etc/bluetooth.conf"
|
CONF="/data/etc/bluetooth.conf"
|
||||||
|
RUN_CONF="/var/lib/bluetooth.conf"
|
||||||
|
|
||||||
if ! [[ -f $conf ]]; then
|
ADAPTER="hci0"
|
||||||
if [[ -f $boot_conf ]]; then
|
PROG="/usr/libexec/bluetooth/bluetoothd"
|
||||||
cp $boot_conf $conf
|
PROG_HC="/usr/bin/hciconfig"
|
||||||
elif [[ -f $sys_conf ]]; then
|
DATA_DIR="/var/lib/bluetooth"
|
||||||
cp $sys_conf $conf
|
RUN_DATA_DIR="/data/bluetooth"
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
test -f $conf || exit 0
|
|
||||||
|
|
||||||
hci=hci0
|
test -x ${PROG} || exit 0
|
||||||
bluetoothd=/usr/libexec/bluetooth/bluetoothd
|
|
||||||
data_dir=/var/lib/bluetooth
|
|
||||||
run_data_dir=/data/bluetooth
|
|
||||||
run_conf=/var/lib/bluetooth.conf
|
|
||||||
|
|
||||||
test -x $bluetoothd || exit 0
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
|
prepare_conf ${CONF} ${SYS_CONF} ${BOOT_CONF}
|
||||||
|
test -f ${CONF} || exit 0
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
|
||||||
|
|
||||||
configure() {
|
configure() {
|
||||||
mkdir -p $run_data_dir
|
mkdir -p ${RUN_DATA_DIR}
|
||||||
ln -sf $run_data_dir $data_dir
|
ln -sf ${RUN_DATA_DIR} ${DATA_DIR}
|
||||||
cp $conf $run_conf
|
cp ${CONF} ${RUN_CONF}
|
||||||
|
|
||||||
# if no specific name configured, use hostname
|
# if no specific name configured, use hostname
|
||||||
if ! grep -E 'Name\s*=' $run_conf &>/dev/null; then
|
if ! grep -E 'Name\s*=' ${RUN_CONF} &>/dev/null; then
|
||||||
sed -ri "s/(\[General\])/\1\nName = $(hostname)/" $run_conf
|
sed -ri "s/(\[General\])/\1\nName = $(hostname)/" ${RUN_CONF}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# bring adapter up
|
# bring adapter up
|
||||||
hciconfig $hci up
|
${PROG_HC} ${ADAPTER} up
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
@ -43,10 +39,10 @@ start() {
|
|||||||
|
|
||||||
# wait up to 10 seconds for device
|
# wait up to 10 seconds for device
|
||||||
count=0
|
count=0
|
||||||
while ! hciconfig $hci &>/dev/null; do
|
while ! ${PROG_HC} ${ADAPTER} &>/dev/null; do
|
||||||
sleep 1
|
sleep 1
|
||||||
count=$(($count + 1))
|
count=$((${count} + 1))
|
||||||
if [[ $count -ge 10 ]]; then
|
if [[ ${count} -ge 10 ]]; then
|
||||||
msg_fail "no device"
|
msg_fail "no device"
|
||||||
logger -t bluetooth -s "bluetooth device not available, calling panic action"
|
logger -t bluetooth -s "bluetooth device not available, calling panic action"
|
||||||
panic_action bluetooth
|
panic_action bluetooth
|
||||||
@ -62,19 +58,19 @@ start() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
msg_begin "Starting bluetoothd"
|
msg_begin "Starting bluetoothd"
|
||||||
$bluetoothd &>/dev/null &
|
${PROG} &>/dev/null &
|
||||||
msg_done
|
msg_done
|
||||||
|
|
||||||
# if DiscoverableTimeout is set to 0, make adapter discoverable from boot time
|
# if DiscoverableTimeout is set to 0, make adapter discoverable from boot time
|
||||||
if grep -E '^DiscoverableTimeout\s*=\s*0$' $run_conf &>/dev/null; then
|
if grep -E '^DiscoverableTimeout\s*=\s*0$' ${RUN_CONF} &>/dev/null; then
|
||||||
sleep 1
|
sleep 1
|
||||||
hciconfig $hci piscan
|
${PROG_HC} ${ADAPTER} piscan
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
msg_begin "Stopping bluetoothd"
|
msg_begin "Stopping bluetoothd"
|
||||||
killall bluetoothd &>/dev/null
|
killall -q $(basename ${PROG})
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,40 +1,36 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
DH_CONF="/var/cache/dhclient.conf"
|
||||||
|
SYS_STATIC_CONF="/etc/static_ip.conf"
|
||||||
|
BOOT_STATIC_CONF="/boot/static_ip.conf"
|
||||||
|
STATIC_CONF="/data/etc/static_ip.conf"
|
||||||
|
WATCH_CONF="/data/etc/watch.conf"
|
||||||
|
|
||||||
|
LINK_NEGO_TIMEOUT=10
|
||||||
|
|
||||||
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
|
source ${WATCH_CONF}
|
||||||
|
|
||||||
|
prepare_conf ${STATIC_CONF} ${SYS_STATIC_CONF} ${BOOT_STATIC_CONF}
|
||||||
|
test -r ${STATIC_CONF} && source ${STATIC_CONF}
|
||||||
|
|
||||||
mkdir -p /var/lib/dhcp
|
mkdir -p /var/lib/dhcp
|
||||||
dh_conf="/var/cache/dhclient.conf"
|
|
||||||
sys_static_conf="/etc/static_ip.conf"
|
|
||||||
boot_static_conf="/boot/static_ip.conf"
|
|
||||||
static_conf="/data/etc/static_ip.conf"
|
|
||||||
watch_conf="/data/etc/watch.conf"
|
|
||||||
|
|
||||||
link_nego_timeout=10
|
|
||||||
|
|
||||||
source $watch_conf
|
|
||||||
|
|
||||||
if ! [[ -f $static_conf ]]; then
|
|
||||||
if [[ -f $boot_static_conf ]]; then
|
|
||||||
cp $boot_static_conf $static_conf
|
|
||||||
elif [[ -f $sys_static_conf ]]; then
|
|
||||||
cp $sys_static_conf $static_conf
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
test -r $static_conf && source $static_conf
|
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
|
||||||
|
|
||||||
watch_eth() {
|
watch_eth() {
|
||||||
count=0
|
count=0
|
||||||
while true; do
|
while true; do
|
||||||
sleep 5
|
sleep 5
|
||||||
if [[ "$(cat /sys/class/net/$os_eth/operstate 2>/dev/null)" == "up" ]]; then
|
if [[ "$(cat /sys/class/net/${OS_ETH}/operstate 2>/dev/null)" == "up" ]]; then
|
||||||
count=0
|
count=0
|
||||||
else
|
else
|
||||||
if [[ $count -lt $link_watch_timeout ]]; then
|
if [[ ${count} -lt ${LINK_WATCH_TIMEOUT} ]]; then
|
||||||
count=$(($count + 5))
|
count=$((${count} + 5))
|
||||||
logger -t ethernet -s "disconnected"
|
logger -t ethernet -s "disconnected"
|
||||||
else
|
else
|
||||||
logger -t ethernet -s "disconnected for $link_watch_timeout seconds, calling panic action"
|
logger -t ethernet -s "disconnected for ${LINK_WATCH_TIMEOUT} seconds, calling panic action"
|
||||||
panic_action network
|
panic_action network
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -46,14 +42,14 @@ watch_ip() {
|
|||||||
count=0
|
count=0
|
||||||
while true; do
|
while true; do
|
||||||
sleep 5
|
sleep 5
|
||||||
if ip addr show dev $iface | grep inet &>/dev/null; then
|
if ip addr show dev ${iface} | grep inet &>/dev/null; then
|
||||||
count=0
|
count=0
|
||||||
else
|
else
|
||||||
if [[ $count -lt $ip_watch_timeout ]]; then
|
if [[ ${count} -lt ${IP_WATCH_TIMEOUT} ]]; then
|
||||||
count=$(($count + 5))
|
count=$((${count} + 5))
|
||||||
logger -t network -s "$iface has no IP address"
|
logger -t network -s "${iface} has no IP address"
|
||||||
else
|
else
|
||||||
logger -t network -s "$iface had no IP address for $ip_watch_timeout seconds, calling panic action"
|
logger -t network -s "${iface} had no IP address for ${IP_WATCH_TIMEOUT} seconds, calling panic action"
|
||||||
panic_action network
|
panic_action network
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -66,31 +62,31 @@ start_lo() {
|
|||||||
|
|
||||||
start_wlan() {
|
start_wlan() {
|
||||||
msg_begin "Configuring wireless network"
|
msg_begin "Configuring wireless network"
|
||||||
if ! ifconfig $os_wlan &>/dev/null; then
|
if ! ifconfig ${OS_WLAN} &>/dev/null; then
|
||||||
msg_fail "no device"
|
msg_fail "no device"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$(cat /sys/class/net/$os_wlan/carrier 2>/dev/null)" != "1" ]]; then
|
if [[ "$(cat /sys/class/net/${OS_WLAN}/carrier 2>/dev/null)" != "1" ]]; then
|
||||||
msg_fail "no link"
|
msg_fail "no link"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$mtu" ]]; then
|
if [[ -n "${mtu}" ]]; then
|
||||||
ip link set mtu $mtu dev $os_wlan
|
ip link set mtu ${mtu} dev ${OS_WLAN}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$static_ip" ]]; then
|
if [[ -n "${STATIC_IP}" ]]; then
|
||||||
msg_done $static_ip
|
msg_done ${STATIC_IP}
|
||||||
ifconfig $os_wlan $static_ip up
|
ifconfig ${OS_WLAN} ${STATIC_IP} up
|
||||||
static_ip="" # won't be used again
|
STATIC_IP="" # won't be used again
|
||||||
else
|
else
|
||||||
msg_done dhcp
|
msg_done dhcp
|
||||||
dhclient -cf "$dh_conf" $os_wlan
|
dhclient -cf "${DH_CONF}" ${OS_WLAN}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$ip_watch" == "true" ]] && ip addr show dev $os_wlan | grep inet &>/dev/null; then
|
if [[ "${IP_WATCH}" == "true" ]] && ip addr show dev ${OS_WLAN} | grep inet &>/dev/null; then
|
||||||
watch_ip $os_wlan &
|
watch_ip ${OS_WLAN} &
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,86 +96,86 @@ start_eth() {
|
|||||||
# wait for driver
|
# wait for driver
|
||||||
w=3
|
w=3
|
||||||
count=0
|
count=0
|
||||||
while ! ifconfig $os_eth >/dev/null 2>&1; do
|
while ! ifconfig ${OS_ETH} >/dev/null 2>&1; do
|
||||||
sleep 1
|
sleep 1
|
||||||
count=$(($count + 1))
|
count=$((${count} + 1))
|
||||||
if [[ $count -ge $w ]]; then
|
if [[ ${count} -ge ${w} ]]; then
|
||||||
msg_done "no device"
|
msg_done "no device"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# bring it up
|
# bring it up
|
||||||
ifconfig $os_eth up
|
ifconfig ${OS_ETH} up
|
||||||
|
|
||||||
# wait for operstate
|
# wait for operstate
|
||||||
w=3
|
w=3
|
||||||
count=0
|
count=0
|
||||||
while [[ "$(cat /sys/class/net/$os_eth/operstate 2>&1)" == "unknown" ]]; do
|
while [[ "$(cat /sys/class/net/${OS_ETH}/operstate 2>&1)" == "unknown" ]]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
count=$(($count + 1))
|
count=$((${count} + 1))
|
||||||
if [[ $count -ge $w ]]; then
|
if [[ ${count} -ge ${w} ]]; then
|
||||||
msg_done "no link"
|
msg_done "no link"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# wait for link
|
# wait for link
|
||||||
test "$link_watch" == "true" || link_nego_timeout=5
|
test "${LINK_WATCH}" == "true" || LINK_NEGO_TIMEOUT=5
|
||||||
count=0
|
count=0
|
||||||
while [[ "$(cat /sys/class/net/$os_eth/carrier 2>&1)" != "1" ]]; do
|
while [[ "$(cat /sys/class/net/${OS_ETH}/carrier 2>&1)" != "1" ]]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
count=$(($count + 1))
|
count=$((${count} + 1))
|
||||||
if [[ $count -ge $link_nego_timeout ]]; then
|
if [[ ${count} -ge ${LINK_NEGO_TIMEOUT} ]]; then
|
||||||
msg_done "no link"
|
msg_done "no link"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -n "$mtu" ]]; then
|
if [[ -n "${mtu}" ]]; then
|
||||||
ip link set mtu $mtu dev $os_eth
|
ip link set mtu ${mtu} dev ${OS_ETH}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$static_ip" ]]; then
|
if [[ -n "${STATIC_IP}" ]]; then
|
||||||
msg_done $static_ip
|
msg_done ${STATIC_IP}
|
||||||
ifconfig $os_eth $static_ip up
|
ifconfig ${OS_ETH} ${STATIC_IP} up
|
||||||
static_ip="" # won't be used again
|
STATIC_IP="" # won't be used again
|
||||||
else
|
else
|
||||||
msg_done dhcp
|
msg_done dhcp
|
||||||
dhclient -cf "$dh_conf" $os_eth
|
dhclient -cf "${DH_CONF}" ${OS_ETH}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$link_watch" == "true" ]]; then
|
if [[ "${LINK_WATCH}" == "true" ]]; then
|
||||||
watch_eth &
|
watch_eth &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$ip_watch" == "true" ]] && ip addr show dev $os_eth | grep inet &>/dev/null; then
|
if [[ "${IP_WATCH}" == "true" ]] && ip addr show dev ${OS_ETH} | grep inet &>/dev/null; then
|
||||||
watch_ip $os_eth &
|
watch_ip ${OS_ETH} &
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
hostname=$(hostname)
|
hostname=$(hostname)
|
||||||
echo "send host-name = \"$hostname\";" > /var/cache/dhclient.conf
|
echo "send host-name = \"${hostname}\";" > /var/cache/dhclient.conf
|
||||||
|
|
||||||
start_lo
|
start_lo
|
||||||
|
|
||||||
test "$os_networkless" == "true" && return 0
|
test "${OS_NETWORKLESS}" == "true" && return 0
|
||||||
|
|
||||||
ssid=$(cat /data/etc/wpa_supplicant.conf 2>&1 | grep ssid | grep -v scan_ssid | cut -d '"' -f 2)
|
ssid=$(cat /data/etc/wpa_supplicant.conf 2>&1 | grep ssid | grep -v scan_ssid | cut -d '"' -f 2)
|
||||||
test -n "$ssid" && start_wlan && wlan_ok="ok"
|
test -n "${ssid}" && start_wlan && wlan_ok="ok"
|
||||||
|
|
||||||
test -r /data/etc/ppp/modem && ifconfig | grep $os_ppp &>/dev/null && ppp_ok="ok"
|
test -r /data/etc/ppp/modem && ifconfig | grep ${OS_PPP} &>/dev/null && ppp_ok="ok"
|
||||||
|
|
||||||
# if wifi or ppp link ok, start eth in background
|
# if wifi or ppp link ok, start eth in background
|
||||||
if [[ "$wlan_ok" == "ok" ]] || [[ "$ppp_ok" == "ok" ]]; then
|
if [[ "${wlan_ok}" == "ok" ]] || [[ "${ppp_ok}" == "ok" ]]; then
|
||||||
start_eth &>/dev/null &
|
start_eth &>/dev/null &
|
||||||
else
|
else
|
||||||
start_eth && eth_ok="ok"
|
start_eth && eth_ok="ok"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$eth_ok" != "ok" ]] && [[ "$wlan_ok" != "ok" ]] && [[ "$ppp_ok" != "ok" ]]; then
|
if [[ "${eth_ok}" != "ok" ]] && [[ "${wlan_ok}" != "ok" ]] && [[ "${ppp_ok}" != "ok" ]]; then
|
||||||
if [[ "$link_watch" == "true" ]]; then
|
if [[ "${LINK_WATCH}" == "true" ]]; then
|
||||||
logger -t network -s "no network connection available, calling panic action"
|
logger -t network -s "no network connection available, calling panic action"
|
||||||
panic_action network
|
panic_action network
|
||||||
return 1
|
return 1
|
||||||
@ -189,15 +185,15 @@ start() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$static_gw" ]]; then
|
if [[ -n "${STATIC_GW}" ]]; then
|
||||||
msg_begin "Setting static gateway to $static_gw"
|
msg_begin "Setting static gateway to ${STATIC_GW}"
|
||||||
ip route add default via $static_gw
|
ip route add default via ${STATIC_GW}
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "$static_dns" ]]; then
|
if [[ -n "${STATIC_DNS}" ]]; then
|
||||||
msg_begin "Setting static DNS server to $static_dns"
|
msg_begin "Setting static DNS server to ${STATIC_DNS}"
|
||||||
echo "nameserver $static_dns" > /etc/resolv.conf
|
echo "nameserver ${STATIC_DNS}" > /etc/resolv.conf
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -1,34 +1,38 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
watch_conf="/data/etc/watch.conf"
|
CONF="/data/etc/watch.conf"
|
||||||
netwatch_retries=3
|
NETWATCH_RETRIES=3
|
||||||
netwatch_timeout=5
|
NETWATCH_TIMEOUT=5
|
||||||
netwatch_interval=20
|
NETWATCH_INTERVAL=20
|
||||||
|
|
||||||
test -f $watch_conf && source $watch_conf || exit 0
|
|
||||||
|
|
||||||
if [[ -z "$netwatch_host" ]] || [[ -z "$netwatch_port" ]]; then
|
# watch configuration is already prepared by wifi init script
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -f ${CONF} || exit 0
|
||||||
|
source ${CONF}
|
||||||
|
|
||||||
|
test -n "${NETWATCH_HOST}" || exit 0
|
||||||
|
test -n "${NETWATCH_PORT}" || exit 0
|
||||||
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
|
test "${OS_NETWORKLESS}" == "true" && exit 0
|
||||||
|
|
||||||
test "$os_networkless" == "true" && exit 0
|
|
||||||
|
|
||||||
watch() {
|
watch() {
|
||||||
count=0
|
count=0
|
||||||
netwatch_retries=$(($netwatch_retries - 1))
|
NETWATCH_RETRIES=$((${NETWATCH_RETRIES} - 1))
|
||||||
while true; do
|
while true; do
|
||||||
sleep $netwatch_interval
|
sleep ${NETWATCH_INTERVAL}
|
||||||
if nc -z -w $netwatch_timeout $netwatch_host $netwatch_port </dev/null >/dev/null 2>&1; then
|
if nc -z -w ${NETWATCH_TIMEOUT} ${NETWATCH_HOST} ${NETWATCH_PORT} </dev/null >/dev/null 2>&1; then
|
||||||
count=0
|
count=0
|
||||||
else
|
else
|
||||||
if [[ $count -lt $netwatch_retries ]]; then
|
if [[ ${count} -lt ${NETWATCH_RETRIES} ]]; then
|
||||||
logger -t netwatch -s "cannot connect to $netwatch_host:$netwatch_port"
|
logger -t netwatch -s "cannot connect to ${NETWATCH_HOST}:${NETWATCH_PORT}"
|
||||||
count=$(($count + 1))
|
count=$((${count} + 1))
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
logger -t netwatch -s "cannot connect to $netwatch_host:$netwatch_port, calling panic action"
|
logger -t netwatch -s "cannot connect to ${NETWATCH_HOST}:${NETWATCH_PORT}, calling panic action"
|
||||||
panic_action netwatch
|
panic_action netwatch
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
@ -1,25 +1,20 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
sys_conf="/etc/firewall.sh"
|
SYS_CONF="/etc/firewall.sh"
|
||||||
boot_conf="/boot/firewall.sh"
|
BOOT_CONF="/boot/firewall.sh"
|
||||||
conf="/data/etc/firewall.sh"
|
CONF="/data/etc/firewall.sh"
|
||||||
|
|
||||||
if ! [[ -f $conf ]]; then
|
|
||||||
if [[ -f $boot_conf ]]; then
|
|
||||||
cp $boot_conf $conf
|
|
||||||
elif [[ -f $sys_conf ]]; then
|
|
||||||
cp $sys_conf $conf
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
test -f $conf || exit 0
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
|
prepare_conf ${CONF} ${SYS_CONF} ${BOOT_CONF}
|
||||||
|
test -f ${CONF} || exit 0
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
msg_begin "Starting firewall"
|
msg_begin "Starting firewall"
|
||||||
|
|
||||||
bash $conf
|
bash ${CONF}
|
||||||
|
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
}
|
}
|
||||||
|
@ -1,40 +1,37 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
sys_conf="/etc/dnsmasq.conf"
|
SYS_CONF="/etc/dnsmasq.conf"
|
||||||
boot_conf="/boot/dnsmasq.conf"
|
BOOT_CONF="/boot/dnsmasq.conf"
|
||||||
conf="/data/etc/dnsmasq.conf"
|
CONF="/data/etc/dnsmasq.conf"
|
||||||
|
|
||||||
log="/var/log/dnsmasq.log"
|
LOG="/var/log/dnsmasq.log"
|
||||||
prog="/usr/sbin/dnsmasq"
|
PROG="/usr/sbin/dnsmasq"
|
||||||
|
|
||||||
if ! [[ -f $conf ]]; then
|
|
||||||
if [[ -f $boot_conf ]]; then
|
|
||||||
cp $boot_conf $conf
|
|
||||||
elif [[ -f $sys_conf ]]; then
|
|
||||||
cp $sys_conf $conf
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
test -f $conf || exit 0
|
test -x ${PROG} || exit 0
|
||||||
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
|
prepare_conf ${CONF} ${SYS_CONF} ${BOOT_CONF}
|
||||||
|
test -f ${CONF} || exit 0
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
msg_begin "Starting dnsmasq"
|
msg_begin "Starting dnsmasq"
|
||||||
|
|
||||||
iface=$(cat $conf | grep interface | cut -d '=' -f 2)
|
iface=$(cat ${CONF} | grep interface | cut -d '=' -f 2)
|
||||||
ip=$(cat $conf | grep range | cut -d '=' -f 2 | cut -d '.' -f 1,2,3).1
|
ip=$(cat ${CONF} | grep range | cut -d '=' -f 2 | cut -d '.' -f 1,2,3).1
|
||||||
|
|
||||||
ifconfig $iface $ip
|
ifconfig ${iface} ${ip}
|
||||||
|
|
||||||
$prog -C $conf --log-facility=$log
|
${PROG} -C ${CONF} --log-facility=${LOG}
|
||||||
|
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
msg_begin "Stopping dnsmasq"
|
msg_begin "Stopping dnsmasq"
|
||||||
killall dnsmasq &>/dev/null
|
killall -q $(basename ${PROG})
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,64 +1,53 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Date executable points to /bin/busybox\ date explicitly in the cases that date binary gets overwritten
|
# Date executable points to /bin/busybox\ date explicitly in the cases that date binary gets overwritten
|
||||||
date_exec=/bin/busybox\ date
|
DATE_PROG=/bin/busybox\ date
|
||||||
|
|
||||||
sys_conf="/etc/date.conf"
|
SYS_CONF="/etc/date.conf"
|
||||||
boot_conf="/boot/date.conf"
|
BOOT_CONF="/boot/date.conf"
|
||||||
conf="/data/etc/date.conf"
|
CONF="/data/etc/date.conf"
|
||||||
|
|
||||||
sys_ntp_conf="/etc/ntp.conf"
|
SYS_NTP_CONF="/etc/ntp.conf"
|
||||||
boot_ntp_conf="/boot/ntp.conf"
|
BOOT_NTP_CONF="/boot/ntp.conf"
|
||||||
ntp_conf="/data/etc/ntp.conf"
|
NTP_CONF="/data/etc/ntp.conf"
|
||||||
|
|
||||||
if ! [[ -f $conf ]]; then
|
|
||||||
if [[ -f $boot_conf ]]; then
|
|
||||||
cp $boot_conf $conf
|
|
||||||
elif [[ -f $sys_conf ]]; then
|
|
||||||
cp $sys_conf $conf
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! [[ -f $ntp_conf ]]; then
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
if [[ -f $boot_ntp_conf ]]; then
|
|
||||||
cp $boot_ntp_conf $ntp_conf
|
|
||||||
elif [[ -f $sys_ntp_conf ]]; then
|
|
||||||
cp $sys_ntp_conf $ntp_conf
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
test -f $conf || exit 0
|
prepare_conf ${CONF} ${SYS_CONF} ${BOOT_CONF}
|
||||||
|
prepare_conf ${NTP_CONF} ${SYS_NTP_CONF} ${BOOT_NTP_CONF}
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -f ${CONF} || exit 0
|
||||||
|
|
||||||
test "$os_networkless" == "true" && exit 0
|
test "${OS_NETWORKLESS}" == "true" && exit 0
|
||||||
|
|
||||||
date_timeout=10
|
date_timeout=10
|
||||||
date_method=http
|
date_method=http
|
||||||
date_host="google.com"
|
date_host="google.com"
|
||||||
date_interval="900"
|
date_interval="900"
|
||||||
|
|
||||||
source $conf
|
source ${CONF}
|
||||||
|
|
||||||
|
|
||||||
set_current_date_http() {
|
set_current_date_http() {
|
||||||
date_str=$(curl -v -s -m $date_timeout -X GET http://$date_host 2>&1 | grep Date | sed -e 's/< Date: //')
|
date_str=$(curl -v -s -m ${date_timeout} -X GET http://${date_host} 2>&1 | grep Date | sed -e 's/< Date: //')
|
||||||
test -z "$date_str" && return 1
|
test -z "${date_str}" && return 1
|
||||||
$date_exec -u -D "%a, %d %b %Y %H:%M:%S" -s "$date_str" > /dev/null
|
${DATE_PROG} -u -D "%a, %d %b %Y %H:%M:%S" -s "${date_str}" > /dev/null
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
set_current_date_ntp() {
|
set_current_date_ntp() {
|
||||||
cat $ntp_conf | grep server | head -n 1 | cut -d ' ' -f 2 | xargs ntpdate -t $date_timeout -s
|
cat ${NTP_CONF} | grep server | head -n 1 | cut -d ' ' -f 2 | xargs ntpdate -t ${date_timeout} -s
|
||||||
}
|
}
|
||||||
|
|
||||||
start_http() {
|
start_http() {
|
||||||
msg_begin "Setting current date using http"
|
msg_begin "Setting current date using http"
|
||||||
set_current_date_http || set_current_date_http
|
set_current_date_http || set_current_date_http
|
||||||
test $? == 0 && msg_done "$($date_exec)" || msg_fail
|
test $? == 0 && msg_done "$(${DATE_PROG})" || msg_fail
|
||||||
|
|
||||||
msg_begin "Starting http date updater"
|
msg_begin "Starting http date updater"
|
||||||
while true; do
|
while true; do
|
||||||
sleep $date_interval
|
sleep ${date_interval}
|
||||||
set_current_date_http
|
set_current_date_http
|
||||||
done &
|
done &
|
||||||
msg_done
|
msg_done
|
||||||
@ -67,23 +56,23 @@ start_http() {
|
|||||||
start_ntp() {
|
start_ntp() {
|
||||||
mkdir -p /var/lib/ntp
|
mkdir -p /var/lib/ntp
|
||||||
|
|
||||||
cat $ntp_conf | grep -v iburst > ${ntp_conf}.tmp
|
cat ${NTP_CONF} | grep -v iburst > ${NTP_CONF}.tmp
|
||||||
|
|
||||||
if [[ -n "$date_ntp_server" ]]; then
|
if [[ -n "${date_ntp_server}" ]]; then
|
||||||
echo "server $date_ntp_server iburst" > $ntp_conf
|
echo "server ${date_ntp_server} iburst" > ${NTP_CONF}
|
||||||
else
|
else
|
||||||
cat $sys_ntp_conf | grep iburst > $ntp_conf
|
cat ${SYS_NTP_CONF} | grep iburst > ${NTP_CONF}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat ${ntp_conf}.tmp >> $ntp_conf
|
cat ${NTP_CONF}.tmp >> ${NTP_CONF}
|
||||||
rm ${ntp_conf}.tmp
|
rm ${NTP_CONF}.tmp
|
||||||
|
|
||||||
msg_begin "Setting current date using ntp"
|
msg_begin "Setting current date using ntp"
|
||||||
set_current_date_ntp || set_current_date_ntp
|
set_current_date_ntp || set_current_date_ntp
|
||||||
test $? == 0 && msg_done "$($date_exec)" || msg_fail
|
test $? == 0 && msg_done "$(${DATE_PROG})" || msg_fail
|
||||||
|
|
||||||
msg_begin "Starting ntpd"
|
msg_begin "Starting ntpd"
|
||||||
ntpd -g -c $ntp_conf
|
ntpd -g -c ${NTP_CONF}
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,17 +89,17 @@ stop_ntp() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
if [[ "$date_method" == "http" ]]; then
|
if [[ "${date_method}" == "http" ]]; then
|
||||||
start_http
|
start_http
|
||||||
else
|
else
|
||||||
start_ntp
|
start_ntp
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "system date is $($date_exec '+%Y-%m-%d %H:%M:%S')" > /dev/kmsg
|
echo "system date is $(${DATE_PROG} '+%Y-%m-%d %H:%M:%S')" > /dev/kmsg
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
if [[ "$date_method" == "http" ]]; then
|
if [[ "${date_method}" == "http" ]]; then
|
||||||
stop_http
|
stop_http
|
||||||
else
|
else
|
||||||
stop_ntp
|
stop_ntp
|
||||||
|
@ -1,26 +1,32 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
sys_conf="/etc/crontabs"
|
SYS_CONF="/etc/crontabs"
|
||||||
conf="/data/etc/crontabs"
|
CONF="/data/etc/crontabs"
|
||||||
|
|
||||||
|
PROG="/usr/sbin/crond"
|
||||||
|
|
||||||
|
|
||||||
|
test -x ${PROG} || exit 0
|
||||||
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
msg_begin "Starting crond"
|
msg_begin "Starting crond"
|
||||||
|
|
||||||
if [[ -d $sys_conf ]]; then
|
if [[ -d ${SYS_CONF} ]]; then
|
||||||
/usr/sbin/crond -c $sys_conf
|
${PROG} -c ${SYS_CONF}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p $conf
|
mkdir -p ${CONF}
|
||||||
/usr/sbin/crond -c $conf
|
${PROG} -c ${CONF}
|
||||||
|
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
msg_begin "Stopping crond"
|
msg_begin "Stopping crond"
|
||||||
killall crond &>/dev/null
|
killall -q $(basename ${PROG})
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,34 +1,41 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
conf="/etc/sshd_config"
|
CONF="/etc/sshd_config"
|
||||||
|
|
||||||
test -f $conf || exit 0
|
PROG="/usr/sbin/sshd"
|
||||||
|
PROG_KG="/usr/bin/ssh-keygen"
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
|
||||||
|
|
||||||
test "$os_networkless" == "true" && exit 0
|
test -x ${PROG} || exit 0
|
||||||
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
|
test -f ${CONF} || exit 0
|
||||||
|
|
||||||
|
test "${OS_NETWORKLESS}" == "true" && exit 0
|
||||||
|
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
msg_begin "Starting sshd"
|
msg_begin "Starting sshd"
|
||||||
|
|
||||||
# create any missing keys
|
# create any missing keys
|
||||||
if ! /usr/bin/ssh-keygen -A >/dev/null; then
|
if ! ${PROG_KG} -A >/dev/null; then
|
||||||
msg_fail
|
msg_fail
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
umask 077
|
umask 077
|
||||||
hostname=$(hostname)
|
hostname=$(hostname)
|
||||||
echo "Welcome to $hostname!" > /var/cache/sshd_banner
|
echo "Welcome to ${hostname}!" > /var/cache/sshd_banner
|
||||||
sync
|
sync
|
||||||
|
|
||||||
/usr/sbin/sshd -f $conf
|
${PROG} -f ${CONF}
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
msg_begin "Stopping sshd"
|
msg_begin "Stopping sshd"
|
||||||
killall sshd &>/dev/null
|
killall -q $(basename ${PROG})
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,23 +1,30 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
test -f /etc/proftpd.conf || exit 0
|
CONF="/etc/proftpd.conf"
|
||||||
|
PROG="/usr/sbin/proftpd"
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
|
||||||
test -n "$os_debug" || source /etc/init.d/conf
|
|
||||||
|
|
||||||
test "$os_networkless" == "true" && exit 0
|
test -x ${PROG} || exit 0
|
||||||
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
test -n "${OS_DEBUG}" || source /etc/init.d/conf
|
||||||
|
|
||||||
|
test -f ${CONF} || exit 0
|
||||||
|
|
||||||
|
test "${OS_NETWORKLESS}" == "true" && exit 0
|
||||||
|
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
msg_begin "Starting proftpd"
|
msg_begin "Starting proftpd"
|
||||||
mkdir -p /var/run/proftpd
|
mkdir -p /var/run/proftpd
|
||||||
touch /var/log/wtmp
|
touch /var/log/wtmp
|
||||||
/usr/sbin/proftpd &>/dev/null
|
${PROG} &>/dev/null
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
msg_begin "Stopping proftpd"
|
msg_begin "Stopping proftpd"
|
||||||
killall proftpd &>/dev/null
|
killall -q $(basename ${PROG})
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,32 +1,41 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
test -f /etc/samba/smb.conf || exit 0
|
CONF="/etc/samba/smb.conf"
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
PROG="/usr/sbin/smbd"
|
||||||
test -n "$os_debug" || source /etc/init.d/conf
|
PROG_N="/usr/sbin/nmbd"
|
||||||
|
|
||||||
|
|
||||||
|
test -x ${PROG} || exit 0
|
||||||
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
test -n "${OS_DEBUG}" || source /etc/init.d/conf
|
||||||
|
|
||||||
|
test -f ${CONF} || exit 0
|
||||||
|
|
||||||
|
test "${OS_NETWORKLESS}" == "true" && exit 0
|
||||||
|
|
||||||
test "$os_networkless" == "true" && exit 0
|
|
||||||
|
|
||||||
start() {
|
start() {
|
||||||
mkdir -p /var/log/samba
|
mkdir -p /var/log/samba
|
||||||
mkdir -p /var/lib/samba/private
|
mkdir -p /var/lib/samba/private
|
||||||
|
|
||||||
msg_begin "Starting smbd"
|
msg_begin "Starting smbd"
|
||||||
smbd -D
|
${PROG} -D
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
|
|
||||||
msg_begin "Starting nmbd"
|
msg_begin "Starting nmbd"
|
||||||
nmbd -D
|
${PROG_N} -D
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
msg_begin "Stopping smbd"
|
msg_begin "Stopping smbd"
|
||||||
killall smbd &>/dev/null
|
killall -q $(basename ${PROG})
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
|
|
||||||
msg_begin "Stopping nmbd"
|
msg_begin "Stopping nmbd"
|
||||||
killall nmbd &>/dev/null
|
killall -q $(basename ${PROG_N})
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
50
board/common/overlay/etc/init.d/S70mongod
Executable file
50
board/common/overlay/etc/init.d/S70mongod
Executable file
@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SYS_CONF="/etc/mongodb.conf"
|
||||||
|
BOOT_CONF="/boot/mongodb.conf"
|
||||||
|
CONF="/data/etc/mongodb.conf"
|
||||||
|
|
||||||
|
PROG="/usr/bin/mongod"
|
||||||
|
|
||||||
|
|
||||||
|
test -x ${PROG} || exit 0
|
||||||
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
|
prepare_conf ${CONF} ${SYS_CONF} ${BOOT_CONF}
|
||||||
|
test -f ${CONF} || exit 0
|
||||||
|
|
||||||
|
|
||||||
|
start() {
|
||||||
|
msg_begin "Starting mongod"
|
||||||
|
db_dir=$(cat ${CONF} | grep dbpath | cut -d '=' -f 2)
|
||||||
|
mkdir -p ${db_dir}
|
||||||
|
${PROG} -f ${CONF} --fork > /dev/null
|
||||||
|
test $? == 0 && msg_done || msg_fail
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
msg_begin "Stopping mongod"
|
||||||
|
killall -q $(basename ${PROG})
|
||||||
|
test $? == 0 && msg_done || msg_fail
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
|
||||||
|
stop)
|
||||||
|
stop
|
||||||
|
;;
|
||||||
|
|
||||||
|
restart)
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {start|stop|restart}"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
50
board/common/overlay/etc/init.d/S71redis
Executable file
50
board/common/overlay/etc/init.d/S71redis
Executable file
@ -0,0 +1,50 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SYS_CONF="/etc/redis.conf"
|
||||||
|
BOOT_CONF="/boot/redis.conf"
|
||||||
|
CONF="/data/etc/redis.conf"
|
||||||
|
|
||||||
|
PROG="/usr/bin/redis-server"
|
||||||
|
|
||||||
|
|
||||||
|
test -x ${PROG} || exit 0
|
||||||
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
|
prepare_conf ${CONF} ${SYS_CONF} ${BOOT_CONF}
|
||||||
|
test -f ${CONF} || exit 0
|
||||||
|
|
||||||
|
|
||||||
|
start() {
|
||||||
|
msg_begin "Starting redis"
|
||||||
|
db_dir=$(cat ${CONF} | grep -E '^dir' | cut -d ' ' -f 2)
|
||||||
|
mkdir -p ${db_dir}
|
||||||
|
${PROG} ${CONF}
|
||||||
|
test $? == 0 && msg_done || msg_fail
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
msg_begin "Stopping redis"
|
||||||
|
killall -q $(basename ${PROG})
|
||||||
|
test $? == 0 && msg_done || msg_fail
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
|
||||||
|
stop)
|
||||||
|
stop
|
||||||
|
;;
|
||||||
|
|
||||||
|
restart)
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {start|stop|restart}"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
70
board/common/overlay/etc/init.d/S72postgresql
Executable file
70
board/common/overlay/etc/init.d/S72postgresql
Executable file
@ -0,0 +1,70 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
BOOT_CONF="/boot/postgresql.conf"
|
||||||
|
SYS_CONF="/etc/postgresql.conf"
|
||||||
|
CONF="/data/etc/postgresql.conf"
|
||||||
|
|
||||||
|
PROG="/usr/bin/pg_ctl"
|
||||||
|
|
||||||
|
DB_DIR="/var/lib/postgresql"
|
||||||
|
USER="postgres"
|
||||||
|
LOG="/var/log/postgresql.log"
|
||||||
|
|
||||||
|
|
||||||
|
function run_pg_ctl() {
|
||||||
|
su ${USER} -c "pg_ctl $*"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
test -x ${PROG} || exit 0
|
||||||
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
|
prepare_conf ${CONF} ${SYS_CONF} ${BOOT_CONF}
|
||||||
|
|
||||||
|
|
||||||
|
start() {
|
||||||
|
mkdir -p ${DB_DIR}
|
||||||
|
chown -R ${USER} ${DB_DIR}
|
||||||
|
touch ${LOG}
|
||||||
|
chown ${USER} ${LOG}
|
||||||
|
cd ${DB_DIR}
|
||||||
|
|
||||||
|
if [[ ! -f ${DB_DIR}/PG_VERSION ]]; then
|
||||||
|
msg_begin "Initializing postgresql db"
|
||||||
|
run_pg_ctl initdb -s -D ${DB_DIR} &>> ${LOG}
|
||||||
|
test $? == 0 && msg_done || msg_fail
|
||||||
|
|
||||||
|
echo "include_if_exists = '/data/etc/postgresql.conf'" >> ${DB_DIR}/postgresql.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
msg_begin "Starting postgresql"
|
||||||
|
run_pg_ctl start -s -D ${DB_DIR} -l ${LOG}
|
||||||
|
test $? == 0 && msg_done || msg_fail
|
||||||
|
}
|
||||||
|
|
||||||
|
stop() {
|
||||||
|
msg_begin "Stopping postgresql"
|
||||||
|
run_pg_ctl stop -s -D ${DB_DIR} -m fast &>> ${LOG}
|
||||||
|
test $? == 0 && msg_done || msg_fail
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
|
||||||
|
stop)
|
||||||
|
stop
|
||||||
|
;;
|
||||||
|
|
||||||
|
restart)
|
||||||
|
stop
|
||||||
|
start
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 {start|stop|restart}"
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
@ -1,35 +1,30 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
sys_conf="/etc/motioneye.conf"
|
SYS_CONF="/etc/motioneye.conf"
|
||||||
boot_conf="/boot/motioneye.conf"
|
BOOT_CONF="/boot/motioneye.conf"
|
||||||
conf="/data/etc/motioneye.conf"
|
CONF="/data/etc/motioneye.conf"
|
||||||
motion_conf="/data/etc/motion.conf"
|
MOTION_CONF="/data/etc/motion.conf"
|
||||||
watch_conf="/data/etc/watch.conf"
|
WATCH_CONF="/data/etc/watch.conf"
|
||||||
|
|
||||||
meyewatch_timeout=120
|
MEYEWATCH_TIMEOUT=120
|
||||||
meyewatch_disable="false"
|
MEYEWATCH_DISABLE="false"
|
||||||
dev_v4l_by_id="/dev/v4l/by-id/"
|
DEV_V4L_BY_ID="/dev/v4l/by-id/"
|
||||||
media_dir="/data/output"
|
MEDIA_DIR="/data/output"
|
||||||
|
|
||||||
if ! [ -f $conf ]; then
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
if [ -f $boot_conf ]; then
|
|
||||||
cp $boor_conf $conf
|
|
||||||
elif [ -f $sys_conf ]; then
|
|
||||||
cp $sys_conf $conf
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
test -f "$conf" || exit 0
|
prepare_conf ${CONF} ${SYS_CONF} ${BOOT_CONF}
|
||||||
|
|
||||||
test -r $watch_conf && source $watch_conf
|
test -f "${CONF}" || exit 0
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -r ${WATCH_CONF} && source ${WATCH_CONF}
|
||||||
|
|
||||||
opts=$(cat "$conf" | while read line; do echo "--$line"; done)
|
|
||||||
port=$(echo "$opts" | grep -oE 'port [[:digit:]]+' | cut -d ' ' -f 2)
|
opts=$(cat "${CONF}" | while read line; do echo "--${line}"; done)
|
||||||
|
port=$(echo "${opts}" | grep -oE 'port [[:digit:]]+' | cut -d ' ' -f 2)
|
||||||
|
|
||||||
responsive() {
|
responsive() {
|
||||||
curl -m 2 --head http://127.0.0.1:$port &>/dev/null && return 0 || return 1
|
curl -m 2 --head http://127.0.0.1:${port} &>/dev/null && return 0 || return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
watch() {
|
watch() {
|
||||||
@ -39,10 +34,10 @@ watch() {
|
|||||||
if responsive; then
|
if responsive; then
|
||||||
count=0
|
count=0
|
||||||
else
|
else
|
||||||
if [ $count -lt $meyewatch_timeout ]; then
|
if [ ${count} -lt ${MEYEWATCH_TIMEOUT} ]; then
|
||||||
count=$(($count + 5))
|
count=$((${count} + 5))
|
||||||
else
|
else
|
||||||
logger -t motioneye -s "not responding for $meyewatch_timeout seconds, rebooting"
|
logger -t motioneye -s "not responding for ${MEYEWATCH_TIMEOUT} seconds, rebooting"
|
||||||
reboot
|
reboot
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -52,39 +47,39 @@ watch() {
|
|||||||
find_persistent_device() {
|
find_persistent_device() {
|
||||||
device=$1
|
device=$1
|
||||||
|
|
||||||
if ! [ -d $dev_v4l_by_id ]; then
|
if ! [ -d ${DEV_V4L_BY_ID} ]; then
|
||||||
echo $device
|
echo ${device}
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for p in $dev_v4l_by_id/*; do
|
for p in ${DEV_V4L_BY_ID}/*; do
|
||||||
if [ $(realpath "$p") == $device ]; then
|
if [ $(realpath "${p}") == ${device} ]; then
|
||||||
echo $p | sed 's#//*#/#g'
|
echo ${p} | sed 's#//*#/#g'
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo $device
|
echo ${device}
|
||||||
}
|
}
|
||||||
|
|
||||||
add_mmal_cameras() {
|
add_mmal_cameras() {
|
||||||
vcgencmd=$(which vcgencmd)
|
vcgencmd=$(which vcgencmd)
|
||||||
if [ -z "$vcgencmd" ]; then
|
if [ -z "${vcgencmd}" ]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
camera=$($vcgencmd get_camera 2>/dev/null)
|
camera=$(${vcgencmd} get_camera 2>/dev/null)
|
||||||
if [ "$camera" != "supported=1 detected=1" ]; then
|
if [ "${camera}" != "supported=1 detected=1" ]; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
output_dir="/data/output/camera1/"
|
output_dir="/data/output/camera1/"
|
||||||
loc="/config/add/?_username=admin"
|
loc="/config/add/?_username=admin"
|
||||||
device="vc.ril.camera"
|
device="vc.ril.camera"
|
||||||
body="{\"path\": \"$device\", \"proto\": \"mmal\"}"
|
body="{\"path\": \"${device}\", \"proto\": \"mmal\"}"
|
||||||
signature=$(echo -n "POST:$loc:$body:" | sha1sum | cut -d ' ' -f 1)
|
signature=$(echo -n "POST:${loc}:${body}:" | sha1sum | cut -d ' ' -f 1)
|
||||||
|
|
||||||
curl -s -m 60 --data "$body" "http://127.0.0.1:$port$loc&_signature=$signature" > /dev/null
|
curl -s -m 60 --data "${body}" "http://127.0.0.1:${port}${loc}&_signature=${signature}" > /dev/null
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -93,20 +88,20 @@ add_v4l2_cameras() {
|
|||||||
index=1
|
index=1
|
||||||
for device in $(ls /dev/video* 2>/dev/null); do
|
for device in $(ls /dev/video* 2>/dev/null); do
|
||||||
# filter out devices that don't look like cameras
|
# filter out devices that don't look like cameras
|
||||||
if ! v4l2-ctl -d $device --list-formats-ext 2>/dev/null | grep -oE '[[:digit:]]+x[[:digit:]]+' &>/dev/null; then
|
if ! v4l2-ctl -d ${device} --list-formats-ext 2>/dev/null | grep -oE '[[:digit:]]+x[[:digit:]]+' &>/dev/null; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
output_dir="/data/output/camera$index/"
|
output_dir="/data/output/camera${index}/"
|
||||||
loc="/config/add/?_username=admin"
|
loc="/config/add/?_username=admin"
|
||||||
device=$(find_persistent_device $device)
|
device=$(find_persistent_device ${device})
|
||||||
body="{\"path\": \"$device\", \"proto\": \"v4l2\"}"
|
body="{\"path\": \"${device}\", \"proto\": \"v4l2\"}"
|
||||||
signature=$(echo -n "POST:$loc:$body:" | sha1sum | cut -d ' ' -f 1)
|
signature=$(echo -n "POST:${loc}:${body}:" | sha1sum | cut -d ' ' -f 1)
|
||||||
|
|
||||||
curl -s -m 60 --data "$body" "http://127.0.0.1:$port$loc&_signature=$signature" > /dev/null
|
curl -s -m 60 --data "${body}" "http://127.0.0.1:${port}${loc}&_signature=${signature}" > /dev/null
|
||||||
index=$(($index + 1))
|
index=$((${index} + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $index -gt 1 ]; then
|
if [ ${index} -gt 1 ]; then
|
||||||
return 0
|
return 0
|
||||||
else
|
else
|
||||||
return 1
|
return 1
|
||||||
@ -116,8 +111,8 @@ add_v4l2_cameras() {
|
|||||||
start() {
|
start() {
|
||||||
msg_begin "Starting motioneye"
|
msg_begin "Starting motioneye"
|
||||||
|
|
||||||
mkdir -p $media_dir
|
mkdir -p ${MEDIA_DIR}
|
||||||
meyectl startserver -b -c $conf -l
|
meyectl startserver -b -c ${CONF} -l
|
||||||
|
|
||||||
count=0
|
count=0
|
||||||
while true; do
|
while true; do
|
||||||
@ -127,22 +122,22 @@ start() {
|
|||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $count -gt $meyewatch_timeout ]; then
|
if [ ${count} -gt ${MEYEWATCH_TIMEOUT} ]; then
|
||||||
msg_fail
|
msg_fail
|
||||||
test "$meyewatch_disable" == "false" && reboot
|
test "${MEYEWATCH_DISABLE}" == "false" && reboot
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
count=$(($count + 1))
|
count=$((${count} + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
# add connected camera(s) with default settings
|
# add connected camera(s) with default settings
|
||||||
if responsive && ! [ -f $motion_conf ]; then
|
if responsive && ! [ -f ${MOTION_CONF} ]; then
|
||||||
add_mmal_cameras || add_v4l2_cameras
|
add_mmal_cameras || add_v4l2_cameras
|
||||||
sync
|
sync
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$meyewatch_disable" == "false" ]; then
|
if [ "${MEYEWATCH_DISABLE}" == "false" ]; then
|
||||||
watch &
|
watch &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -151,7 +146,7 @@ start() {
|
|||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
msg_begin "Stopping motioneye"
|
msg_begin "Stopping motioneye"
|
||||||
meyectl stopserver -c $conf &>/dev/null
|
meyectl stopserver -c ${CONF} &>/dev/null
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
ps | grep motioneye | grep -v $$ | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill
|
ps | grep motioneye | grep -v $$ | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
userinit_sh="/data/etc/userinit.sh"
|
USERINIT="/data/etc/userinit.sh"
|
||||||
|
|
||||||
test -f $userinit_sh || exit 0
|
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -f ${USERINIT} || exit 0
|
||||||
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
msg_begin "Executing user init script"
|
msg_begin "Executing user init script"
|
||||||
/bin/bash $userinit_sh
|
/bin/bash ${USERINIT}
|
||||||
test $? == 0 && msg_done || msg_fail
|
test $? == 0 && msg_done || msg_fail
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
msg_info() {
|
msg_info() {
|
||||||
echo " # $1"
|
echo " # $1"
|
||||||
@ -8,25 +8,25 @@ msg_info() {
|
|||||||
|
|
||||||
show_iface_ip_addr() {
|
show_iface_ip_addr() {
|
||||||
addr=$(ip addr show dev $1 2>/dev/null | grep inet | tr -s ' ' | sed -r 's/^\s+//' | cut -d ' ' -f 2)
|
addr=$(ip addr show dev $1 2>/dev/null | grep inet | tr -s ' ' | sed -r 's/^\s+//' | cut -d ' ' -f 2)
|
||||||
test -n "$addr" && msg_info "Interface $1 has IP address $addr"
|
test -n "${addr}" && msg_info "Interface $1 has IP address ${addr}"
|
||||||
}
|
}
|
||||||
|
|
||||||
show_gateway() {
|
show_gateway() {
|
||||||
gateway=$(ip route | grep default | cut -d ' ' -f 3)
|
gateway=$(ip route | grep default | cut -d ' ' -f 3)
|
||||||
test -n "$gateway" && msg_info "Default gateway is $gateway"
|
test -n "${gateway}" && msg_info "Default gateway is ${gateway}"
|
||||||
}
|
}
|
||||||
|
|
||||||
show_dns() {
|
show_dns() {
|
||||||
test -r /etc/resolv.conf || return
|
test -r /etc/resolv.conf || return
|
||||||
dns=$(cat /etc/resolv.conf | grep nameserver | head -n 1 | cut -d ' ' -f 2)
|
dns=$(cat /etc/resolv.conf | grep nameserver | head -n 1 | cut -d ' ' -f 2)
|
||||||
test -n "$dns" && msg_info "DNS server address is $dns"
|
test -n "${dns}" && msg_info "DNS server address is ${dns}"
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
show_iface_ip_addr $os_eth
|
show_iface_ip_addr ${OS_ETH}
|
||||||
show_iface_ip_addr $os_wlan
|
show_iface_ip_addr ${OS_WLAN}
|
||||||
show_iface_ip_addr $os_ppp
|
show_iface_ip_addr ${OS_PPP}
|
||||||
show_gateway
|
show_gateway
|
||||||
show_dns
|
show_dns
|
||||||
;;
|
;;
|
||||||
|
43
board/common/overlay/etc/init.d/base
Executable file → Normal file
43
board/common/overlay/etc/init.d/base
Executable file → Normal file
@ -1,13 +1,13 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
source /etc/version
|
source /etc/version
|
||||||
board_sn=$(/etc/init.d/boardsn)
|
BOARD_SN=$(/etc/init.d/boardsn)
|
||||||
board_name=$(cat /etc/board)
|
BOARD_NAME=$(cat /etc/board)
|
||||||
|
|
||||||
test -n "$os_debug" || source /etc/init.d/conf
|
test -n "${OS_DEBUG}" || source /etc/init.d/os_conf
|
||||||
|
|
||||||
source /etc/init.d/panic
|
source /etc/init.d/panic
|
||||||
|
|
||||||
|
|
||||||
msg_begin() {
|
msg_begin() {
|
||||||
echo -n " * $1: "
|
echo -n " * $1: "
|
||||||
}
|
}
|
||||||
@ -24,3 +24,38 @@ msg_background() {
|
|||||||
test -n "$1" && echo $1 || echo "pending"
|
test -n "$1" && echo $1 || echo "pending"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prepare_conf() {
|
||||||
|
# $1 - actual config file
|
||||||
|
# $2 - system-provided config file
|
||||||
|
# $3 - user-provided config file
|
||||||
|
|
||||||
|
# long story short:
|
||||||
|
# * user conf file takes precedence, if present
|
||||||
|
# * system conf file is used by default, if actual file absent
|
||||||
|
|
||||||
|
actual_conf="$1"
|
||||||
|
system_conf="$2"
|
||||||
|
user_conf="$3"
|
||||||
|
|
||||||
|
if [[ -n "${user_conf}" && -e "${user_conf}" ]]; then
|
||||||
|
cp -rf "${user_conf}" "${actual_conf}"
|
||||||
|
|
||||||
|
# we want only Unix newlines in conf files
|
||||||
|
if [[ -f "${actual_conf}" ]]; then
|
||||||
|
sed -i 's/\r//g' "${actual_conf}"
|
||||||
|
elif [[ -d "${actual_conf}" ]]; then
|
||||||
|
find "${actual_conf}" -type f | xargs -L1 sed -i 's/\r//g'
|
||||||
|
fi
|
||||||
|
|
||||||
|
grep -E "/boot .*ro[\s,]" /proc/mounts &>/dev/null
|
||||||
|
RO=$?
|
||||||
|
test ${RO} == 0 && mount -o remount,rw /boot
|
||||||
|
rm -rf ${user_conf}
|
||||||
|
test ${RO} == 0 && mount -o remount,ro /boot
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ ! -e "${actual_conf}" && -e "${system_conf}" ]]; then
|
||||||
|
cp "${system_conf}" "${actual_conf}"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -3,5 +3,5 @@
|
|||||||
source /etc/init.d/panic
|
source /etc/init.d/panic
|
||||||
|
|
||||||
# reset panic counter after a successful boot
|
# reset panic counter after a successful boot
|
||||||
echo 0 > ${_PANIC_COUNTER_FILE}
|
echo 0 > ${PANIC_COUNTER_FILE}
|
||||||
|
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
_sys_conf="/etc/os.conf"
|
|
||||||
_boot_conf="/boot/os.conf"
|
|
||||||
_conf="/data/etc/os.conf"
|
|
||||||
|
|
||||||
if ! [[ -d /data/etc ]]; then
|
|
||||||
# use boot/system variants if we don't have the data partition mounted
|
|
||||||
if [[ -f $_boot_conf ]]; then
|
|
||||||
source $_boot_conf
|
|
||||||
elif [[ -f $_sys_conf ]]; then
|
|
||||||
source $_sys_conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
return
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! [[ -f $_conf ]]; then
|
|
||||||
if [[ -f $_boot_conf ]]; then
|
|
||||||
cp $_boot_conf $_conf
|
|
||||||
elif [[ -f $_sys_conf ]]; then
|
|
||||||
cp $_sys_conf $_conf
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -f $_conf ]]; then
|
|
||||||
source $_conf
|
|
||||||
fi
|
|
||||||
|
|
21
board/common/overlay/etc/init.d/os_conf
Normal file
21
board/common/overlay/etc/init.d/os_conf
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
_SYS_CONF="/etc/os.conf"
|
||||||
|
_BOOT_CONF="/boot/os.conf"
|
||||||
|
_DATA_CONF="/data/etc/os.conf"
|
||||||
|
|
||||||
|
|
||||||
|
# source in all conf files in order of precedence
|
||||||
|
if [[ -f ${_SYS_CONF} ]]; then
|
||||||
|
source ${_SYS_CONF}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f ${_DATA_CONF} ]]; then
|
||||||
|
source ${_DATA_CONF}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f ${_BOOT_CONF} ]]; then
|
||||||
|
source ${_BOOT_CONF}
|
||||||
|
fi
|
||||||
|
|
||||||
|
unset _SYS_CONF _BOOT_CONF _DATA_CONF
|
||||||
|
|
17
board/common/overlay/etc/init.d/panic
Executable file → Normal file
17
board/common/overlay/etc/init.d/panic
Executable file → Normal file
@ -1,20 +1,19 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
_PANIC_COUNTER_FILE="/var/lib/panic_counter"
|
PANIC_COUNTER_FILE="/var/lib/panic_counter"
|
||||||
_PANIC_REBOOT_DELAY_FACTOR=10
|
PANIC_REBOOT_DELAY_FACTOR=10
|
||||||
_PANIC_REBOOT_DELAY_MAX=3600 # reboot at least once an hour in case of panic
|
PANIC_REBOOT_DELAY_MAX=3600 # reboot at least once an hour in case of panic
|
||||||
|
|
||||||
|
|
||||||
panic_action() {
|
panic_action() {
|
||||||
# read counter from file
|
# read counter from file
|
||||||
panic_counter=$(cat ${_PANIC_COUNTER_FILE} 2>/dev/null || echo 0)
|
panic_counter=$(cat ${PANIC_COUNTER_FILE} 2>/dev/null || echo 0)
|
||||||
|
|
||||||
# write increased counter back to file
|
# write increased counter back to file
|
||||||
echo $((panic_counter + 1)) > ${_PANIC_COUNTER_FILE}
|
echo $((panic_counter + 1)) > ${PANIC_COUNTER_FILE}
|
||||||
|
|
||||||
delay=$((_PANIC_REBOOT_DELAY_FACTOR * panic_counter))
|
delay=$((PANIC_REBOOT_DELAY_FACTOR * panic_counter))
|
||||||
if [[ "${delay}" -gt "${_PANIC_REBOOT_DELAY_MAX}" ]]; then
|
if [[ "${delay}" -gt "${PANIC_REBOOT_DELAY_MAX}" ]]; then
|
||||||
delay=${_PANIC_REBOOT_DELAY_MAX}
|
delay=${PANIC_REBOOT_DELAY_MAX}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "${delay}" -gt 0 ]]; then
|
if [[ "${delay}" -gt 0 ]]; then
|
||||||
|
@ -1,22 +1,22 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
boot_log=/var/log/boot.log
|
BOOT_LOG=/var/log/boot.log
|
||||||
pid_file=/tmp/rc.pid
|
PID_FILE=/tmp/rc.pid
|
||||||
|
|
||||||
source /etc/init.d/base
|
source /etc/init.d/base
|
||||||
|
|
||||||
echo "---- shutting down $os_name $os_version ----" >> $boot_log
|
echo "---- shutting down ${OS_NAME} ${OS_VERSION} ----" >> ${BOOT_LOG}
|
||||||
|
|
||||||
# stop all init scripts in /etc/init.d,
|
# stop all init scripts in /etc/init.d,
|
||||||
# executing them in reverse numerical order.
|
# executing them in reverse numerical order.
|
||||||
(for i in $(ls -r /etc/init.d/S??*); do
|
(for i in $(ls -r /etc/init.d/S??*); do
|
||||||
if ! [[ -x "$i" ]]; then continue; fi
|
if ! [[ -x "${i}" ]]; then continue; fi
|
||||||
if [[ -f /data/etc/no_$(basename $i) ]]; then continue; fi
|
if [[ -f /data/etc/no_$(basename ${i}) ]]; then continue; fi
|
||||||
$i stop
|
${i} stop
|
||||||
done& echo $! > $pid_file) | tee -a $boot_log &
|
done& echo $! > ${PID_FILE}) | tee -a ${BOOT_LOG} &
|
||||||
|
|
||||||
pid=$(cat $pid_file)
|
pid=$(cat ${PID_FILE})
|
||||||
while kill -0 $pid 2>/dev/null; do
|
while kill -0 ${pid} 2>/dev/null; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -1,25 +1,26 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
boot_log=/var/log/boot.log
|
BOOT_LOG=/var/log/boot.log
|
||||||
tmp_boot_log=/tmp/_boot.log
|
TMP_BOOT_LOG=/tmp/_boot.log
|
||||||
pid_file=/tmp/rc.pid
|
PID_FILE=/tmp/rc.pid
|
||||||
|
|
||||||
|
|
||||||
source /etc/init.d/base
|
source /etc/init.d/base
|
||||||
|
|
||||||
echo "---- booting $os_name $os_version ----" >> $tmp_boot_log
|
echo "---- booting ${OS_NAME} ${OS_VERSION} ----" >> ${TMP_BOOT_LOG}
|
||||||
|
|
||||||
# start all init scripts in /etc/init.d,
|
# start all init scripts in /etc/init.d,
|
||||||
# executing them in numerical order.
|
# executing them in numerical order.
|
||||||
(for i in /etc/init.d/S??* /etc/init.d/bootdone; do
|
(for i in /etc/init.d/S??* /etc/init.d/bootdone; do
|
||||||
if ! [[ -x "$i" ]]; then continue; fi
|
if ! [[ -x "${i}" ]]; then continue; fi
|
||||||
if [[ -f /data/etc/no_$(basename $i) ]]; then continue; fi
|
if [[ -f /data/etc/no_$(basename ${i}) ]]; then continue; fi
|
||||||
$i start || break
|
${i} start || break
|
||||||
done& echo $! > $pid_file) | tee -a $tmp_boot_log &
|
done& echo $! > ${PID_FILE}) | tee -a ${TMP_BOOT_LOG} &
|
||||||
|
|
||||||
pid=$(cat $pid_file)
|
pid=$(cat ${PID_FILE})
|
||||||
while kill -0 $pid 2>/dev/null; do
|
while kill -0 ${pid} 2>/dev/null; do
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
test -d $(dirname $boot_log) && cat $tmp_boot_log >> $boot_log
|
test -d $(dirname ${BOOT_LOG}) && cat ${TMP_BOOT_LOG} >> ${BOOT_LOG}
|
||||||
|
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
os_debug="false"
|
OS_DEBUG="false"
|
||||||
os_prereleases="false"
|
OS_PRERELEASES="false"
|
||||||
os_tty_login="tty1"
|
OS_TTY_LOGIN="tty1"
|
||||||
os_eth="eth0"
|
OS_ETH="eth0"
|
||||||
os_wlan="wlan0"
|
OS_WLAN="wlan0"
|
||||||
os_ppp="ppp0"
|
OS_PPP="ppp0"
|
||||||
os_networkless="false"
|
OS_NETWORKLESS="false"
|
||||||
os_country="GB"
|
OS_COUNTRY="GB"
|
||||||
os_firmware_method="github"
|
OS_FIRMWARE_METHOD="github"
|
||||||
os_firmware_repo="ccrisan/motioneyeos"
|
OS_FIRMWARE_REPO="ccrisan/motioneyeos"
|
||||||
os_firmware_username=""
|
OS_FIRMWARE_USERNAME=""
|
||||||
os_firmware_password=""
|
OS_FIRMWARE_PASSWORD=""
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
resolv_conf=/etc/resolv.conf
|
resolv_conf=/etc/resolv.conf
|
||||||
|
|
||||||
echo -n > $resolv_conf
|
echo -n > ${resolv_conf}
|
||||||
if [ -n "$DNS1" ]; then
|
if [ -n "${DNS1}" ]; then
|
||||||
echo "nameserver $DNS1" >> $resolv_conf
|
echo "nameserver ${DNS1}" >> ${resolv_conf}
|
||||||
fi
|
fi
|
||||||
if [ -n "$DNS2" ]; then
|
if [ -n "${DNS2}" ]; then
|
||||||
echo "nameserver $DNS2" >> $resolv_conf
|
echo "nameserver ${DNS2}" >> ${resolv_conf}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
os_name="motionEyeOS"
|
OS_NAME="motionEyeOS"
|
||||||
os_short_name="motioneyeos"
|
OS_SHORT_NAME="motioneyeos"
|
||||||
os_prefix="meye"
|
OS_PREFIX="meye"
|
||||||
os_version="unknown"
|
OS_VERSION="unknown"
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
link_watch="true"
|
LINK_WATCH="true"
|
||||||
link_watch_timeout=20
|
LINK_WATCH_TIMEOUT=20
|
||||||
|
|
||||||
ip_watch="true"
|
IP_WATCH="true"
|
||||||
ip_watch_timeout=40
|
IP_WATCH_TIMEOUT=40
|
||||||
|
|
||||||
#netwatch_host=www.google.com
|
#NETWATCH_HOST=www.google.com
|
||||||
#netwatch_port=80
|
#NETWATCH_PORT=80
|
||||||
netwatch_retries=3
|
NETWATCH_RETRIES=3
|
||||||
netwatch_timeout=5
|
NETWATCH_TIMEOUT=5
|
||||||
netwatch_interval=20
|
NETWATCH_INTERVAL=20
|
||||||
|
|
||||||
#meyewatch_disable="true"
|
#MEYEWATCH_DISABLE="true"
|
||||||
meyewatch_timeout=120
|
MEYEWATCH_TIMEOUT=120
|
||||||
|
@ -35,7 +35,6 @@ fi
|
|||||||
|
|
||||||
SYS_VERSION_FILE=/etc/version
|
SYS_VERSION_FILE=/etc/version
|
||||||
SYS_BOARD_FILE=/etc/board
|
SYS_BOARD_FILE=/etc/board
|
||||||
OS_CONF=/data/etc/os.conf
|
|
||||||
|
|
||||||
MIN_FREE_DISK=$((500*1024)) # 500 MB
|
MIN_FREE_DISK=$((500*1024)) # 500 MB
|
||||||
VER_FILE=version
|
VER_FILE=version
|
||||||
@ -65,12 +64,12 @@ DD_PID_FILE=dd.pid
|
|||||||
BOOT_DEV=$(mount | grep /boot | cut -d ' ' -f 1)
|
BOOT_DEV=$(mount | grep /boot | cut -d ' ' -f 1)
|
||||||
ROOT_DEV=${BOOT_DEV:0:-1}2
|
ROOT_DEV=${BOOT_DEV:0:-1}2
|
||||||
DISK_DEV=$(mount | grep /boot | cut -d ' ' -f 1)
|
DISK_DEV=$(mount | grep /boot | cut -d ' ' -f 1)
|
||||||
if [[ "$ROOT_DEV" =~ ^([/a-z0-9]+)(p[0-9])$ ]]; then # e.g. /dev/mmcblk0p2
|
if [[ "${ROOT_DEV}" =~ ^([/a-z0-9]+)(p[0-9])$ ]]; then # e.g. /dev/mmcblk0p2
|
||||||
DISK_DEV=${BASH_REMATCH[1]}
|
DISK_DEV=${BASH_REMATCH[1]}
|
||||||
elif [[ "$ROOT_DEV" =~ ^([/a-z0-9]+)([0-9])$ ]]; then # e.g. /dev/sdc2
|
elif [[ "${ROOT_DEV}" =~ ^([/a-z0-9]+)([0-9])$ ]]; then # e.g. /dev/sdc2
|
||||||
DISK_DEV=${BASH_REMATCH[1]}
|
DISK_DEV=${BASH_REMATCH[1]}
|
||||||
else
|
else
|
||||||
echo "cannot identify disk device from $ROOT_DEV" 1>&2
|
echo "cannot identify disk device from ${ROOT_DEV}" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -78,28 +77,29 @@ fi
|
|||||||
#### versions ####
|
#### versions ####
|
||||||
|
|
||||||
function show_versions() {
|
function show_versions() {
|
||||||
source $OS_CONF
|
source /etc/init.d/os_conf # we need this for the OS_ vars
|
||||||
board=$(cat $SYS_BOARD_FILE)
|
|
||||||
|
board=$(cat ${SYS_BOARD_FILE})
|
||||||
show_json=$1
|
show_json=$1
|
||||||
|
|
||||||
# the /usr/libexec/list-versions-* helpers return a table with the following format:
|
# the /usr/libexec/list-versions-* helpers return a table with the following format:
|
||||||
# <version>|<prerelease>|<board>|<url>|<date>
|
# <version>|<prerelease>|<board>|<url>|<date>
|
||||||
versions=$(FW_USERNAME=$os_firmware_username FW_PASSWORD=$os_firmware_password \
|
versions=$(FW_USERNAME=${OS_FIRMWARE_USERNAME} FW_PASSWORD=${OS_FIRMWARE_PASSWORD} \
|
||||||
/usr/libexec/list-versions-$os_firmware_method $os_firmware_repo)
|
/usr/libexec/list-versions-${OS_FIRMWARE_METHOD} ${OS_FIRMWARE_REPO})
|
||||||
|
|
||||||
for version in ${versions[@]}; do
|
for version in ${versions[@]}; do
|
||||||
OIFS=$IFS
|
OIFS=${IFS}
|
||||||
IFS="|"
|
IFS="|"
|
||||||
varr=($version)
|
varr=(${version})
|
||||||
IFS=$OIFS
|
IFS=${OIFS}
|
||||||
if [ "$os_prereleases" == "false" ] && [ "${varr[1]}" == "true" ]; then
|
if [ "${OS_PRERELEASES}" == "false" ] && [ "${varr[1]}" == "true" ]; then
|
||||||
continue # skip prereleases
|
continue # skip prereleases
|
||||||
fi
|
fi
|
||||||
if [ "$board" != "${varr[2]}" ]; then
|
if [ "${board}" != "${varr[2]}" ]; then
|
||||||
continue # skip other boards
|
continue # skip other boards
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$show_json" == "true" ]; then
|
if [ "${show_json}" == "true" ]; then
|
||||||
echo "{\"version\": \"${varr[0]}\"," \
|
echo "{\"version\": \"${varr[0]}\"," \
|
||||||
"\"url\": \"${varr[3]}\"," \
|
"\"url\": \"${varr[3]}\"," \
|
||||||
"\"board\": \"${varr[2]}\"," \
|
"\"board\": \"${varr[2]}\"," \
|
||||||
@ -112,9 +112,9 @@ function show_versions() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function show_current() {
|
function show_current() {
|
||||||
source $SYS_VERSION_FILE
|
source ${SYS_VERSION_FILE}
|
||||||
|
|
||||||
echo $os_version
|
echo ${OS_VERSION}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -123,8 +123,8 @@ function show_current() {
|
|||||||
function do_download() {
|
function do_download() {
|
||||||
echo "downloading..."
|
echo "downloading..."
|
||||||
|
|
||||||
rm -rf $FW_DIR/*
|
rm -rf ${FW_DIR}/*
|
||||||
mkdir -p $FW_DIR
|
mkdir -p ${FW_DIR}
|
||||||
|
|
||||||
# Look for local file first
|
# Look for local file first
|
||||||
if [ -f "$1" ]; then
|
if [ -f "$1" ]; then
|
||||||
@ -132,74 +132,75 @@ function do_download() {
|
|||||||
FNAME=`basename $1`
|
FNAME=`basename $1`
|
||||||
FILEEXT=${FNAME##*.}
|
FILEEXT=${FNAME##*.}
|
||||||
DST_FNAME=""
|
DST_FNAME=""
|
||||||
if [ "$FILEEXT" == "xz" ]; then
|
if [ "${FILEEXT}" == "xz" ]; then
|
||||||
DST_FNAME="$FW_DIR/$FW_FILE_XZ"
|
DST_FNAME="${FW_DIR}/${FW_FILE_XZ}"
|
||||||
elif [ "$FILEEXT" == "gz" ]; then
|
elif [ "${FILEEXT}" == "gz" ]; then
|
||||||
DST_FNAME="$FW_DIR/$FW_FILE_GZ"
|
DST_FNAME="${FW_DIR}/${FW_FILE_GZ}"
|
||||||
fi
|
fi
|
||||||
if [ -n "$DST_FNAME" ]; then
|
if [ -n "${DST_FNAME}" ]; then
|
||||||
cp -f $1 $DST_FNAME
|
cp -f $1 ${DST_FNAME}
|
||||||
echo $version > $FW_DIR/$VER_FILE
|
echo ${version} > ${FW_DIR}/${VER_FILE}
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
source $OS_CONF
|
source /etc/init.d/os_conf # we need this for the OS_ vars
|
||||||
board=$(cat $SYS_BOARD_FILE)
|
|
||||||
|
board=$(cat ${SYS_BOARD_FILE})
|
||||||
url=$1
|
url=$1
|
||||||
version=$1
|
version=$1
|
||||||
|
|
||||||
if ! [[ "$url" == http* ]]; then # a version was given
|
if ! [[ "${url}" == http* ]]; then # a version was given
|
||||||
url=$(show_versions true | jq -r ". | select(.version==\"$version\") | .url")
|
url=$(show_versions true | jq -r ". | select(.version==\"${version}\") | .url")
|
||||||
else
|
else
|
||||||
version="custom"
|
version="custom"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$url" ]; then
|
if [ -z "${url}" ]; then
|
||||||
echo "no such version" 1>&2
|
echo "no such version" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
free_disk=$(df /data | tail -n 1 | tr -s ' ' | cut -d ' ' -f 4)
|
free_disk=$(df /data | tail -n 1 | tr -s ' ' | cut -d ' ' -f 4)
|
||||||
if [ "$free_disk" -lt $MIN_FREE_DISK ]; then
|
if [ "${free_disk}" -lt ${MIN_FREE_DISK} ]; then
|
||||||
echo "not enough disk space" 1>&2
|
echo "not enough disk space" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
outfile=$FW_DIR/$FW_FILE_GZ
|
outfile=${FW_DIR}/${FW_FILE_GZ}
|
||||||
format=$(echo $url | sed -rn 's/.*\.img\.([a-z]+)$/\1/ p')
|
format=$(echo ${url} | sed -rn 's/.*\.img\.([a-z]+)$/\1/ p')
|
||||||
if [ "$format" == "xz" ]; then
|
if [ "${format}" == "xz" ]; then
|
||||||
outfile=$FW_DIR/$FW_FILE_XZ
|
outfile=${FW_DIR}/${FW_FILE_XZ}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo $version > $FW_DIR/$VER_FILE
|
echo ${version} > ${FW_DIR}/${VER_FILE}
|
||||||
|
|
||||||
curl_opts="-S -f -L"
|
curl_opts="-S -f -L"
|
||||||
if [ -n "$os_firmware_username" ]; then
|
if [ -n "${OS_FIRMWARE_USERNAME}" ]; then
|
||||||
curl_opts+=" --user $os_firmware_username:$os_firmware_password"
|
curl_opts+=" --user ${OS_FIRMWARE_USERNAME}:${OS_FIRMWARE_PASSWORD}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
curl $curl_opts -o $outfile "$url" &> $FW_DIR/$CURL_LOG_FILE &
|
curl ${curl_opts} -o ${outfile} "${url}" &> ${FW_DIR}/${CURL_LOG_FILE} &
|
||||||
pid=$!
|
pid=$!
|
||||||
echo $pid > $FW_DIR/$CURL_PID_FILE
|
echo ${pid} > ${FW_DIR}/${CURL_PID_FILE}
|
||||||
wait $pid
|
wait ${pid}
|
||||||
|
|
||||||
if [ "$?" != 0 ]; then
|
if [ "$?" != 0 ]; then
|
||||||
cat $FW_DIR/$CURL_LOG_FILE
|
cat ${FW_DIR}/${CURL_LOG_FILE}
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function download_status() {
|
function download_status() {
|
||||||
if [ -f $FW_DIR/$CURL_PID_FILE ]; then
|
if [ -f ${FW_DIR}/${CURL_PID_FILE} ]; then
|
||||||
pid=$(cat $FW_DIR/$CURL_PID_FILE)
|
pid=$(cat ${FW_DIR}/${CURL_PID_FILE})
|
||||||
if kill -0 $pid &>/dev/null; then
|
if kill -0 ${pid} &>/dev/null; then
|
||||||
echo "running"
|
echo "running"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f $FW_DIR/$FW_FILE_GZ -o -f $FW_DIR/$FW_FILE_XZ ]; then
|
if [ -f ${FW_DIR}/${FW_FILE_GZ} -o -f ${FW_DIR}/${FW_FILE_XZ} ]; then
|
||||||
echo "done"
|
echo "done"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -210,69 +211,69 @@ function download_status() {
|
|||||||
function do_extract() {
|
function do_extract() {
|
||||||
echo "extracting..."
|
echo "extracting..."
|
||||||
|
|
||||||
rm -f $FW_DIR/$FW_FILE_EXTR
|
rm -f ${FW_DIR}/${FW_FILE_EXTR}
|
||||||
rm -f $FW_DIR/$BOOT_READY_FILE
|
rm -f ${FW_DIR}/${BOOT_READY_FILE}
|
||||||
|
|
||||||
if ! [ -f $FW_DIR/$FW_FILE_GZ -o -f $FW_DIR/$FW_FILE_XZ ]; then
|
if ! [ -f ${FW_DIR}/${FW_FILE_GZ} -o -f ${FW_DIR}/${FW_FILE_XZ} ]; then
|
||||||
echo "firmware file not downloaded" 1>&2
|
echo "firmware file not downloaded" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
format="gz"
|
format="gz"
|
||||||
if [ -f $FW_DIR/$FW_FILE_XZ ]; then
|
if [ -f ${FW_DIR}/${FW_FILE_XZ} ]; then
|
||||||
format="xz"
|
format="xz"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f $FW_DIR/$FW_FILE_EXTR
|
rm -f ${FW_DIR}/${FW_FILE_EXTR}
|
||||||
rm -f $FW_DIR/$GUNZIP_PID_FILE $FW_DIR/$XZCAT_PID_FILE
|
rm -f ${FW_DIR}/${GUNZIP_PID_FILE} ${FW_DIR}/${XZCAT_PID_FILE}
|
||||||
|
|
||||||
if [ "$format" == "xz" ]; then
|
if [ "${format}" == "xz" ]; then
|
||||||
DECOMPRESS_LOG_FILE=$FW_DIR/$XZCAT_LOG_FILE
|
DECOMPRESS_LOG_FILE=${FW_DIR}/${XZCAT_LOG_FILE}
|
||||||
DECOMPRESS_PID_FILE=$FW_DIR/$XZCAT_PID_FILE
|
DECOMPRESS_PID_FILE=${FW_DIR}/${XZCAT_PID_FILE}
|
||||||
xzcat $FW_DIR/$FW_FILE_XZ > $FW_DIR/$FW_FILE_EXTR 2>$FW_DIR/$XZCAT_LOG_FILE &
|
xzcat ${FW_DIR}/${FW_FILE_XZ} > ${FW_DIR}/${FW_FILE_EXTR} 2>${FW_DIR}/${XZCAT_LOG_FILE} &
|
||||||
elif [ "$format" == "gz" ]; then
|
elif [ "${format}" == "gz" ]; then
|
||||||
DECOMPRESS_LOG_FILE=$FW_DIR/$GUNZIP_LOG_FILE
|
DECOMPRESS_LOG_FILE=${FW_DIR}/${GUNZIP_LOG_FILE}
|
||||||
DECOMPRESS_PID_FILE=$FW_DIR/$GUNZIP_PID_FILE
|
DECOMPRESS_PID_FILE=${FW_DIR}/${GUNZIP_PID_FILE}
|
||||||
gunzip -k -c $FW_DIR/$FW_FILE_GZ > $FW_DIR/$FW_FILE_EXTR 2>$FW_DIR/$GUNZIP_LOG_FILE &
|
gunzip -k -c ${FW_DIR}/${FW_FILE_GZ} > ${FW_DIR}/${FW_FILE_EXTR} 2>${FW_DIR}/${GUNZIP_LOG_FILE} &
|
||||||
else
|
else
|
||||||
echo "firmware compression format $format not supported" 1>&2
|
echo "firmware compression format ${format} not supported" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pid=$!
|
pid=$!
|
||||||
echo $pid > $DECOMPRESS_PID_FILE
|
echo ${pid} > ${DECOMPRESS_PID_FILE}
|
||||||
wait $pid
|
wait ${pid}
|
||||||
|
|
||||||
if [ "$?" != 0 ]; then
|
if [ "$?" != 0 ]; then
|
||||||
cat $DECOMPRESS_LOG_FILE
|
cat ${DECOMPRESS_LOG_FILE}
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# verify available partition space
|
# verify available partition space
|
||||||
|
|
||||||
fw_boot_info=$(fdisk --bytes -l -o device,start,end,size $FW_DIR/$FW_FILE_EXTR | grep "${FW_FILE_EXTR}1")
|
fw_boot_info=$(fdisk --bytes -l -o device,start,end,size ${FW_DIR}/${FW_FILE_EXTR} | grep "${FW_FILE_EXTR}1")
|
||||||
fw_boot_info=($fw_boot_info)
|
fw_boot_info=(${fw_boot_info})
|
||||||
fw_boot_size=${fw_boot_info[3]}
|
fw_boot_size=${fw_boot_info[3]}
|
||||||
|
|
||||||
fw_root_info=$(fdisk --bytes -l -o device,start,end,size $FW_DIR/$FW_FILE_EXTR | grep "${FW_FILE_EXTR}2")
|
fw_root_info=$(fdisk --bytes -l -o device,start,end,size ${FW_DIR}/${FW_FILE_EXTR} | grep "${FW_FILE_EXTR}2")
|
||||||
fw_root_info=($fw_root_info)
|
fw_root_info=(${fw_root_info})
|
||||||
fw_root_size=${fw_root_info[3]}
|
fw_root_size=${fw_root_info[3]}
|
||||||
|
|
||||||
disk_boot_info=$(fdisk --bytes -l -o device,start,end,size $DISK_DEV | grep $BOOT_DEV)
|
disk_boot_info=$(fdisk --bytes -l -o device,start,end,size ${DISK_DEV} | grep ${BOOT_DEV})
|
||||||
disk_boot_info=($disk_boot_info)
|
disk_boot_info=(${disk_boot_info})
|
||||||
disk_boot_size=${disk_boot_info[3]}
|
disk_boot_size=${disk_boot_info[3]}
|
||||||
|
|
||||||
disk_root_info=$(fdisk --bytes -l -o device,start,end,size $DISK_DEV | grep $ROOT_DEV)
|
disk_root_info=$(fdisk --bytes -l -o device,start,end,size ${DISK_DEV} | grep ${ROOT_DEV})
|
||||||
disk_root_info=($disk_root_info)
|
disk_root_info=(${disk_root_info})
|
||||||
disk_root_size=${disk_root_info[3]}
|
disk_root_size=${disk_root_info[3]}
|
||||||
|
|
||||||
if [[ $disk_boot_size -lt $fw_boot_size ]]; then
|
if [[ ${disk_boot_size} -lt ${fw_boot_size} ]]; then
|
||||||
echo "not enough space on boot partition ($fw_boot_size needed, $disk_boot_size available)" 1>&2
|
echo "not enough space on boot partition (${fw_boot_size} needed, ${disk_boot_size} available)" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $disk_root_size -lt $fw_root_size ]]; then
|
if [[ ${disk_root_size} -lt ${fw_root_size} ]]; then
|
||||||
echo "not enough space on root partition ($fw_root_size needed, $disk_root_size available)" 1>&2
|
echo "not enough space on root partition (${fw_root_size} needed, ${disk_root_size} available)" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -280,21 +281,21 @@ function do_extract() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function extract_status() {
|
function extract_status() {
|
||||||
if [ -f $FW_DIR/$XZCAT_PID_FILE ]; then
|
if [ -f ${FW_DIR}/${XZCAT_PID_FILE} ]; then
|
||||||
pid=$(cat $FW_DIR/$XZCAT_PID_FILE)
|
pid=$(cat ${FW_DIR}/${XZCAT_PID_FILE})
|
||||||
if kill -0 $pid &>/dev/null; then
|
if kill -0 ${pid} &>/dev/null; then
|
||||||
echo "running"
|
echo "running"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
elif [ -f $FW_DIR/$GUNZIP_PID_FILE ]; then
|
elif [ -f ${FW_DIR}/${GUNZIP_PID_FILE} ]; then
|
||||||
pid=$(cat $FW_DIR/$GUNZIP_PID_FILE)
|
pid=$(cat ${FW_DIR}/${GUNZIP_PID_FILE})
|
||||||
if kill -0 $pid &>/dev/null; then
|
if kill -0 ${pid} &>/dev/null; then
|
||||||
echo "running"
|
echo "running"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f $FW_DIR/$FW_FILE_EXTR ]; then
|
if [ -f ${FW_DIR}/${FW_FILE_EXTR} ]; then
|
||||||
echo "done"
|
echo "done"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -305,12 +306,12 @@ function extract_status() {
|
|||||||
function flash_boot() {
|
function flash_boot() {
|
||||||
echo "flashing boot..."
|
echo "flashing boot..."
|
||||||
|
|
||||||
rm -f $FW_DIR/$BOOT_READY_FILE
|
rm -f ${FW_DIR}/${BOOT_READY_FILE}
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
board=$(cat $SYS_BOARD_FILE)
|
board=$(cat ${SYS_BOARD_FILE})
|
||||||
|
|
||||||
cp -r /boot $FW_DIR/old_boot
|
cp -r /boot ${FW_DIR}/old_boot
|
||||||
umount /boot
|
umount /boot
|
||||||
trap flash_cleanup EXIT
|
trap flash_cleanup EXIT
|
||||||
|
|
||||||
@ -318,22 +319,22 @@ function flash_boot() {
|
|||||||
mv /sbin/reboot /sbin/reboot.bak
|
mv /sbin/reboot /sbin/reboot.bak
|
||||||
ln -s /bin/true /sbin/reboot
|
ln -s /bin/true /sbin/reboot
|
||||||
|
|
||||||
boot_info=$(fdisk --bytes -l -o device,start,end,size $FW_DIR/$FW_FILE_EXTR | grep "${FW_FILE_EXTR}1")
|
boot_info=$(fdisk --bytes -l -o device,start,end,size ${FW_DIR}/${FW_FILE_EXTR} | grep "${FW_FILE_EXTR}1")
|
||||||
boot_info=($boot_info)
|
boot_info=(${boot_info})
|
||||||
boot_start=$((${boot_info[1]} / 2048)) # in MB
|
boot_start=$((${boot_info[1]} / 2048)) # in MB
|
||||||
boot_size=$((${boot_info[3]} / 1048576)) # in MB
|
boot_size=$((${boot_info[3]} / 1048576)) # in MB
|
||||||
|
|
||||||
root_info=$(fdisk --bytes -l -o device,start,end,size $FW_DIR/$FW_FILE_EXTR | grep "${FW_FILE_EXTR}2")
|
root_info=$(fdisk --bytes -l -o device,start,end,size ${FW_DIR}/${FW_FILE_EXTR} | grep "${FW_FILE_EXTR}2")
|
||||||
root_info=($root_info)
|
root_info=(${root_info})
|
||||||
root_start=$((${root_info[1]} / 2048)) # in MB
|
root_start=$((${root_info[1]} / 2048)) # in MB
|
||||||
root_size=$((${root_info[3]} / 1048576)) # in MB
|
root_size=$((${root_info[3]} / 1048576)) # in MB
|
||||||
|
|
||||||
echo $root_start $root_size > $FW_DIR/$ROOT_INFO_FILE
|
echo ${root_start} ${root_size} > ${FW_DIR}/${ROOT_INFO_FILE}
|
||||||
|
|
||||||
dd if=$FW_DIR/$FW_FILE_EXTR skip=$boot_start of=$BOOT_DEV bs=1048576 count=$boot_size &>$FW_DIR/$DD_LOG_FILE &
|
dd if=${FW_DIR}/${FW_FILE_EXTR} skip=${boot_start} of=${BOOT_DEV} bs=1048576 count=${boot_size} &>${FW_DIR}/${DD_LOG_FILE} &
|
||||||
pid=$!
|
pid=$!
|
||||||
echo $pid > $FW_DIR/$DD_PID_FILE
|
echo ${pid} > ${FW_DIR}/${DD_PID_FILE}
|
||||||
wait $pid
|
wait ${pid}
|
||||||
|
|
||||||
mount -T /etc/fstab.disk -o rw /boot
|
mount -T /etc/fstab.disk -o rw /boot
|
||||||
|
|
||||||
@ -341,21 +342,21 @@ function flash_boot() {
|
|||||||
# and should restore any /boot configuration that needs to be preserved across updates
|
# and should restore any /boot configuration that needs to be preserved across updates
|
||||||
# from the old boot dir to the current (new) /boot dir
|
# from the old boot dir to the current (new) /boot dir
|
||||||
if [ -x /usr/libexec/fw-restore-boot-cfg ]; then
|
if [ -x /usr/libexec/fw-restore-boot-cfg ]; then
|
||||||
/usr/libexec/fw-restore-boot-cfg $FW_DIR/old_boot 2>/dev/null || true
|
/usr/libexec/fw-restore-boot-cfg ${FW_DIR}/old_boot 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
touch $FW_DIR/$BOOT_READY_FILE
|
touch ${FW_DIR}/${BOOT_READY_FILE}
|
||||||
}
|
}
|
||||||
|
|
||||||
function flash_boot_status() {
|
function flash_boot_status() {
|
||||||
if [ -f $FW_DIR/$DD_PID_FILE ]; then
|
if [ -f ${FW_DIR}/${DD_PID_FILE} ]; then
|
||||||
pid=$(cat $FW_DIR/$DD_PID_FILE)
|
pid=$(cat ${FW_DIR}/${DD_PID_FILE})
|
||||||
if kill -0 $pid &>/dev/null; then
|
if kill -0 ${pid} &>/dev/null; then
|
||||||
echo "running"
|
echo "running"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f $FW_DIR/$BOOT_READY_FILE ]; then
|
if [ -f ${FW_DIR}/${BOOT_READY_FILE} ]; then
|
||||||
echo "done"
|
echo "done"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -375,7 +376,7 @@ function flash_cleanup() {
|
|||||||
function flash_reboot() {
|
function flash_reboot() {
|
||||||
echo "preparing for reboot..."
|
echo "preparing for reboot..."
|
||||||
|
|
||||||
board=$(cat $SYS_BOARD_FILE)
|
board=$(cat ${SYS_BOARD_FILE})
|
||||||
|
|
||||||
# the /usr/libexec/fw-prepare-boot script should be present and should
|
# the /usr/libexec/fw-prepare-boot script should be present and should
|
||||||
# make the necessary changes to the current boot configuration so that
|
# make the necessary changes to the current boot configuration so that
|
||||||
@ -398,28 +399,28 @@ function flash_reboot() {
|
|||||||
|
|
||||||
function show_status() {
|
function show_status() {
|
||||||
status=$(flash_boot_status)
|
status=$(flash_boot_status)
|
||||||
if [ "$status" == "running" ]; then
|
if [ "${status}" == "running" ]; then
|
||||||
echo "flashing boot $(new_version)"
|
echo "flashing boot $(new_version)"
|
||||||
return
|
return
|
||||||
elif [ "$status" == "done" ]; then
|
elif [ "${status}" == "done" ]; then
|
||||||
echo "boot ready $(new_version)"
|
echo "boot ready $(new_version)"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
status=$(extract_status)
|
status=$(extract_status)
|
||||||
if [ "$status" == "running" ]; then
|
if [ "${status}" == "running" ]; then
|
||||||
echo "extracting $(new_version)"
|
echo "extracting $(new_version)"
|
||||||
return
|
return
|
||||||
elif [ "$status" == "done" ]; then
|
elif [ "${status}" == "done" ]; then
|
||||||
echo "extracted $(new_version)"
|
echo "extracted $(new_version)"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
status=$(download_status)
|
status=$(download_status)
|
||||||
if [ "$status" == "running" ]; then
|
if [ "${status}" == "running" ]; then
|
||||||
echo "downloading $(new_version)"
|
echo "downloading $(new_version)"
|
||||||
return
|
return
|
||||||
elif [ -n "$status" ]; then
|
elif [ -n "${status}" ]; then
|
||||||
echo "downloaded $(new_version)"
|
echo "downloaded $(new_version)"
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@ -449,7 +450,7 @@ function do_upgrade() {
|
|||||||
|
|
||||||
|
|
||||||
function new_version() {
|
function new_version() {
|
||||||
cat $FW_DIR/$VER_FILE
|
cat ${FW_DIR}/${VER_FILE}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -457,7 +458,7 @@ case "$1" in
|
|||||||
versions)
|
versions)
|
||||||
show_json="false"
|
show_json="false"
|
||||||
test "$2" == "-j" && show_json="true"
|
test "$2" == "-j" && show_json="true"
|
||||||
show_versions $show_json
|
show_versions ${show_json}
|
||||||
;;
|
;;
|
||||||
|
|
||||||
current)
|
current)
|
||||||
|
@ -7,14 +7,14 @@ usage() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
test -z "$GPIO" && usage
|
test -z "${GPIO}" && usage
|
||||||
test -e /sys/class/gpio/gpio$GPIO || echo $GPIO > /sys/class/gpio/export
|
test -e /sys/class/gpio/gpio${GPIO} || echo ${GPIO} > /sys/class/gpio/export
|
||||||
|
|
||||||
if [ -n "$2" ]; then
|
if [ -n "$2" ]; then
|
||||||
echo out > /sys/class/gpio/gpio$GPIO/direction
|
echo out > /sys/class/gpio/gpio${GPIO}/direction
|
||||||
echo $2 > /sys/class/gpio/gpio$GPIO/value
|
echo $2 > /sys/class/gpio/gpio${GPIO}/value
|
||||||
else
|
else
|
||||||
echo in > /sys/class/gpio/gpio$GPIO/direction
|
echo in > /sys/class/gpio/gpio${GPIO}/direction
|
||||||
cat /sys/class/gpio/gpio$GPIO/value
|
cat /sys/class/gpio/gpio${GPIO}/value
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -7,22 +7,22 @@ fi
|
|||||||
|
|
||||||
function check_prerelease() {
|
function check_prerelease() {
|
||||||
read line
|
read line
|
||||||
if [[ "$line" =~ ^[0-9._]+\| ]]; then
|
if [[ "${line}" =~ ^[0-9._]+\| ]]; then
|
||||||
echo "$line"
|
echo "${line}"
|
||||||
else
|
else
|
||||||
echo "$line" | sed 's/|false|/|true|/'
|
echo "${line}" | sed 's/|false|/|true|/'
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
extensions=".img.gz .img.xz .img"
|
extensions=".img.gz .img.xz .img"
|
||||||
opts="-s -S -f"
|
opts="-s -S -f"
|
||||||
test -n "$FW_USERNAME" && opts+=" --user $FW_USERNAME:$FW_PASSWORD"
|
test -n "${FW_USERNAME}" && opts+=" --user ${FW_USERNAME}:${FW_PASSWORD}"
|
||||||
url="https://api.bitbucket.org/2.0/repositories/$1/downloads?pagelen=100&_=$(date +%s)"
|
url="https://api.bitbucket.org/2.0/repositories/$1/downloads?pagelen=100&_=$(date +%s)"
|
||||||
|
|
||||||
rtrimstr=$(for e in $extensions; do echo -n " | rtrimstr(\"$e\")"; done)
|
rtrimstr=$(for e in ${extensions}; do echo -n " | rtrimstr(\"${e}\")"; done)
|
||||||
jq_expr=".values[] | [{a: .name | split(\"-\"), url: .links.self.href, date: .created_on | split(\"T\")[0]}] |
|
jq_expr=".values[] | [{a: .name | split(\"-\"), url: .links.self.href, date: .created_on | split(\"T\")[0]}] |
|
||||||
map((.a[2] $rtrimstr), \"false\", .a[1], .url, .date) | join(\"|\")"
|
map((.a[2] ${rtrimstr}), \"false\", .a[1], .url, .date) | join(\"|\")"
|
||||||
|
|
||||||
curl $opts $url | jq --raw-output "$jq_expr" | while read line; do echo "$line" | check_prerelease; done
|
curl ${opts} ${url} | jq --raw-output "${jq_expr}" | while read line; do echo "${line}" | check_prerelease; done
|
||||||
exit ${PIPESTATUS[0]}
|
exit ${PIPESTATUS[0]}
|
||||||
|
|
||||||
|
@ -6,13 +6,13 @@ if [ -z "$1" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
opts="-s -S -f"
|
opts="-s -S -f"
|
||||||
test -n "$FW_USERNAME" && opts+=" --user $FW_USERNAME:$FW_PASSWORD"
|
test -n "${FW_USERNAME}" && opts+=" --user ${FW_USERNAME}:${FW_PASSWORD}"
|
||||||
url=https://api.github.com/repos/$1/releases
|
url=https://api.github.com/repos/$1/releases
|
||||||
|
|
||||||
jq_expr='.[] | {version: .name, prerelease: .prerelease | tostring} +
|
jq_expr='.[] | {version: .name, prerelease: .prerelease | tostring} +
|
||||||
(.assets[] | {name: .name | split("-")[1], url: .browser_download_url}) +
|
(.assets[] | {name: .name | split("-")[1], url: .browser_download_url}) +
|
||||||
({date: .created_at | split("T")[0]}) | flatten | join("|")'
|
({date: .created_at | split("T")[0]}) | flatten | join("|")'
|
||||||
|
|
||||||
curl $opts $url | jq --raw-output "$jq_expr"
|
curl ${opts} ${url} | jq --raw-output "${jq_expr}"
|
||||||
exit ${PIPESTATUS[0]}
|
exit ${PIPESTATUS[0]}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
test "$MEYE_USERNAME" == "admin" || exit 0
|
test "${MEYE_USERNAME}" == "admin" || exit 0
|
||||||
PASSWORD="$MEYE_PASSWORD" /usr/sbin/adminpasswd
|
PASSWORD="${MEYE_PASSWORD}" /usr/sbin/adminpasswd
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@ rm -f /data/etc/shadow-
|
|||||||
|
|
||||||
# set root and admin passwords (admin is just an alias for root)
|
# set root and admin passwords (admin is just an alias for root)
|
||||||
|
|
||||||
echo -en "$PASSWORD\n$PASSWORD\n" | passwd -a md5 &>/dev/null # root
|
echo -en "${PASSWORD}\n${PASSWORD}\n" | passwd -a md5 &>/dev/null # root
|
||||||
echo -en "$PASSWORD\n$PASSWORD\n" | passwd -a md5 admin &>/dev/null # admin
|
echo -en "${PASSWORD}\n${PASSWORD}\n" | passwd -a md5 admin &>/dev/null # admin
|
||||||
|
|
||||||
sed -r -i 's/root:([^:]+):[[:digit:]]+:/root:\1::/' /data/etc/shadow # removes pwd expiration
|
sed -r -i 's/root:([^:]+):[[:digit:]]+:/root:\1::/' /data/etc/shadow # removes pwd expiration
|
||||||
sed -r -i 's/admin:([^:]+):[[:digit:]]+:/admin:\1::/' /data/etc/shadow # removes pwd expiration
|
sed -r -i 's/admin:([^:]+):[[:digit:]]+:/admin:\1::/' /data/etc/shadow # removes pwd expiration
|
||||||
@ -32,7 +32,7 @@ sed -r -i 's/admin:([^:]+):[[:digit:]]+:/admin:\1::/' /data/etc/shadow # removes
|
|||||||
# call admin password hooks in /etc/adminpasswd.d
|
# call admin password hooks in /etc/adminpasswd.d
|
||||||
if [ -d /etc/adminpasswd.d ]; then
|
if [ -d /etc/adminpasswd.d ]; then
|
||||||
for script in /etc/adminpasswd.d/*; do
|
for script in /etc/adminpasswd.d/*; do
|
||||||
test -x $script && $script
|
test -x ${script} && ${script}
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -3,50 +3,52 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
export TARGET="$1"
|
export TARGET="$1"
|
||||||
export BOARD=$(basename $(dirname $TARGET))
|
export BOARD=$(basename $(dirname ${TARGET}))
|
||||||
export COMMON_DIR=$(dirname $0)
|
export COMMON_DIR=$(dirname $0)
|
||||||
export BOARD_DIR=$COMMON_DIR/../$BOARD
|
export BOARD_DIR=${COMMON_DIR}/../${BOARD}
|
||||||
export BOOT_DIR=$TARGET/../images/boot/
|
export BOOT_DIR=${TARGET}/../images/boot/
|
||||||
export IMG_DIR=$TARGET/../images
|
export IMG_DIR=${TARGET}/../images
|
||||||
|
|
||||||
mkdir -p $BOOT_DIR
|
mkdir -p ${BOOT_DIR}
|
||||||
|
|
||||||
if [ -x $BOARD_DIR/postscript.sh ]; then
|
if [ -x ${BOARD_DIR}/postscript.sh ]; then
|
||||||
$BOARD_DIR/postscript.sh
|
${BOARD_DIR}/postscript.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# cleanups
|
# cleanups
|
||||||
$COMMON_DIR/cleanups.sh
|
${COMMON_DIR}/cleanups.sh
|
||||||
if [ -x $BOARD_DIR/cleanups.sh ]; then
|
if [ -x ${BOARD_DIR}/cleanups.sh ]; then
|
||||||
$BOARD_DIR/cleanups.sh
|
${BOARD_DIR}/cleanups.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# transform /var contents as needed
|
# transform /var contents as needed
|
||||||
rm -rf $TARGET/var/cache
|
rm -rf ${TARGET}/var/cache
|
||||||
rm -rf $TARGET/var/lib
|
rm -rf ${TARGET}/var/lib
|
||||||
rm -rf $TARGET/var/lock
|
rm -rf ${TARGET}/var/lock
|
||||||
rm -rf $TARGET/var/log
|
rm -rf ${TARGET}/var/log
|
||||||
rm -rf $TARGET/var/run
|
rm -rf ${TARGET}/var/run
|
||||||
rm -rf $TARGET/var/spool
|
rm -rf ${TARGET}/var/spool
|
||||||
rm -rf $TARGET/var/tmp
|
rm -rf ${TARGET}/var/tmp
|
||||||
|
|
||||||
ln -s /tmp $TARGET/var/cache
|
ln -s /tmp ${TARGET}/var/cache
|
||||||
ln -s /data/varlib $TARGET/var/lib
|
ln -s /data/varlib ${TARGET}/var/lib
|
||||||
ln -s /tmp $TARGET/var/lock
|
ln -s /tmp ${TARGET}/var/lock
|
||||||
ln -s /data/log $TARGET/var/log
|
ln -s /data/log ${TARGET}/var/log
|
||||||
ln -s /tmp $TARGET/var/run
|
ln -s /tmp ${TARGET}/var/run
|
||||||
ln -s /tmp $TARGET/var/spool
|
ln -s /tmp ${TARGET}/var/spool
|
||||||
ln -s /tmp $TARGET/var/tmp
|
ln -s /tmp ${TARGET}/var/tmp
|
||||||
ln -s /tmp $TARGET/run
|
ln -s /tmp ${TARGET}/run
|
||||||
|
|
||||||
# board-specific os.conf
|
# board-specific os.conf
|
||||||
if [ -r $BOARD_DIR/os.conf ]; then
|
if [ -r ${BOARD_DIR}/os.conf ]; then
|
||||||
for line in $(cat $BOARD_DIR/os.conf); do
|
for line in $(cat ${BOARD_DIR}/os.conf); do
|
||||||
key=$(echo $line | cut -d '=' -f 1)
|
key=$(echo ${line} | cut -d '=' -f 1)
|
||||||
sed -i -r "s/$key=.*/$line/" /$TARGET/etc/os.conf
|
sed -i -r "s/${key}=.*/${line}/" /${TARGET}/etc/os.conf
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# add admin user alias
|
# add admin user alias
|
||||||
echo "admin:x:0:0:root:/root:/bin/sh" >> $TARGET/etc/passwd
|
if ! grep -E '^admin:' ${TARGET}/etc/passwd &> /dev/null; then
|
||||||
|
echo "admin:x:0:0:root:/root:/bin/sh" >> ${TARGET}/etc/passwd
|
||||||
|
fi
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cp $IMG_DIR/rootfs.cpio.uboot $BOARD_DIR/uInitrd
|
cp ${IMG_DIR}/rootfs.cpio.uboot ${BOARD_DIR}/uInitrd
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
BOARD_DIR=$(dirname $0)
|
BOARD_DIR=$(dirname $0)
|
||||||
COMMON_DIR=$BOARD_DIR/../common
|
COMMON_DIR=${BOARD_DIR}/../common
|
||||||
|
|
||||||
export BOARD=$(basename $BOARD_DIR)
|
export BOARD=$(basename ${BOARD_DIR})
|
||||||
export IMG_DIR=$BOARD_DIR/../../output/$BOARD/images/
|
export IMG_DIR=${BOARD_DIR}/../../output/${BOARD}/images/
|
||||||
export UBOOT_BIN=$BOARD_DIR/u-boot-with-spl.bin
|
export UBOOT_BIN=${BOARD_DIR}/u-boot-with-spl.bin
|
||||||
export UBOOT_SEEK=16
|
export UBOOT_SEEK=16
|
||||||
export BOOT_START=20
|
export BOOT_START=20
|
||||||
source $COMMON_DIR/mkimage.sh
|
source ${COMMON_DIR}/mkimage.sh
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
os_tty_login="ttyS0"
|
OS_TTY_LOGIN="ttyS0"
|
||||||
|
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
$HOST_DIR/bin/mkimage -C none -A arm -T script -d $BOARD_DIR/boot.cmd $BOOT_DIR/boot.scr
|
${HOST_DIR}/bin/mkimage -C none -A arm -T script -d ${BOARD_DIR}/boot.cmd ${BOOT_DIR}/boot.scr
|
||||||
$HOST_DIR/bin/mkimage -C none -A arm -T script -d $BOARD_DIR/boot-fwupdater.cmd $BOOT_DIR/boot-fwupdater.scr
|
${HOST_DIR}/bin/mkimage -C none -A arm -T script -d ${BOARD_DIR}/boot-fwupdater.cmd ${BOOT_DIR}/boot-fwupdater.scr
|
||||||
|
|
||||||
cp $IMG_DIR/zImage $BOOT_DIR
|
cp ${IMG_DIR}/zImage ${BOOT_DIR}
|
||||||
cp $BOARD_DIR/sun8i-h3-nanopi-neo.dtb $BOOT_DIR
|
cp ${BOARD_DIR}/sun8i-h3-nanopi-neo.dtb ${BOOT_DIR}
|
||||||
cp $BOARD_DIR/rootfs.cpio.uboot $BOOT_DIR
|
cp ${BOARD_DIR}/rootfs.cpio.uboot ${BOOT_DIR}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cp $IMG_DIR/rootfs.cpio.uboot $BOARD_DIR/uInitrd
|
cp ${IMG_DIR}/rootfs.cpio.uboot ${BOARD_DIR}/uInitrd
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
BOARD_DIR=$(dirname $0)
|
BOARD_DIR=$(dirname $0)
|
||||||
COMMON_DIR=$BOARD_DIR/../common
|
COMMON_DIR=${BOARD_DIR}/../common
|
||||||
|
|
||||||
export BOARD=$(basename $BOARD_DIR)
|
export BOARD=$(basename ${BOARD_DIR})
|
||||||
export IMG_DIR=$BOARD_DIR/../../output/$BOARD/images/
|
export IMG_DIR=${BOARD_DIR}/../../output/${BOARD}/images/
|
||||||
export UBOOT_BIN=$BOARD_DIR/u-boot-with-spl.bin
|
export UBOOT_BIN=${BOARD_DIR}/u-boot-with-spl.bin
|
||||||
export UBOOT_SEEK=16
|
export UBOOT_SEEK=16
|
||||||
export BOOT_START=20
|
export BOOT_START=20
|
||||||
source $COMMON_DIR/mkimage.sh
|
source ${COMMON_DIR}/mkimage.sh
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
os_tty_login="ttyS0"
|
OS_TTY_LOGIN="ttyS0"
|
||||||
|
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
$HOST_DIR/bin/mkimage -C none -A arm -T script -d $BOARD_DIR/boot.cmd $BOOT_DIR/boot.scr
|
${HOST_DIR}/bin/mkimage -C none -A arm -T script -d ${BOARD_DIR}/boot.cmd ${BOOT_DIR}/boot.scr
|
||||||
$HOST_DIR/bin/mkimage -C none -A arm -T script -d $BOARD_DIR/boot-fwupdater.cmd $BOOT_DIR/boot-fwupdater.scr
|
${HOST_DIR}/bin/mkimage -C none -A arm -T script -d ${BOARD_DIR}/boot-fwupdater.cmd ${BOOT_DIR}/boot-fwupdater.scr
|
||||||
|
|
||||||
cp $IMG_DIR/Image $BOOT_DIR
|
cp ${IMG_DIR}/Image ${BOOT_DIR}
|
||||||
cp $BOARD_DIR/sun50i-h5-nanopi-neo2.dtb $BOOT_DIR
|
cp ${BOARD_DIR}/sun50i-h5-nanopi-neo2.dtb ${BOOT_DIR}
|
||||||
cp $BOARD_DIR/rootfs.cpio.uboot $BOOT_DIR
|
cp ${BOARD_DIR}/rootfs.cpio.uboot ${BOOT_DIR}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cp $IMG_DIR/rootfs.cpio.uboot $BOARD_DIR/uInitrd
|
cp ${IMG_DIR}/rootfs.cpio.uboot ${BOARD_DIR}/uInitrd
|
||||||
|
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
BOARD_DIR=$(dirname $0)
|
BOARD_DIR=$(dirname $0)
|
||||||
COMMON_DIR=$BOARD_DIR/../common
|
COMMON_DIR=${BOARD_DIR}/../common
|
||||||
|
|
||||||
export BOARD=$(basename $BOARD_DIR)
|
export BOARD=$(basename ${BOARD_DIR})
|
||||||
export IMG_DIR=$BOARD_DIR/../../output/$BOARD/images/
|
export IMG_DIR=${BOARD_DIR}/../../output/${BOARD}/images/
|
||||||
export UBOOT_BIN=$IMG_DIR/u-boot.bin
|
export UBOOT_BIN=${IMG_DIR}/u-boot.bin
|
||||||
export UBOOT_SEEK=64
|
export UBOOT_SEEK=64
|
||||||
BL1=$IMG_DIR/bl1.bin.hardkernel
|
BL1=${IMG_DIR}/bl1.bin.hardkernel
|
||||||
|
|
||||||
source $COMMON_DIR/mkimage.sh
|
source ${COMMON_DIR}/mkimage.sh
|
||||||
|
|
||||||
dd conv=notrunc if=$BL1 of=$DISK_IMG bs=1 count=442
|
dd conv=notrunc if=${BL1} of=${DISK_IMG} bs=1 count=442
|
||||||
dd conv=notrunc if=$BL1 of=$DISK_IMG bs=512 skip=1 seek=1
|
dd conv=notrunc if=${BL1} of=${DISK_IMG} bs=512 skip=1 seek=1
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
os_tty_login="ttyS0"
|
OS_TTY_LOGIN="ttyS0"
|
||||||
|
|
||||||
|
@ -3,23 +3,23 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
# boot directory
|
# boot directory
|
||||||
mkdir -p $BOOT_DIR
|
mkdir -p ${BOOT_DIR}
|
||||||
|
|
||||||
cp $IMG_DIR/uImage $BOOT_DIR
|
cp ${IMG_DIR}/uImage ${BOOT_DIR}
|
||||||
cp $IMG_DIR/meson8b_odroidc.dtb $BOOT_DIR
|
cp ${IMG_DIR}/meson8b_odroidc.dtb ${BOOT_DIR}
|
||||||
cp $BOARD_DIR/bl1.bin.hardkernel $IMG_DIR
|
cp ${BOARD_DIR}/bl1.bin.hardkernel ${IMG_DIR}
|
||||||
cp $BOARD_DIR/u-boot.bin $IMG_DIR
|
cp ${BOARD_DIR}/u-boot.bin ${IMG_DIR}
|
||||||
cp $BOARD_DIR/boot.ini $BOOT_DIR
|
cp ${BOARD_DIR}/boot.ini ${BOOT_DIR}
|
||||||
cp $BOARD_DIR/uInitrd $BOOT_DIR
|
cp ${BOARD_DIR}/uInitrd ${BOOT_DIR}
|
||||||
|
|
||||||
# fix some lib dirs
|
# fix some lib dirs
|
||||||
if ! [ -L $TARGET/lib/arm-linux-gnueabihf ]; then
|
if ! [ -L ${TARGET}/lib/arm-linux-gnueabihf ]; then
|
||||||
mv $TARGET/lib/arm-linux-gnueabihf/* $TARGET/lib
|
mv ${TARGET}/lib/arm-linux-gnueabihf/* ${TARGET}/lib
|
||||||
rmdir $TARGET/lib/arm-linux-gnueabihf
|
rmdir ${TARGET}/lib/arm-linux-gnueabihf
|
||||||
ln -s /lib $TARGET/lib/arm-linux-gnueabihf
|
ln -s /lib ${TARGET}/lib/arm-linux-gnueabihf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -L $TARGET/usr/lib/arm-linux-gnueabihf ]; then
|
if ! [ -L ${TARGET}/usr/lib/arm-linux-gnueabihf ]; then
|
||||||
ln -s /usr/lib $TARGET/usr/lib/arm-linux-gnueabihf
|
ln -s /usr/lib ${TARGET}/usr/lib/arm-linux-gnueabihf
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cp $IMG_DIR/rootfs.cpio.uboot $BOARD_DIR/uInitrd
|
cp ${IMG_DIR}/rootfs.cpio.uboot ${BOARD_DIR}/uInitrd
|
||||||
|
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
BOARD_DIR=$(dirname $0)
|
BOARD_DIR=$(dirname $0)
|
||||||
COMMON_DIR=$BOARD_DIR/../common
|
COMMON_DIR=${BOARD_DIR}/../common
|
||||||
|
|
||||||
export BOARD=$(basename $BOARD_DIR)
|
export BOARD=$(basename ${BOARD_DIR})
|
||||||
export IMG_DIR=$BOARD_DIR/../../output/$BOARD/images/
|
export IMG_DIR=${BOARD_DIR}/../../output/${BOARD}/images/
|
||||||
export UBOOT_BIN=$IMG_DIR/u-boot.bin
|
export UBOOT_BIN=${IMG_DIR}/u-boot.bin
|
||||||
export UBOOT_SEEK=97
|
export UBOOT_SEEK=97
|
||||||
BL1=$IMG_DIR/bl1.bin.hardkernel
|
BL1=${IMG_DIR}/bl1.bin.hardkernel
|
||||||
|
|
||||||
source $COMMON_DIR/mkimage.sh
|
source ${COMMON_DIR}/mkimage.sh
|
||||||
|
|
||||||
dd conv=notrunc if=$BL1 of=$DISK_IMG bs=1 count=442
|
dd conv=notrunc if=${BL1} of=${DISK_IMG} bs=1 count=442
|
||||||
dd conv=notrunc if=$BL1 of=$DISK_IMG bs=512 skip=1 seek=1
|
dd conv=notrunc if=${BL1} of=${DISK_IMG} bs=512 skip=1 seek=1
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
os_tty_login="ttyS0"
|
OS_TTY_LOGIN="ttyS0"
|
||||||
|
|
||||||
|
@ -3,12 +3,12 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
# boot directory
|
# boot directory
|
||||||
mkdir -p $BOOT_DIR
|
mkdir -p ${BOOT_DIR}
|
||||||
|
|
||||||
cp $IMG_DIR/Image $BOOT_DIR
|
cp ${IMG_DIR}/Image ${BOOT_DIR}
|
||||||
cp $IMG_DIR/meson64_odroidc2.dtb $BOOT_DIR
|
cp ${IMG_DIR}/meson64_odroidc2.dtb ${BOOT_DIR}
|
||||||
cp $BOARD_DIR/bl1.bin.hardkernel $IMG_DIR
|
cp ${BOARD_DIR}/bl1.bin.hardkernel ${IMG_DIR}
|
||||||
cp $BOARD_DIR/u-boot.bin $IMG_DIR
|
cp ${BOARD_DIR}/u-boot.bin ${IMG_DIR}
|
||||||
cp $BOARD_DIR/boot.ini $BOOT_DIR
|
cp ${BOARD_DIR}/boot.ini ${BOOT_DIR}
|
||||||
cp $BOARD_DIR/uInitrd $BOOT_DIR
|
cp ${BOARD_DIR}/uInitrd ${BOOT_DIR}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cp $IMG_DIR/rootfs.cpio.uboot $BOARD_DIR/uInitrd
|
cp ${IMG_DIR}/rootfs.cpio.uboot ${BOARD_DIR}/uInitrd
|
||||||
|
|
||||||
|
@ -1,19 +1,19 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
BOARD_DIR=$(dirname $0)
|
BOARD_DIR=$(dirname $0)
|
||||||
COMMON_DIR=$BOARD_DIR/../common
|
COMMON_DIR=${BOARD_DIR}/../common
|
||||||
|
|
||||||
export BOARD=$(basename $BOARD_DIR)
|
export BOARD=$(basename ${BOARD_DIR})
|
||||||
export IMG_DIR=$BOARD_DIR/../../output/$BOARD/images/
|
export IMG_DIR=${BOARD_DIR}/../../output/${BOARD}/images/
|
||||||
export UBOOT_BIN=$IMG_DIR/u-boot.bin
|
export UBOOT_BIN=${IMG_DIR}/u-boot.bin
|
||||||
export UBOOT_SEEK=63
|
export UBOOT_SEEK=63
|
||||||
BL1=$IMG_DIR/bl1.bin.hardkernel
|
BL1=${IMG_DIR}/bl1.bin.hardkernel
|
||||||
BL2=$IMG_DIR/bl2.bin.hardkernel
|
BL2=${IMG_DIR}/bl2.bin.hardkernel
|
||||||
TZSW=$IMG_DIR/tzsw.bin.hardkernel
|
TZSW=${IMG_DIR}/tzsw.bin.hardkernel
|
||||||
source $COMMON_DIR/mkimage.sh
|
source ${COMMON_DIR}/mkimage.sh
|
||||||
|
|
||||||
dd conv=notrunc if=$BL1 of=$DISK_IMG bs=512 seek=1
|
dd conv=notrunc if=${BL1} of=${DISK_IMG} bs=512 seek=1
|
||||||
dd conv=notrunc if=$BL2 of=$DISK_IMG bs=512 seek=31
|
dd conv=notrunc if=${BL2} of=${DISK_IMG} bs=512 seek=31
|
||||||
dd conv=notrunc if=$TZSW of=$DISK_IMG bs=512 seek=719
|
dd conv=notrunc if=${TZSW} of=${DISK_IMG} bs=512 seek=719
|
||||||
dd conv=notrunc if=/dev/zero of=$DISK_IMG bs=512 seek=1231 count=32
|
dd conv=notrunc if=/dev/zero of=${DISK_IMG} bs=512 seek=1231 count=32
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
start)
|
start)
|
||||||
|
@ -3,15 +3,15 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
# boot directory
|
# boot directory
|
||||||
mkdir -p $BOOT_DIR
|
mkdir -p ${BOOT_DIR}
|
||||||
|
|
||||||
cp $BOARD_DIR/bl1.bin.hardkernel $IMG_DIR
|
cp ${BOARD_DIR}/bl1.bin.hardkernel ${IMG_DIR}
|
||||||
cp $BOARD_DIR/bl2.bin.hardkernel $IMG_DIR
|
cp ${BOARD_DIR}/bl2.bin.hardkernel ${IMG_DIR}
|
||||||
cp $BOARD_DIR/tzsw.bin.hardkernel $IMG_DIR
|
cp ${BOARD_DIR}/tzsw.bin.hardkernel ${IMG_DIR}
|
||||||
cp $BOARD_DIR/u-boot.bin $IMG_DIR
|
cp ${BOARD_DIR}/u-boot.bin ${IMG_DIR}
|
||||||
|
|
||||||
cp $IMG_DIR/zImage $BOOT_DIR
|
cp ${IMG_DIR}/zImage ${BOOT_DIR}
|
||||||
cp $IMG_DIR/exynos5422-odroidxu4.dtb $BOOT_DIR
|
cp ${IMG_DIR}/exynos5422-odroidxu4.dtb ${BOOT_DIR}
|
||||||
cp $BOARD_DIR/boot.ini $BOOT_DIR
|
cp ${BOARD_DIR}/boot.ini ${BOOT_DIR}
|
||||||
cp $BOARD_DIR/uInitrd $BOOT_DIR
|
cp ${BOARD_DIR}/uInitrd ${BOOT_DIR}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cp $IMG_DIR/rootfs.cpio.uboot $BOARD_DIR/uInitrd
|
cp ${IMG_DIR}/rootfs.cpio.uboot ${BOARD_DIR}/uInitrd
|
||||||
|
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
BOARD_DIR=$(dirname $0)
|
BOARD_DIR=$(dirname $0)
|
||||||
COMMON_DIR=$BOARD_DIR/../common
|
COMMON_DIR=${BOARD_DIR}/../common
|
||||||
|
|
||||||
export BOARD=$(basename $BOARD_DIR)
|
export BOARD=$(basename ${BOARD_DIR})
|
||||||
export IMG_DIR=$BOARD_DIR/../../output/$BOARD/images/
|
export IMG_DIR=${BOARD_DIR}/../../output/${BOARD}/images/
|
||||||
export UBOOT_BIN=$IMG_DIR/u-boot-sunxi-with-spl.bin
|
export UBOOT_BIN=${IMG_DIR}/u-boot-sunxi-with-spl.bin
|
||||||
export UBOOT_SEEK=16
|
export UBOOT_SEEK=16
|
||||||
export BOOT_START=20
|
export BOOT_START=20
|
||||||
source $COMMON_DIR/mkimage.sh
|
source ${COMMON_DIR}/mkimage.sh
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
$HOST_DIR/bin/mkimage -C none -A arm -T script -d $BOARD_DIR/boot.cmd $BOOT_DIR/boot.scr
|
${HOST_DIR}/bin/mkimage -C none -A arm -T script -d ${BOARD_DIR}/boot.cmd ${BOOT_DIR}/boot.scr
|
||||||
$HOST_DIR/bin/mkimage -C none -A arm -T script -d $BOARD_DIR/boot-fwupdater.cmd $BOOT_DIR/boot-fwupdater.scr
|
${HOST_DIR}/bin/mkimage -C none -A arm -T script -d ${BOARD_DIR}/boot-fwupdater.cmd ${BOOT_DIR}/boot-fwupdater.scr
|
||||||
|
|
||||||
cp $IMG_DIR/zImage $BOOT_DIR
|
cp ${IMG_DIR}/zImage ${BOOT_DIR}
|
||||||
cp $IMG_DIR/sun8i-h3-orangepi-one.dtb $BOOT_DIR
|
cp ${IMG_DIR}/sun8i-h3-orangepi-one.dtb ${BOOT_DIR}
|
||||||
cp $BOARD_DIR/rootfs.cpio.uboot $BOOT_DIR
|
cp ${BOARD_DIR}/rootfs.cpio.uboot ${BOOT_DIR}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cp $IMG_DIR/rootfs.cpio.uboot $BOARD_DIR/uInitrd
|
cp ${IMG_DIR}/rootfs.cpio.uboot ${BOARD_DIR}/uInitrd
|
||||||
|
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
BOARD_DIR=$(dirname $0)
|
BOARD_DIR=$(dirname $0)
|
||||||
COMMON_DIR=$BOARD_DIR/../common
|
COMMON_DIR=${BOARD_DIR}/../common
|
||||||
|
|
||||||
export BOARD=$(basename $BOARD_DIR)
|
export BOARD=$(basename ${BOARD_DIR})
|
||||||
export IMG_DIR=$BOARD_DIR/../../output/$BOARD/images/
|
export IMG_DIR=${BOARD_DIR}/../../output/${BOARD}/images/
|
||||||
export UBOOT_BIN=$BOARD_DIR/u-boot-with-dtb.bin
|
export UBOOT_BIN=${BOARD_DIR}/u-boot-with-dtb.bin
|
||||||
export UBOOT_SEEK=38192
|
export UBOOT_SEEK=38192
|
||||||
export BOOT_START=20
|
export BOOT_START=20
|
||||||
BOOT0=$BOARD_DIR/boot0.bin
|
BOOT0=${BOARD_DIR}/boot0.bin
|
||||||
|
|
||||||
source $COMMON_DIR/mkimage.sh
|
source ${COMMON_DIR}/mkimage.sh
|
||||||
|
|
||||||
dd conv=notrunc if=$BOOT0 of=$DISK_IMG bs=1k seek=8 count=32 oflag=direct
|
dd conv=notrunc if=${BOOT0} of=${DISK_IMG} bs=1k seek=8 count=32 oflag=direct
|
||||||
|
|
||||||
|
@ -3,10 +3,10 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
# boot directory
|
# boot directory
|
||||||
mkdir -p $BOOT_DIR/pine64
|
mkdir -p ${BOOT_DIR}/pine64
|
||||||
|
|
||||||
cp $IMG_DIR/Image $BOOT_DIR/kernel.img
|
cp ${IMG_DIR}/Image ${BOOT_DIR}/kernel.img
|
||||||
cp $BOARD_DIR/uEnv.txt $BOOT_DIR
|
cp ${BOARD_DIR}/uEnv.txt ${BOOT_DIR}
|
||||||
cp $BOARD_DIR/dtb/* $BOOT_DIR/pine64
|
cp ${BOARD_DIR}/dtb/* ${BOOT_DIR}/pine64
|
||||||
cp $BOARD_DIR/fwupdater.img $BOOT_DIR
|
cp ${BOARD_DIR}/fwupdater.img ${BOOT_DIR}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
rm -rf $TARGET/opt/vc/src
|
rm -rf ${TARGET}/opt/vc/src
|
||||||
rm -rf $TARGET/opt/vc/include
|
rm -rf ${TARGET}/opt/vc/include
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
cp $IMG_DIR/rootfs.cpio.gz $BOARD_DIR/fwupdater.gz
|
cp ${IMG_DIR}/rootfs.cpio.gz ${BOARD_DIR}/fwupdater.gz
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
BOARD_DIR=$(dirname $0)
|
BOARD_DIR=$(dirname $0)
|
||||||
COMMON_DIR=$BOARD_DIR/../common
|
COMMON_DIR=${BOARD_DIR}/../common
|
||||||
|
|
||||||
export BOARD=$(basename $BOARD_DIR)
|
export BOARD=$(basename ${BOARD_DIR})
|
||||||
export IMG_DIR=$BOARD_DIR/../../output/$BOARD/images/
|
export IMG_DIR=${BOARD_DIR}/../../output/${BOARD}/images/
|
||||||
|
|
||||||
$COMMON_DIR/mkimage.sh
|
${COMMON_DIR}/mkimage.sh
|
||||||
|
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
GOV="ondemand"
|
||||||
|
CPUFREQDIR="/sys/devices/system/cpu/cpu0/cpufreq"
|
||||||
|
GOVDIR="/sys/devices/system/cpu/cpufreq/${GOV}"
|
||||||
|
|
||||||
gov="ondemand"
|
|
||||||
cpufreqdir="/sys/devices/system/cpu/cpu0/cpufreq"
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
govdir="/sys/devices/system/cpu/cpufreq/$gov"
|
|
||||||
|
|
||||||
configure() {
|
configure() {
|
||||||
echo $gov > $cpufreqdir/scaling_governor
|
echo ${GOV} > ${CPUFREQDIR}/scaling_governor
|
||||||
if [[ $gov == "ondemand" ]]; then
|
if [[ ${GOV} == "ondemand" ]]; then
|
||||||
echo 50 > $govdir/up_threshold
|
echo 50 > ${GOVDIR}/up_threshold
|
||||||
echo 100000 > $govdir/sampling_rate
|
echo 100000 > ${GOVDIR}/sampling_rate
|
||||||
echo 50 > $govdir/sampling_down_factor
|
echo 50 > ${GOVDIR}/sampling_down_factor
|
||||||
echo 1 > $govdir/io_is_busy
|
echo 1 > ${GOVDIR}/io_is_busy
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
check_interval=30
|
CHECK_INTERVAL=30
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
get_throttled_now() {
|
get_throttled_now() {
|
||||||
t=$(vcgencmd get_throttled | cut -d '=' -f 2)
|
t=$(vcgencmd get_throttled | cut -d '=' -f 2)
|
||||||
@ -21,23 +22,23 @@ get_throttled_since_boot() {
|
|||||||
watch_now() {
|
watch_now() {
|
||||||
while true; do
|
while true; do
|
||||||
t=$(get_throttled_now)
|
t=$(get_throttled_now)
|
||||||
if [[ -n "$t" ]]; then
|
if [[ -n "${t}" ]]; then
|
||||||
logger -t throttlewatch -s "currently: $t"
|
logger -t throttlewatch -s "currently: ${t}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep $check_interval
|
sleep ${CHECK_INTERVAL}
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
watch_since_boot() {
|
watch_since_boot() {
|
||||||
while true; do
|
while true; do
|
||||||
t=$(get_throttled_since_boot)
|
t=$(get_throttled_since_boot)
|
||||||
if [[ -n "$t" ]]; then
|
if [[ -n "${t}" ]]; then
|
||||||
logger -t throttlewatch -s "since boot: $t"
|
logger -t throttlewatch -s "since boot: ${t}"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep $check_interval
|
sleep ${CHECK_INTERVAL}
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,14 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
sys_conf="/etc/bluetooth.conf"
|
SYS_CONF="/etc/bluetooth.conf"
|
||||||
boot_conf="/boot/bluetooth.conf"
|
BOOT_CONF="/boot/bluetooth.conf"
|
||||||
conf="/data/etc/bluetooth.conf"
|
CONF="/data/etc/bluetooth.conf"
|
||||||
|
|
||||||
test -f $conf || test -f $boot_conf || test -f $sys_conf || exit 0
|
|
||||||
|
test -f ${CONF} || test -f ${BOOT_CONF} || test -f ${SYS_CONF} || exit 0
|
||||||
|
|
||||||
test -d "/proc/device-tree/soc/gpio@7e200000/uart0_pins" || exit 0 # no rpi bluetooth detected
|
test -d "/proc/device-tree/soc/gpio@7e200000/uart0_pins" || exit 0 # no rpi bluetooth detected
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
if [[ "$(cat /proc/device-tree/aliases/uart0)" = "$(cat /proc/device-tree/aliases/serial1)" ]] ; then
|
if [[ "$(cat /proc/device-tree/aliases/uart0)" = "$(cat /proc/device-tree/aliases/serial1)" ]] ; then
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
motioneye_conf_dir="/data/etc/"
|
MOTIONEYE_CONF_DIR="/data/etc/"
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
enabled() {
|
enabled() {
|
||||||
test $(ls -1 $motioneye_conf_dir/thread-*.conf 2>/dev/null| wc -l) == 1 || return 1
|
test $(ls -1 ${MOTIONEYE_CONF_DIR}/thread-*.conf 2>/dev/null| wc -l) == 1 || return 1
|
||||||
|
|
||||||
grep '# @proto mjpeg' $motioneye_conf_dir/thread-1.conf &>/dev/null || return 1
|
grep '# @proto mjpeg' ${MOTIONEYE_CONF_DIR}/thread-1.conf &>/dev/null || return 1
|
||||||
|
|
||||||
grep -E '# @url http://(.*)127.0.0.1:' $motioneye_conf_dir/thread-1.conf &>/dev/null || return 1
|
grep -E '# @url http://(.*)127.0.0.1:' ${MOTIONEYE_CONF_DIR}/thread-1.conf &>/dev/null || return 1
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,9 @@ MOTIONEYE_CONF=/data/etc/motioneye.conf
|
|||||||
STREAMEYE_CONF=/data/etc/streameye.conf
|
STREAMEYE_CONF=/data/etc/streameye.conf
|
||||||
STREAMEYE_LOG=/var/log/streameye.log
|
STREAMEYE_LOG=/var/log/streameye.log
|
||||||
|
|
||||||
test -r $RASPIMJPEG_CONF || exit 1
|
|
||||||
test -r $STREAMEYE_CONF || exit 1
|
test -r ${RASPIMJPEG_CONF} || exit 1
|
||||||
|
test -r ${STREAMEYE_CONF} || exit 1
|
||||||
|
|
||||||
watch() {
|
watch() {
|
||||||
count=0
|
count=0
|
||||||
@ -22,33 +23,33 @@ watch() {
|
|||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1)
|
pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1)
|
||||||
if [ -n "$pid" ]; then
|
if [ -n "${pid}" ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
raspimjpeg_opts=""
|
raspimjpeg_opts=""
|
||||||
while read line; do
|
while read line; do
|
||||||
if echo "$line" | grep false &>/dev/null; then
|
if echo "${line}" | grep false &>/dev/null; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
if echo "$line" | grep true &>/dev/null; then
|
if echo "${line}" | grep true &>/dev/null; then
|
||||||
line=$(echo $line | cut -d ' ' -f 1)
|
line=$(echo ${line} | cut -d ' ' -f 1)
|
||||||
fi
|
fi
|
||||||
raspimjpeg_opts="$raspimjpeg_opts --$line"
|
raspimjpeg_opts="${raspimjpeg_opts} --${line}"
|
||||||
done < $RASPIMJPEG_CONF
|
done < ${RASPIMJPEG_CONF}
|
||||||
|
|
||||||
source $STREAMEYE_CONF
|
source ${STREAMEYE_CONF}
|
||||||
streameye_opts="-p $PORT"
|
streameye_opts="-p ${PORT}"
|
||||||
if [ -n "$CREDENTIALS" ] && [ "$AUTH" = "basic" ]; then
|
if [ -n "${CREDENTIALS}" ] && [ "${AUTH}" = "basic" ]; then
|
||||||
streameye_opts="$streameye_opts -a basic -c $CREDENTIALS"
|
streameye_opts="${streameye_opts} -a basic -c ${CREDENTIALS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -r $MOTIONEYE_CONF ] && grep 'log-level debug' $MOTIONEYE_CONF >/dev/null; then
|
if [ -r ${MOTIONEYE_CONF} ] && grep 'log-level debug' ${MOTIONEYE_CONF} >/dev/null; then
|
||||||
raspimjpeg_opts="$raspimjpeg_opts -d"
|
raspimjpeg_opts="${raspimjpeg_opts} -d"
|
||||||
streameye_opts="$streameye_opts -d"
|
streameye_opts="${streameye_opts} -d"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
raspimjpeg.py $raspimjpeg_opts 2>$RASPIMJPEG_LOG | streameye $streameye_opts &>$STREAMEYE_LOG &
|
raspimjpeg.py ${raspimjpeg_opts} 2>${RASPIMJPEG_LOG} | streameye ${streameye_opts} &>${STREAMEYE_LOG} &
|
||||||
}
|
}
|
||||||
|
|
||||||
function stop() {
|
function stop() {
|
||||||
@ -57,17 +58,17 @@ function stop() {
|
|||||||
|
|
||||||
# stop the raspimjpeg process
|
# stop the raspimjpeg process
|
||||||
pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1)
|
pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1)
|
||||||
if [ -z "$pid" ]; then
|
if [ -z "${pid}" ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
kill -HUP "$pid" &>/dev/null
|
kill -HUP "${pid}" &>/dev/null
|
||||||
count=0
|
count=0
|
||||||
while kill -0 "$pid" &>/dev/null && [ $count -lt 5 ]; do
|
while kill -0 "${pid}" &>/dev/null && [ ${count} -lt 5 ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
count=$(($count + 1))
|
count=$((${count} + 1))
|
||||||
done
|
done
|
||||||
kill -KILL "$pid" &>/dev/null || true
|
kill -KILL "${pid}" &>/dev/null || true
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
@ -6,5 +6,5 @@ if [ -z "$1" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
old_boot=$1
|
old_boot=$1
|
||||||
cp $old_boot/config.txt /boot
|
cp ${old_boot}/config.txt /boot
|
||||||
|
|
||||||
|
@ -2,17 +2,17 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
RPI_FW_DIR=$TARGET/../images/rpi-firmware
|
RPI_FW_DIR=${TARGET}/../images/rpi-firmware
|
||||||
|
|
||||||
cp $BOARD_DIR/config.txt $BOOT_DIR
|
cp ${BOARD_DIR}/config.txt ${BOOT_DIR}
|
||||||
cp $BOARD_DIR/cmdline.txt $BOOT_DIR
|
cp ${BOARD_DIR}/cmdline.txt ${BOOT_DIR}
|
||||||
cp $BOARD_DIR/fwupdater.gz $BOOT_DIR
|
cp ${BOARD_DIR}/fwupdater.gz ${BOOT_DIR}
|
||||||
cp $IMG_DIR/zImage $BOOT_DIR/kernel.img
|
cp ${IMG_DIR}/zImage ${BOOT_DIR}/kernel.img
|
||||||
cp $IMG_DIR/bcm2708-rpi-b.dtb $BOOT_DIR
|
cp ${IMG_DIR}/bcm2708-rpi-b.dtb ${BOOT_DIR}
|
||||||
cp $IMG_DIR/bcm2708-rpi-b-plus.dtb $BOOT_DIR
|
cp ${IMG_DIR}/bcm2708-rpi-b-plus.dtb ${BOOT_DIR}
|
||||||
cp $IMG_DIR/bcm2708-rpi-cm.dtb $BOOT_DIR
|
cp ${IMG_DIR}/bcm2708-rpi-cm.dtb ${BOOT_DIR}
|
||||||
cp $IMG_DIR/bcm2708-rpi-0-w.dtb $BOOT_DIR
|
cp ${IMG_DIR}/bcm2708-rpi-0-w.dtb ${BOOT_DIR}
|
||||||
cp $RPI_FW_DIR/bootcode.bin $BOOT_DIR
|
cp ${RPI_FW_DIR}/bootcode.bin ${BOOT_DIR}
|
||||||
cp $RPI_FW_DIR/start.elf $BOOT_DIR
|
cp ${RPI_FW_DIR}/start.elf ${BOOT_DIR}
|
||||||
cp $RPI_FW_DIR/fixup.dat $BOOT_DIR
|
cp ${RPI_FW_DIR}/fixup.dat ${BOOT_DIR}
|
||||||
|
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
GOV="ondemand"
|
||||||
|
CPUFREQDIR="/sys/devices/system/cpu/cpu0/cpufreq"
|
||||||
|
GOVDIR="/sys/devices/system/cpu/cpufreq/${GOV}"
|
||||||
|
|
||||||
gov="ondemand"
|
|
||||||
cpufreqdir="/sys/devices/system/cpu/cpu0/cpufreq"
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
govdir="/sys/devices/system/cpu/cpufreq/$gov"
|
|
||||||
|
|
||||||
configure() {
|
configure() {
|
||||||
echo $gov > $cpufreqdir/scaling_governor
|
echo ${GOV} > ${CPUFREQDIR}/scaling_governor
|
||||||
if [[ $gov == "ondemand" ]]; then
|
if [[ ${GOV} == "ondemand" ]]; then
|
||||||
echo 50 > $govdir/up_threshold
|
echo 50 > ${GOVDIR}/up_threshold
|
||||||
echo 100000 > $govdir/sampling_rate
|
echo 100000 > ${GOVDIR}/sampling_rate
|
||||||
echo 50 > $govdir/sampling_down_factor
|
echo 50 > ${GOVDIR}/sampling_down_factor
|
||||||
echo 1 > $govdir/io_is_busy
|
echo 1 > ${GOVDIR}/io_is_busy
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
check_interval=30
|
CHECK_INTERVAL=30
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
get_throttled_now() {
|
get_throttled_now() {
|
||||||
t=$(vcgencmd get_throttled | cut -d '=' -f 2)
|
t=$(vcgencmd get_throttled | cut -d '=' -f 2)
|
||||||
@ -21,23 +22,23 @@ get_throttled_since_boot() {
|
|||||||
watch_now() {
|
watch_now() {
|
||||||
while true; do
|
while true; do
|
||||||
t=$(get_throttled_now)
|
t=$(get_throttled_now)
|
||||||
if [[ -n "$t" ]]; then
|
if [[ -n "${t}" ]]; then
|
||||||
logger -t throttlewatch -s "currently: $t"
|
logger -t throttlewatch -s "currently: ${t}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep $check_interval
|
sleep ${CHECK_INTERVAL}
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
watch_since_boot() {
|
watch_since_boot() {
|
||||||
while true; do
|
while true; do
|
||||||
t=$(get_throttled_since_boot)
|
t=$(get_throttled_since_boot)
|
||||||
if [[ -n "$t" ]]; then
|
if [[ -n "${t}" ]]; then
|
||||||
logger -t throttlewatch -s "since boot: $t"
|
logger -t throttlewatch -s "since boot: ${t}"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep $check_interval
|
sleep ${CHECK_INTERVAL}
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
motioneye_conf_dir="/data/etc/"
|
MOTIONEYE_CONF_DIR="/data/etc/"
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
enabled() {
|
enabled() {
|
||||||
test $(ls -1 $motioneye_conf_dir/thread-*.conf 2>/dev/null| wc -l) == 1 || return 1
|
test $(ls -1 ${MOTIONEYE_CONF_DIR}/thread-*.conf 2>/dev/null| wc -l) == 1 || return 1
|
||||||
|
|
||||||
grep '# @proto mjpeg' $motioneye_conf_dir/thread-1.conf &>/dev/null || return 1
|
grep '# @proto mjpeg' ${MOTIONEYE_CONF_DIR}/thread-1.conf &>/dev/null || return 1
|
||||||
|
|
||||||
grep -E '# @url http://(.*)127.0.0.1:' $motioneye_conf_dir/thread-1.conf &>/dev/null || return 1
|
grep -E '# @url http://(.*)127.0.0.1:' ${MOTIONEYE_CONF_DIR}/thread-1.conf &>/dev/null || return 1
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,9 @@ MOTIONEYE_CONF=/data/etc/motioneye.conf
|
|||||||
STREAMEYE_CONF=/data/etc/streameye.conf
|
STREAMEYE_CONF=/data/etc/streameye.conf
|
||||||
STREAMEYE_LOG=/var/log/streameye.log
|
STREAMEYE_LOG=/var/log/streameye.log
|
||||||
|
|
||||||
test -r $RASPIMJPEG_CONF || exit 1
|
|
||||||
test -r $STREAMEYE_CONF || exit 1
|
test -r ${RASPIMJPEG_CONF} || exit 1
|
||||||
|
test -r ${STREAMEYE_CONF} || exit 1
|
||||||
|
|
||||||
watch() {
|
watch() {
|
||||||
count=0
|
count=0
|
||||||
@ -22,33 +23,33 @@ watch() {
|
|||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1)
|
pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1)
|
||||||
if [ -n "$pid" ]; then
|
if [ -n "${pid}" ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
raspimjpeg_opts=""
|
raspimjpeg_opts=""
|
||||||
while read line; do
|
while read line; do
|
||||||
if echo "$line" | grep false &>/dev/null; then
|
if echo "${line}" | grep false &>/dev/null; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
if echo "$line" | grep true &>/dev/null; then
|
if echo "${line}" | grep true &>/dev/null; then
|
||||||
line=$(echo $line | cut -d ' ' -f 1)
|
line=$(echo ${line} | cut -d ' ' -f 1)
|
||||||
fi
|
fi
|
||||||
raspimjpeg_opts="$raspimjpeg_opts --$line"
|
raspimjpeg_opts="${raspimjpeg_opts} --${line}"
|
||||||
done < $RASPIMJPEG_CONF
|
done < ${RASPIMJPEG_CONF}
|
||||||
|
|
||||||
source $STREAMEYE_CONF
|
source ${STREAMEYE_CONF}
|
||||||
streameye_opts="-p $PORT"
|
streameye_opts="-p ${PORT}"
|
||||||
if [ -n "$CREDENTIALS" ] && [ "$AUTH" = "basic" ]; then
|
if [ -n "${CREDENTIALS}" ] && [ "${AUTH}" = "basic" ]; then
|
||||||
streameye_opts="$streameye_opts -a basic -c $CREDENTIALS"
|
streameye_opts="${streameye_opts} -a basic -c ${CREDENTIALS}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -r $MOTIONEYE_CONF ] && grep 'log-level debug' $MOTIONEYE_CONF >/dev/null; then
|
if [ -r ${MOTIONEYE_CONF} ] && grep 'log-level debug' ${MOTIONEYE_CONF} >/dev/null; then
|
||||||
raspimjpeg_opts="$raspimjpeg_opts -d"
|
raspimjpeg_opts="${raspimjpeg_opts} -d"
|
||||||
streameye_opts="$streameye_opts -d"
|
streameye_opts="${streameye_opts} -d"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
raspimjpeg.py $raspimjpeg_opts 2>$RASPIMJPEG_LOG | streameye $streameye_opts &>$STREAMEYE_LOG &
|
raspimjpeg.py ${raspimjpeg_opts} 2>${RASPIMJPEG_LOG} | streameye ${streameye_opts} &>${STREAMEYE_LOG} &
|
||||||
}
|
}
|
||||||
|
|
||||||
function stop() {
|
function stop() {
|
||||||
@ -57,17 +58,17 @@ function stop() {
|
|||||||
|
|
||||||
# stop the raspimjpeg process
|
# stop the raspimjpeg process
|
||||||
pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1)
|
pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1)
|
||||||
if [ -z "$pid" ]; then
|
if [ -z "${pid}" ]; then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
kill -HUP "$pid" &>/dev/null
|
kill -HUP "${pid}" &>/dev/null
|
||||||
count=0
|
count=0
|
||||||
while kill -0 "$pid" &>/dev/null && [ $count -lt 5 ]; do
|
while kill -0 "${pid}" &>/dev/null && [ ${count} -lt 5 ]; do
|
||||||
sleep 1
|
sleep 1
|
||||||
count=$(($count + 1))
|
count=$((${count} + 1))
|
||||||
done
|
done
|
||||||
kill -KILL "$pid" &>/dev/null || true
|
kill -KILL "${pid}" &>/dev/null || true
|
||||||
}
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
|
@ -6,5 +6,5 @@ if [ -z "$1" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
old_boot=$1
|
old_boot=$1
|
||||||
cp $old_boot/config.txt /boot
|
cp ${old_boot}/config.txt /boot
|
||||||
|
|
||||||
|
@ -2,14 +2,14 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
RPI_FW_DIR=$TARGET/../images/rpi-firmware
|
RPI_FW_DIR=${TARGET}/../images/rpi-firmware
|
||||||
|
|
||||||
cp $BOARD_DIR/config.txt $BOOT_DIR
|
cp ${BOARD_DIR}/config.txt ${BOOT_DIR}
|
||||||
cp $BOARD_DIR/cmdline.txt $BOOT_DIR
|
cp ${BOARD_DIR}/cmdline.txt ${BOOT_DIR}
|
||||||
cp $BOARD_DIR/fwupdater.gz $BOOT_DIR
|
cp ${BOARD_DIR}/fwupdater.gz ${BOOT_DIR}
|
||||||
cp $IMG_DIR/zImage $BOOT_DIR/kernel.img
|
cp ${IMG_DIR}/zImage ${BOOT_DIR}/kernel.img
|
||||||
cp $IMG_DIR/bcm2709-rpi-2-b.dtb $BOOT_DIR
|
cp ${IMG_DIR}/bcm2709-rpi-2-b.dtb ${BOOT_DIR}
|
||||||
cp $RPI_FW_DIR/bootcode.bin $BOOT_DIR
|
cp ${RPI_FW_DIR}/bootcode.bin ${BOOT_DIR}
|
||||||
cp $RPI_FW_DIR/start.elf $BOOT_DIR
|
cp ${RPI_FW_DIR}/start.elf ${BOOT_DIR}
|
||||||
cp $RPI_FW_DIR/fixup.dat $BOOT_DIR
|
cp ${RPI_FW_DIR}/fixup.dat ${BOOT_DIR}
|
||||||
|
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
GOV="ondemand"
|
||||||
|
CPUFREQDIR="/sys/devices/system/cpu/cpu0/cpufreq"
|
||||||
|
GOVDIR="/sys/devices/system/cpu/cpufreq/${GOV}"
|
||||||
|
|
||||||
gov="ondemand"
|
|
||||||
cpufreqdir="/sys/devices/system/cpu/cpu0/cpufreq"
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
govdir="/sys/devices/system/cpu/cpufreq/$gov"
|
|
||||||
|
|
||||||
configure() {
|
configure() {
|
||||||
echo $gov > $cpufreqdir/scaling_governor
|
echo ${GOV} > ${CPUFREQDIR}/scaling_governor
|
||||||
if [[ $gov == "ondemand" ]]; then
|
if [[ ${GOV} == "ondemand" ]]; then
|
||||||
echo 50 > $govdir/up_threshold
|
echo 50 > ${GOVDIR}/up_threshold
|
||||||
echo 100000 > $govdir/sampling_rate
|
echo 100000 > ${GOVDIR}/sampling_rate
|
||||||
echo 50 > $govdir/sampling_down_factor
|
echo 50 > ${GOVDIR}/sampling_down_factor
|
||||||
echo 1 > $govdir/io_is_busy
|
echo 1 > ${GOVDIR}/io_is_busy
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
check_interval=30
|
CHECK_INTERVAL=30
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
get_throttled_now() {
|
get_throttled_now() {
|
||||||
t=$(vcgencmd get_throttled | cut -d '=' -f 2)
|
t=$(vcgencmd get_throttled | cut -d '=' -f 2)
|
||||||
@ -21,23 +22,23 @@ get_throttled_since_boot() {
|
|||||||
watch_now() {
|
watch_now() {
|
||||||
while true; do
|
while true; do
|
||||||
t=$(get_throttled_now)
|
t=$(get_throttled_now)
|
||||||
if [[ -n "$t" ]]; then
|
if [[ -n "${t}" ]]; then
|
||||||
logger -t throttlewatch -s "currently: $t"
|
logger -t throttlewatch -s "currently: ${t}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep $check_interval
|
sleep ${CHECK_INTERVAL}
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
watch_since_boot() {
|
watch_since_boot() {
|
||||||
while true; do
|
while true; do
|
||||||
t=$(get_throttled_since_boot)
|
t=$(get_throttled_since_boot)
|
||||||
if [[ -n "$t" ]]; then
|
if [[ -n "${t}" ]]; then
|
||||||
logger -t throttlewatch -s "since boot: $t"
|
logger -t throttlewatch -s "since boot: ${t}"
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sleep $check_interval
|
sleep ${CHECK_INTERVAL}
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
sys_conf="/etc/bluetooth.conf"
|
SYS_CONF="/etc/bluetooth.conf"
|
||||||
boot_conf="/boot/bluetooth.conf"
|
BOOT_CONF="/boot/bluetooth.conf"
|
||||||
conf="/data/etc/bluetooth.conf"
|
CONF="/data/etc/bluetooth.conf"
|
||||||
|
|
||||||
test -f $conf || test -f $boot_conf || test -f $sys_conf || exit 0
|
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
test -f ${CONF} || test -f ${BOOT_CONF} || test -f ${SYS_CONF} || exit 0
|
||||||
|
|
||||||
|
test -d "/proc/device-tree/soc/gpio@7e200000/uart0_pins" || exit 0 # no rpi bluetooth detected
|
||||||
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
if [[ "$(cat /proc/device-tree/aliases/uart0)" = "$(cat /proc/device-tree/aliases/serial1)" ]] ; then
|
if [[ "$(cat /proc/device-tree/aliases/uart0)" = "$(cat /proc/device-tree/aliases/serial1)" ]] ; then
|
||||||
|
@ -1,15 +1,16 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
motioneye_conf_dir="/data/etc/"
|
MOTIONEYE_CONF_DIR="/data/etc/"
|
||||||
|
|
||||||
test -n "$os_version" || source /etc/init.d/base
|
|
||||||
|
test -n "${OS_VERSION}" || source /etc/init.d/base
|
||||||
|
|
||||||
enabled() {
|
enabled() {
|
||||||
test $(ls -1 $motioneye_conf_dir/thread-*.conf 2>/dev/null| wc -l) == 1 || return 1
|
test $(ls -1 ${MOTIONEYE_CONF_DIR}/thread-*.conf 2>/dev/null| wc -l) == 1 || return 1
|
||||||
|
|
||||||
grep '# @proto mjpeg' $motioneye_conf_dir/thread-1.conf &>/dev/null || return 1
|
grep '# @proto mjpeg' ${MOTIONEYE_CONF_DIR}/thread-1.conf &>/dev/null || return 1
|
||||||
|
|
||||||
grep -E '# @url http://(.*)127.0.0.1:' $motioneye_conf_dir/thread-1.conf &>/dev/null || return 1
|
grep -E '# @url http://(.*)127.0.0.1:' ${MOTIONEYE_CONF_DIR}/thread-1.conf &>/dev/null || return 1
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user