EVERYTHING FROM THE OTHER REPO
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Enabling wireless..."
|
||||
if ! [ -d /sys/class/gpio/gpio191 ] ; then
|
||||
echo 191 > /sys/class/gpio/export
|
||||
echo out > /sys/class/gpio/gpio191/direction
|
||||
fi
|
||||
echo 0 > /sys/class/gpio/gpio191/value
|
||||
sleep 5
|
||||
;;
|
||||
stop)
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Start the network....
|
||||
#
|
||||
|
||||
# Debian ifupdown needs the /run/network lock directory
|
||||
mkdir -p /run/network
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Starting network..."
|
||||
/sbin/ifup -a
|
||||
;;
|
||||
stop)
|
||||
printf "Stopping network..."
|
||||
/sbin/ifdown -a
|
||||
;;
|
||||
restart|reload)
|
||||
"$0" stop
|
||||
"$0" start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Fixup OS inconsistencies between builds
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
# make directory if it doesn't exist
|
||||
# arguments <dir> <owner> <perm>
|
||||
make_dir() {
|
||||
dir=$1
|
||||
owner=$2
|
||||
perm=$3
|
||||
if [ ! -e "$dir" ]; then
|
||||
echo -n "create $dir... "
|
||||
mkdir "$dir"
|
||||
chown "$owner":"$owner" "$dir"
|
||||
chmod "$perm" "$dir"
|
||||
fi
|
||||
}
|
||||
|
||||
# skill users did not exist in RTM2, and their home directories
|
||||
# are not part of the rootfs, so we need to create them after the fact
|
||||
make_skill_home_dirs() {
|
||||
make_dir /opt/home root 0755
|
||||
make_dir /opt/home/jibo-skill jibo-skill 0755
|
||||
}
|
||||
|
||||
INTERFACES="/var/etc/network/interfaces"
|
||||
|
||||
# patch the interfaces file for RTM2 robots, if needed
|
||||
patch_network_interfaces() {
|
||||
if ! grep -q "post-up wireless-startup" "${INTERFACES}"; then
|
||||
sed -i "s|post-up wpa_supplicant -B -i wlan0 -c /var/etc/wpa_supplicant.conf|post-up wireless-startup|" ${INTERFACES}
|
||||
#else
|
||||
# This is already fixed
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
start() {
|
||||
echo -n "Fixup OS: "
|
||||
make_skill_home_dirs
|
||||
patch_network_interfaces
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n "Fixup OS: "
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
|
||||
start() {
|
||||
printf "Starting rsyslog daemon: "
|
||||
start-stop-daemon -S -q -p /var/run/rsyslogd.pid --exec /usr/sbin/rsyslogd
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping rsyslog daemon: "
|
||||
start-stop-daemon -K -q -p /var/run/rsyslogd.pid
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
}
|
||||
|
||||
restart() {
|
||||
stop
|
||||
sleep 1
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
@@ -0,0 +1,99 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: jibo-skills-logd
|
||||
# Required-Start: $local_fs
|
||||
# Required-Stop: $local_fs
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: UDP log daemon for Jibo Skills
|
||||
### END INIT INFO
|
||||
|
||||
# Install path on robot:
|
||||
# /etc/init.d/jibo-skills-logd (this file)
|
||||
# and ensure executable: chmod +x /etc/init.d/jibo-skills-logd
|
||||
# Enable (varies by distro):
|
||||
# update-rc.d jibo-skills-logd defaults
|
||||
# or (BusyBox init): create symlink in /etc/rc.d/rcS.d/ or /etc/rc?.d/
|
||||
|
||||
PYTHON_BIN=${PYTHON_BIN:-/usr/bin/python}
|
||||
DAEMON=${DAEMON:-/opt/jibo/Jibo/Skills/tools/robot/logd/jibo_logd.py}
|
||||
PIDFILE=${PIDFILE:-/tmp/jibo-skills-logd.pid}
|
||||
HOST=${JIBO_LOGD_HOST:-127.0.0.1}
|
||||
PORT=${JIBO_LOGD_PORT:-15140}
|
||||
LOGFILE=${JIBO_LOGD_FILE:-/tmp/jibo-skills.log}
|
||||
|
||||
start() {
|
||||
echo "Starting jibo-skills-logd"
|
||||
if [ -f "$PIDFILE" ]; then
|
||||
PID=$(cat "$PIDFILE" 2>/dev/null)
|
||||
if [ -n "$PID" ] && kill -0 "$PID" 2>/dev/null; then
|
||||
echo "Already running (pid $PID)"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# best effort: ensure logfile dir exists
|
||||
mkdir -p "$(dirname "$LOGFILE")" 2>/dev/null
|
||||
|
||||
"$PYTHON_BIN" "$DAEMON" --host "$HOST" --port "$PORT" --logfile "$LOGFILE" --daemonize --pidfile "$PIDFILE"
|
||||
sleep 1
|
||||
if [ -f "$PIDFILE" ]; then
|
||||
echo "Started (pid $(cat "$PIDFILE" 2>/dev/null))"
|
||||
return 0
|
||||
fi
|
||||
echo "Failed to start"
|
||||
return 1
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo "Stopping jibo-skills-logd"
|
||||
if [ ! -f "$PIDFILE" ]; then
|
||||
echo "Not running (no pidfile)"
|
||||
return 0
|
||||
fi
|
||||
PID=$(cat "$PIDFILE" 2>/dev/null)
|
||||
if [ -z "$PID" ]; then
|
||||
rm -f "$PIDFILE"
|
||||
return 0
|
||||
fi
|
||||
kill "$PID" 2>/dev/null
|
||||
sleep 1
|
||||
kill -9 "$PID" 2>/dev/null
|
||||
rm -f "$PIDFILE"
|
||||
echo "Stopped"
|
||||
return 0
|
||||
}
|
||||
|
||||
status() {
|
||||
if [ -f "$PIDFILE" ]; then
|
||||
PID=$(cat "$PIDFILE" 2>/dev/null)
|
||||
if [ -n "$PID" ] && kill -0 "$PID" 2>/dev/null; then
|
||||
echo "Running (pid $PID)"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
echo "Not running"
|
||||
return 3
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $?
|
||||
@@ -0,0 +1,90 @@
|
||||
#!/bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: jibo-skills-logpanel
|
||||
# Required-Start: $local_fs
|
||||
# Required-Stop: $local_fs
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: HTTP panel for live Jibo Skills logs
|
||||
### END INIT INFO
|
||||
|
||||
PYTHON_BIN=${PYTHON_BIN:-/usr/bin/python}
|
||||
DAEMON=${DAEMON:-/opt/jibo/Jibo/Skills/tools/robot/logpanel/jibo_logpanel.py}
|
||||
PIDFILE=${PIDFILE:-/tmp/jibo-skills-logpanel.pid}
|
||||
BIND=${JIBO_LOGPANEL_BIND:-0.0.0.0}
|
||||
PORT=${JIBO_LOGPANEL_PORT:-15150}
|
||||
LOGFILE=${JIBO_LOGD_FILE:-/tmp/jibo-skills.log}
|
||||
|
||||
start() {
|
||||
echo "Starting jibo-skills-logpanel"
|
||||
if [ -f "$PIDFILE" ]; then
|
||||
PID=$(cat "$PIDFILE" 2>/dev/null)
|
||||
if [ -n "$PID" ] && kill -0 "$PID" 2>/dev/null; then
|
||||
echo "Already running (pid $PID)"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
"$PYTHON_BIN" "$DAEMON" --bind "$BIND" --port "$PORT" --logfile "$LOGFILE" >/tmp/jibo-skills-logpanel.log 2>&1 &
|
||||
echo $! > "$PIDFILE"
|
||||
sleep 1
|
||||
if [ -f "$PIDFILE" ]; then
|
||||
echo "Started (pid $(cat "$PIDFILE" 2>/dev/null))"
|
||||
return 0
|
||||
fi
|
||||
echo "Failed to start"
|
||||
return 1
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo "Stopping jibo-skills-logpanel"
|
||||
if [ ! -f "$PIDFILE" ]; then
|
||||
echo "Not running (no pidfile)"
|
||||
return 0
|
||||
fi
|
||||
PID=$(cat "$PIDFILE" 2>/dev/null)
|
||||
if [ -z "$PID" ]; then
|
||||
rm -f "$PIDFILE"
|
||||
return 0
|
||||
fi
|
||||
kill "$PID" 2>/dev/null
|
||||
sleep 1
|
||||
kill -9 "$PID" 2>/dev/null
|
||||
rm -f "$PIDFILE"
|
||||
echo "Stopped"
|
||||
return 0
|
||||
}
|
||||
|
||||
status() {
|
||||
if [ -f "$PIDFILE" ]; then
|
||||
PID=$(cat "$PIDFILE" 2>/dev/null)
|
||||
if [ -n "$PID" ] && kill -0 "$PID" 2>/dev/null; then
|
||||
echo "Running (pid $PID)"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
echo "Not running"
|
||||
return 3
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
status)
|
||||
status
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|status}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $?
|
||||
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Configure the system for collecting core dumps
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
CORE_DUMP_DIR="/opt/coredumps"
|
||||
CORE_DUMP_FMT="$CORE_DUMP_DIR/%e.%p.core"
|
||||
CORE_PATTERN_LOC="/proc/sys/kernel/core_pattern"
|
||||
|
||||
start() {
|
||||
echo -n "Configuring core dumps: "
|
||||
test -d $CORE_DUMP_DIR || mkdir $CORE_DUMP_DIR
|
||||
rm -f $CORE_DUMP_DIR/*.core
|
||||
echo "$CORE_DUMP_FMT" > $CORE_PATTERN_LOC
|
||||
echo "Done."
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,26 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Enabling wireless..."
|
||||
if ! [ -d /sys/class/gpio/gpio191 ] ; then
|
||||
echo 191 > /sys/class/gpio/export
|
||||
echo out > /sys/class/gpio/gpio191/direction
|
||||
fi
|
||||
echo 0 > /sys/class/gpio/gpio191/value
|
||||
# Poll for WiFi interface instead of hardcoded sleep
|
||||
for i in $(seq 1 50); do
|
||||
if [ -d /sys/class/net/wlan0 ]; then
|
||||
break
|
||||
fi
|
||||
sleep 0.1
|
||||
done
|
||||
;;
|
||||
stop)
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Prime DNS Server Set."
|
||||
echo "nameserver 8.8.8.8" >> /run/resolv.conf
|
||||
echo "nameserver 8.8.4.4" >> /run/resolv.conf
|
||||
echo "# Primed DNS Set."
|
||||
;;
|
||||
stop)
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
/usr/sbin/crond -c /etc/crontabs
|
||||
;;
|
||||
stop)
|
||||
/usr/bin/killall crond
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# udev This is a minimal non-LSB version of a UDEV startup script. It
|
||||
# was derived by stripping down the udev-058 LSB version for use
|
||||
# with buildroot on embedded hardware using Linux 2.6.34+ kernels.
|
||||
#
|
||||
# You may need to customize this for your system's resource limits
|
||||
# (including startup time!) and administration. For example, if
|
||||
# your early userspace has a custom initramfs or initrd you might
|
||||
# need /dev much earlier; or without hotpluggable busses (like USB,
|
||||
# PCMCIA, MMC/SD, and so on) your /dev might be static after boot.
|
||||
#
|
||||
# This script assumes your system boots right into the eventual root
|
||||
# filesystem, and that init runs this udev script before any programs
|
||||
# needing more device nodes than the bare-bones set -- /dev/console,
|
||||
# /dev/zero, /dev/null -- that's needed to boot and run this script.
|
||||
#
|
||||
|
||||
# Check for missing binaries
|
||||
UDEV_BIN=/sbin/udevd
|
||||
test -x $UDEV_BIN || exit 5
|
||||
|
||||
# Check for config file and read it
|
||||
UDEV_CONFIG=/etc/udev/udev.conf
|
||||
test -r $UDEV_CONFIG || exit 6
|
||||
. $UDEV_CONFIG
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
printf "Populating ${udev_root:-/dev} using udev: "
|
||||
printf '\000\000\000\000' > /proc/sys/kernel/hotplug
|
||||
$UDEV_BIN -d || (echo "FAIL" && exit 1)
|
||||
udevadm trigger --type=subsystems --action=add
|
||||
udevadm trigger --type=devices --action=add
|
||||
udevadm settle --timeout=10 || echo "udevadm settle failed"
|
||||
echo "done"
|
||||
;;
|
||||
stop)
|
||||
# Stop execution of events
|
||||
udevadm control --stop-exec-queue
|
||||
killall udevd
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
# Set the cpu frequency governor and minimum and maximum frequencies
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "interactive" > \
|
||||
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
|
||||
echo "1938000" > \
|
||||
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
|
||||
echo "312000" > \
|
||||
/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
|
||||
;;
|
||||
stop)
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,51 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# urandom This script saves the random seed between reboots.
|
||||
# It is called from the boot, halt and reboot scripts.
|
||||
#
|
||||
# Version: @(#)urandom 1.33 22-Jun-1998 miquels@cistron.nl
|
||||
#
|
||||
|
||||
[ -c /dev/urandom ] || exit 0
|
||||
#. /etc/default/rcS
|
||||
|
||||
case "$1" in
|
||||
start|"")
|
||||
# check for read only file system
|
||||
if ! touch /etc/random-seed 2>/dev/null
|
||||
then
|
||||
echo "read-only file system detected...done"
|
||||
exit
|
||||
fi
|
||||
if [ "$VERBOSE" != no ]
|
||||
then
|
||||
printf "Initializing random number generator... "
|
||||
fi
|
||||
# Load and then save 512 bytes,
|
||||
# which is the size of the entropy pool
|
||||
cat /etc/random-seed >/dev/urandom
|
||||
rm -f /etc/random-seed
|
||||
umask 077
|
||||
dd if=/dev/urandom of=/etc/random-seed count=1 \
|
||||
>/dev/null 2>&1 || echo "urandom start: failed."
|
||||
umask 022
|
||||
[ "$VERBOSE" != no ] && echo "done."
|
||||
;;
|
||||
stop)
|
||||
if ! touch /etc/random-seed 2>/dev/null
|
||||
then
|
||||
exit
|
||||
fi
|
||||
# Carry a random seed from shut-down to start-up;
|
||||
# see documentation in linux/drivers/char/random.c
|
||||
[ "$VERBOSE" != no ] && printf "Saving random seed... "
|
||||
umask 077
|
||||
dd if=/dev/urandom of=/etc/random-seed count=1 \
|
||||
>/dev/null 2>&1 || echo "urandom stop: failed."
|
||||
[ "$VERBOSE" != no ] && echo "done."
|
||||
;;
|
||||
*)
|
||||
echo "Usage: urandom {start|stop}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,78 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# messagebus: The D-BUS systemwide message bus
|
||||
#
|
||||
# chkconfig: 345 97 03
|
||||
# description: This is a daemon which broadcasts notifications of system events \
|
||||
# and other messages. See http://www.freedesktop.org/software/dbus/
|
||||
#
|
||||
# processname: dbus-daemon
|
||||
# pidfile: /var/run/messagebus.pid
|
||||
#
|
||||
|
||||
# Sanity checks.
|
||||
[ -x /usr/bin/dbus-daemon ] || exit 0
|
||||
|
||||
# Create needed directories.
|
||||
[ -d /var/run/dbus ] || mkdir -p /var/run/dbus
|
||||
[ -d /var/lock/subsys ] || mkdir -p /var/lock/subsys
|
||||
[ -d /tmp/dbus ] || mkdir -p /tmp/dbus
|
||||
|
||||
RETVAL=0
|
||||
|
||||
start() {
|
||||
printf "Starting system message bus: "
|
||||
|
||||
dbus-uuidgen --ensure
|
||||
dbus-daemon --system
|
||||
RETVAL=$?
|
||||
echo "done"
|
||||
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dbus-daemon
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping system message bus: "
|
||||
|
||||
## we don't want to kill all the per-user $processname, we want
|
||||
## to use the pid file *only*; because we use the fake nonexistent
|
||||
## program name "$servicename" that should be safe-ish
|
||||
killall dbus-daemon
|
||||
RETVAL=$?
|
||||
echo "done"
|
||||
if [ $RETVAL -eq 0 ]; then
|
||||
rm -f /var/lock/subsys/dbus-daemon
|
||||
rm -f /var/run/messagebus.pid
|
||||
fi
|
||||
}
|
||||
|
||||
# See how we were called.
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
status)
|
||||
status $processname
|
||||
RETVAL=$?
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
condrestart)
|
||||
if [ -f /var/lock/subsys/$servicename ]; then
|
||||
stop
|
||||
start
|
||||
fi
|
||||
;;
|
||||
reload)
|
||||
echo "Message bus can't reload its configuration, you have to restart it"
|
||||
RETVAL=$?
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|status|restart|condrestart|reload}"
|
||||
;;
|
||||
esac
|
||||
exit $RETVAL
|
||||
@@ -0,0 +1,60 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# sshd Starts sshd.
|
||||
#
|
||||
|
||||
# Make sure the /usr/bin/ssh-keygen progam exists
|
||||
[ -f /usr/bin/ssh-keygen ] || exit 0
|
||||
|
||||
# Create any missing keys (skip if all keys exist)
|
||||
mkdir -p /var/etc/ssh
|
||||
if [ ! -f /var/etc/ssh/ssh_host_rsa_key ] || \
|
||||
[ ! -f /var/etc/ssh/ssh_host_dsa_key ] || \
|
||||
[ ! -f /var/etc/ssh/ssh_host_ecdsa_key ] || \
|
||||
[ ! -f /var/etc/ssh/ssh_host_ed25519_key ]; then
|
||||
[ -f /var/etc/ssh/ssh_host_rsa_key ] || \
|
||||
/usr/bin/ssh-keygen -N "" -t rsa -f /var/etc/ssh/ssh_host_rsa_key
|
||||
[ -f /var/etc/ssh/ssh_host_dsa_key ] || \
|
||||
/usr/bin/ssh-keygen -N "" -t dsa -f /var/etc/ssh/ssh_host_dsa_key
|
||||
[ -f /var/etc/ssh/ssh_host_ecdsa_key ] || \
|
||||
/usr/bin/ssh-keygen -N "" -t ecdsa -f /var/etc/ssh/ssh_host_ecdsa_key
|
||||
[ -f /var/etc/ssh/ssh_host_ed25519_key ] || \
|
||||
/usr/bin/ssh-keygen -N "" -t ed25519 -f /var/etc/ssh/ssh_host_ed25519_key
|
||||
fi
|
||||
|
||||
umask 077
|
||||
|
||||
start() {
|
||||
printf "Starting sshd: "
|
||||
/usr/sbin/sshd
|
||||
touch /var/lock/sshd
|
||||
echo "OK"
|
||||
}
|
||||
stop() {
|
||||
printf "Stopping sshd: "
|
||||
killall sshd
|
||||
rm -f /var/lock/sshd
|
||||
echo "OK"
|
||||
}
|
||||
restart() {
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart|reload)
|
||||
restart
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Enabling audio..."
|
||||
if ! [ -d /sys/class/gpio/gpio144 ] ; then
|
||||
echo 144 > /sys/class/gpio/export
|
||||
echo out > /sys/class/gpio/gpio144/direction
|
||||
fi
|
||||
echo 1 > /sys/class/gpio/gpio144/value
|
||||
;;
|
||||
stop)
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
case "$1" in
|
||||
start|"")
|
||||
if [ ! -d /tmp/avahi-autoipd ]; then
|
||||
rm -rf /tmp/avahi-autoipd
|
||||
mkdir /tmp/avahi-autoipd
|
||||
chown avahi.avahi /tmp/avahi-autoipd
|
||||
fi
|
||||
;;
|
||||
stop) ;;
|
||||
*)
|
||||
echo "Usage: S05avahi-setup.sh {start|stop}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Start the network....
|
||||
#
|
||||
|
||||
# Debian ifupdown needs the /run/network lock directory
|
||||
mkdir -p /run/network
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
echo "Starting network..."
|
||||
/sbin/ifup -a &
|
||||
;;
|
||||
stop)
|
||||
printf "Stopping network..."
|
||||
/sbin/ifdown -a
|
||||
;;
|
||||
restart|reload)
|
||||
"$0" stop
|
||||
"$0" start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# avahi-daemon init script
|
||||
|
||||
DAEMON=/usr/sbin/avahi-daemon
|
||||
case "$1" in
|
||||
start)
|
||||
$DAEMON -c || $DAEMON -D
|
||||
;;
|
||||
stop)
|
||||
$DAEMON -c && $DAEMON -k
|
||||
;;
|
||||
reload)
|
||||
$DAEMON -c && $DAEMON -r
|
||||
;;
|
||||
*)
|
||||
echo "Usage: S50avahi-daemon {start|stop|reload}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
;;
|
||||
stop)
|
||||
printf "Upload logs..."
|
||||
/usr/bin/jibo-log-client-async --credentials /var/jibo/credentials.json --file /var/log/messages
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
# This is a hack for now. FIXME.
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
# Touchscreen Drivers
|
||||
modprobe synaptics_dsx_rmi_dev
|
||||
# V4L2 camera drivers
|
||||
modprobe ov4689_v4l2
|
||||
modprobe tegra_camera
|
||||
# Raw SPI devices for IMU(s)
|
||||
modprobe spidev
|
||||
;;
|
||||
stop)
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
echo "done."
|
||||
case "$1" in
|
||||
start)
|
||||
# Set the audio mixer levels
|
||||
echo -n "Setting default ALSA mixer levels... "
|
||||
/bin/sh /root/InAudioSetup.sh > /dev/null
|
||||
/bin/sh /root/OutAudioSetup.sh > /dev/null
|
||||
;;
|
||||
stop)
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Starts alsa
|
||||
#
|
||||
|
||||
start() {
|
||||
printf "Starting alsa loopback: "
|
||||
modprobe snd-aloop
|
||||
modprobe snd-dummy
|
||||
/usr/local/bin/jibo-audio-pump-device p TTSOut MediaOut SDKOut
|
||||
/usr/local/bin/jibo-audio-pump-device c ASRIn MediaIn
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
stop() {
|
||||
printf "Stopping alsa loopback: "
|
||||
echo "OK"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit $?
|
||||
@@ -0,0 +1,56 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Initialize power to the Jibo body boards
|
||||
#
|
||||
|
||||
GPIO_PK1=81 # Body board recovery pin
|
||||
GPIO_PK2=82 # GPIO_PK2 Torso & pelvis power
|
||||
GPIO_PR4=140 # GPIO_PR4 Head power
|
||||
|
||||
export_gpios() {
|
||||
for gpio in $GPIO_PK1 $GPIO_PK2 $GPIO_PR4; do
|
||||
if [ ! -d /sys/class/gpio/gpio$gpio ]; then
|
||||
echo "$gpio" > /sys/class/gpio/export
|
||||
echo "out" > /sys/class/gpio/gpio$gpio/direction
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
power_on_boards() {
|
||||
echo "0" > /sys/class/gpio/gpio$GPIO_PK1/value
|
||||
echo "1" > /sys/class/gpio/gpio$GPIO_PK2/value
|
||||
echo "1" > /sys/class/gpio/gpio$GPIO_PR4/value
|
||||
}
|
||||
|
||||
power_off_boards() {
|
||||
echo "0" > /sys/class/gpio/gpio$GPIO_PK2/value
|
||||
echo "0" > /sys/class/gpio/gpio$GPIO_PR4/value
|
||||
}
|
||||
|
||||
start() {
|
||||
echo -n "Enabling body boards... "
|
||||
export_gpios
|
||||
power_on_boards
|
||||
echo "Done."
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n "Disabling body boards... "
|
||||
export_gpios
|
||||
power_off_boards
|
||||
echo "Done."
|
||||
}
|
||||
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,38 @@
|
||||
#! /bin/sh
|
||||
|
||||
NAME=ntpd
|
||||
DAEMON=/usr/sbin/$NAME
|
||||
|
||||
# Gracefully exit if the package has been removed.
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
# Read config file if it is present.
|
||||
if [ -r /etc/default/$NAME ]
|
||||
then
|
||||
. /etc/default/$NAME
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
printf "Starting $NAME: "
|
||||
start-stop-daemon -S -q -x $DAEMON -- -g
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
;;
|
||||
stop)
|
||||
printf "Stopping $NAME: "
|
||||
start-stop-daemon -K -q -R TERM/3/KILL/3 -n $NAME
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
;;
|
||||
restart|reload)
|
||||
echo "Restarting $NAME: "
|
||||
$0 stop
|
||||
sleep 1
|
||||
$0 start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,65 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
check_mode() {
|
||||
my_mode=$(/usr/bin/jibo-getmode)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Unspecified mode. SKIP"
|
||||
exit 0;
|
||||
fi
|
||||
if [ "$my_mode" != "oobe" \
|
||||
-a "$my_mode" != "int-developer" \
|
||||
-a "$my_mode" != "developer" \
|
||||
-a "$my_mode" != "normal" \
|
||||
-a "$my_mode" != "ota" \
|
||||
-a "$my_mode" != "service" ]; then
|
||||
echo "Mode is $my_mode. SKIP"
|
||||
exit 0;
|
||||
fi
|
||||
}
|
||||
|
||||
check_x() {
|
||||
pgrep -x X
|
||||
return $?
|
||||
}
|
||||
|
||||
wait_for_x() {
|
||||
while ! check_x; do
|
||||
echo -n "waiting... "
|
||||
sleep 0.25
|
||||
done
|
||||
}
|
||||
|
||||
start() {
|
||||
echo -n "Starting X11: "
|
||||
check_mode
|
||||
/usr/bin/startx &
|
||||
wait_for_x
|
||||
test $? -eq 0 && echo "OK" || echo "ERROR"
|
||||
# change mode to allow non-root skill to have
|
||||
# read access for X11 connections
|
||||
chmod 644 /tmp/.Xauthority
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n "Stopping X11: "
|
||||
killall xinit
|
||||
test $? -eq 0 && echo "OK" || echo "ERROR"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Jibo OTA update init script
|
||||
#
|
||||
|
||||
PROCESS=jibo-apply-update
|
||||
BIN_DIR=/usr/bin
|
||||
CFG_DIR=/var/jibo
|
||||
|
||||
check_mode() {
|
||||
my_mode=$(/usr/bin/jibo-getmode)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Unspecified mode. SKIP"
|
||||
exit 0;
|
||||
fi
|
||||
if [ "$my_mode" != "ota" -a ! -f /var/jibo/ota.json ]; then
|
||||
echo "Mode is $my_mode. SKIP"
|
||||
exit 0;
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
echo -n "Starting $PROCESS: "
|
||||
check_mode
|
||||
DISPLAY=:0 XAUTHORITY=/tmp/.Xauthority $BIN_DIR/$PROCESS --continue
|
||||
test $? -eq 0 && echo "OK" || echo "ERROR"
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n "Stopping $PROCESS: "
|
||||
killall $PROCESS
|
||||
test $? -eq 0 && echo "OK" || echo "ERROR"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,57 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Jibo Service Registry init script
|
||||
#
|
||||
|
||||
PROCESS=jibo-service-registry
|
||||
BIN_DIR=/usr/local/bin
|
||||
CFG_DIR=/usr/local/etc
|
||||
|
||||
check_mode() {
|
||||
my_mode=$(/usr/bin/jibo-getmode)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Unspecified mode. SKIP"
|
||||
exit 0;
|
||||
fi
|
||||
if [ "$my_mode" != "oobe" \
|
||||
-a "$my_mode" != "int-developer" \
|
||||
-a "$my_mode" != "developer" \
|
||||
-a "$my_mode" != "normal" \
|
||||
-a "$my_mode" != "certification" \
|
||||
-a "$my_mode" != "service" ]; then
|
||||
echo "Mode is $my_mode. SKIP"
|
||||
exit 0;
|
||||
fi
|
||||
}
|
||||
|
||||
start() {
|
||||
echo -n "Starting $PROCESS: "
|
||||
check_mode
|
||||
# set ulimit so we can get core dumps
|
||||
ulimit -c unlimited
|
||||
$BIN_DIR/$PROCESS -c $CFG_DIR/$PROCESS.json --daemon
|
||||
test $? -eq 0 && echo "OK" || echo "ERROR"
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n "Stopping $PROCESS: "
|
||||
killall $PROCESS
|
||||
test $? -eq 0 && echo "OK" || echo "ERROR"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
restart)
|
||||
stop
|
||||
start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,73 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Jibo System Manager init script
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
PROCESS=jibo-system-manager
|
||||
BIN_DIR=/usr/local/bin
|
||||
CFG_DIR=/usr/local/etc
|
||||
|
||||
check_mode() {
|
||||
my_mode=$(/usr/bin/jibo-getmode)
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Unspecified mode. SKIP"
|
||||
exit 0;
|
||||
fi
|
||||
if [ "$my_mode" != "oobe" \
|
||||
-a "$my_mode" != "int-developer" \
|
||||
-a "$my_mode" != "developer" \
|
||||
-a "$my_mode" != "normal" \
|
||||
-a "$my_mode" != "certification" \
|
||||
-a "$my_mode" != "service" ]; then
|
||||
echo "Mode is $my_mode. SKIP"
|
||||
exit 0;
|
||||
fi
|
||||
# only configure coredump generation for internal development modes
|
||||
# for all other modes, don't configure as they cannot be used
|
||||
if [ "$my_mode" == "int-developer" ]; then
|
||||
echo "Configuring coredumps"
|
||||
# all subprocesses should generate core dumps
|
||||
ulimit -c unlimited
|
||||
fi
|
||||
}
|
||||
|
||||
check_running() {
|
||||
pgrep -x jibo-system-man >& /dev/null
|
||||
return $?
|
||||
}
|
||||
|
||||
wait_for_stopped() {
|
||||
while check_running; do
|
||||
echo -n "waiting... "
|
||||
sleep 2
|
||||
done
|
||||
}
|
||||
|
||||
start() {
|
||||
echo -n "Starting $PROCESS: "
|
||||
check_mode
|
||||
$BIN_DIR/$PROCESS -c $CFG_DIR/$PROCESS.json --daemon
|
||||
test $? -eq 0 && echo "OK" || echo "ERROR"
|
||||
}
|
||||
|
||||
stop() {
|
||||
echo -n "Stopping $PROCESS: "
|
||||
killall $PROCESS
|
||||
wait_for_stopped
|
||||
test $? -eq 0 && echo "OK" || echo "ERROR"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
start
|
||||
;;
|
||||
stop)
|
||||
stop
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
|
||||
CONFIG=/etc/bind/named.conf
|
||||
DAEMON=/usr/sbin/named
|
||||
|
||||
[ -x $DAEMON ] || exit 0
|
||||
[ -f $CONFIG ] || exit 0
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if [ ! -f /etc/rndc.key ]; then
|
||||
printf "Initializing bind control key: "
|
||||
# if rndc.key is a symlink, the target must exist
|
||||
touch /etc/rndc.key
|
||||
rndc-confgen -a -r /dev/urandom 2>/dev/null && echo "OK" || echo "FAIL"
|
||||
fi
|
||||
printf "Starting domain name daemon: "
|
||||
start-stop-daemon -S -x $DAEMON -- -c $CONFIG -u named
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
;;
|
||||
stop)
|
||||
printf "Stopping domain name daemon: "
|
||||
rndc stop || start-stop-daemon -K -x $DAEMON
|
||||
[ $? = 0 ] && echo "OK" || echo "FAIL"
|
||||
;;
|
||||
restart)
|
||||
$0 stop || true
|
||||
sleep 1
|
||||
$0 start
|
||||
;;
|
||||
reload|force-reload)
|
||||
rndc reload || $0 restart
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|reload|force-reload}"
|
||||
exit 1
|
||||
esac
|
||||
|
||||
exit 0
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Post identity to syslog, build version dependent
|
||||
# Author: Russell Kirmayer
|
||||
# Jibo Inc.
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if [ -e /usr/bin/jibo-postidentity ]; then
|
||||
jibo-postidentity
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,27 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
# Stop all init scripts in /etc/init.d
|
||||
# executing them in reversed numerical order.
|
||||
#
|
||||
for i in $(ls -r /etc/init.d/S??*) ;do
|
||||
|
||||
# Ignore dangling symlinks (if any).
|
||||
[ ! -f "$i" ] && continue
|
||||
|
||||
case "$i" in
|
||||
*.sh)
|
||||
# Source shell script for speed.
|
||||
(
|
||||
trap - INT QUIT TSTP
|
||||
set stop
|
||||
. $i
|
||||
)
|
||||
;;
|
||||
*)
|
||||
# No sh extension, so fork subprocess.
|
||||
$i stop
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Start all init scripts in /etc/init.d
|
||||
# executing them in numerical order with parallelization where safe.
|
||||
|
||||
# Services that must run sequentially (have dependencies)
|
||||
SEQUENTIAL="S00fix-os S09wifi-enable S18udev S45network S48avahi-daemon S63body-board-power S54modules"
|
||||
|
||||
# Track background processes
|
||||
PIDS=""
|
||||
|
||||
# Function to wait for background processes
|
||||
wait_for_background() {
|
||||
for pid in $PIDS; do
|
||||
wait $pid 2>/dev/null
|
||||
done
|
||||
PIDS=""
|
||||
}
|
||||
|
||||
for i in /etc/init.d/S??* ;do
|
||||
# Ignore dangling symlinks (if any).
|
||||
[ ! -f "$i" ] && continue
|
||||
|
||||
# Extract script name for dependency checking
|
||||
SCRIPT_NAME=$(basename "$i")
|
||||
|
||||
# Check if this script must run sequentially
|
||||
SEQUENTIAL_RUN=0
|
||||
for seq in $SEQUENTIAL; do
|
||||
if [ "$SCRIPT_NAME" = "$seq" ]; then
|
||||
SEQUENTIAL_RUN=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Wait for background processes before running sequential scripts
|
||||
if [ "$SEQUENTIAL_RUN" = "1" ]; then
|
||||
wait_for_background
|
||||
fi
|
||||
|
||||
case "$i" in
|
||||
*.sh)
|
||||
# Source shell script for speed.
|
||||
(
|
||||
trap - INT QUIT TSTP
|
||||
set start
|
||||
. $i
|
||||
)
|
||||
;;
|
||||
*)
|
||||
# No sh extension, so fork subprocess.
|
||||
if [ "$SEQUENTIAL_RUN" = "1" ]; then
|
||||
# Run sequentially
|
||||
$i start
|
||||
else
|
||||
# Run in background
|
||||
$i start &
|
||||
PIDS="$PIDS $!"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Wait for any remaining background processes
|
||||
wait_for_background
|
||||
|
||||
Reference in New Issue
Block a user