Differences between current version and predecessor to the previous major change of OpenSlug.

Other diffs: Previous Revision, Previous Author

Newer page: version 6 Last edited on Friday, 18 January 2008 21:42:13 by CyberLeo
Older page: version 5 Last edited on Friday, 18 January 2008 20:32:03 by CyberLeo Revert
@@ -96,23 +96,53 @@
 pkey=/root/.ssh/id_rsa 
 command=lcdproc 
  
 checkpid() { 
- /bin/ps | /usr/bin/cut -c1-6 | /bin/grep -v grep | /bin/grep -c "${*}" > /dev/null 
+ if [ -z "${1}" ]  
+ then  
+ false  
+ else  
+ /bin/ps | /usr/bin/cut -c1-6 | /bin/grep -v grep | /bin/grep -c "${*}" > /dev/null  
+ fi  
+}  
+checkup() {  
+ /usr/bin/nc localhost 13022 </dev/null >/dev/null 2>&1  
 
  
 ssh_cmd=/usr/bin/ssh 
-ssh_arg="-C -g -R 13022:127.0.0.1:22 -R 13666:127.0.0.1:13666 -l ${user} -i ${pkey} -p ${port} ${host} ${command}" 
+ssh_arg="-C -g -L 13022:127.0.0.1:13022 -R 13022:127.0.0.1:22 -R 13666:127.0.0.1:13666 -l ${user} -i ${pkey} -p ${port} ${host} ${command}" 
  
-trap '[ -n "${pids}" ] && checkpid "${pids }" && /bin/kill -TERM ${pids }; exit 0 ' 0 SIGHUP SIGINT SIGTERM SIGQUIT 
+trap 'checkpid "${ssh_pid }" && /bin/kill -TERM ${ssh_pid }; /sbin/leds disk-1 off ; exit 0' 0 SIGHUP SIGINT SIGTERM SIGQUIT 
  
 while true; 
 do 
- ${ssh_cmd} ${ssh_arg} &  
- pids =$!  
- wait ${pids }  
- sleep 1  
+ if ! checkpid "${ssh_pid}"  
+ then  
+ /sbin/leds disk-1 flash  
+ ${ssh_cmd} ${ssh_arg} &  
+ ssh_pid=$!  
+ /sbin/leds disk-1 blink  
+ count=0  
+ while ! checkup && [ "${count}" -lt 10 ]  
+ do  
+ sleep 1  
+ count=$(( ${count} + 1 ))  
+ done  
+ fi  
+ if checkup  
+ then  
+ /sbin/leds disk-1 on  
+ sleep 10 &  
+ sleep_pid =$!  
+ else  
+ /sbin/leds disk-1 flash  
+ checkpid " ${ssh_pid}" && kill -TERM ${ssh_pid }  
+ sleep 5  
+ fi  
+ wait ${ssh_pid} ${ sleep_pid}  
 done 
+  
+  
 </verbatim> 
  
 The debian init script: 
 <verbatim> 

current version

Wesha pages, "http://www.nslu2-linux.org/wiki/Main/HomePage" to you.
Wesha pages, "This is the $75 box I've got from amazon that should be able to do the job." to you.
Wesha pages, "However the manuf. firmware sucks and blows, so have to use one of these I guess." to you.
Wesha pages, "Here's the base set of requirements I need; upon that, see what would work best (I think OpenSlug, but maybe you'd find otherwise). Also, create our wiki page on that. (And might create one on opennas thing too, though I scrape opennas on nimble idea till they fix VIA problem, hopefully in 6.3)" to you.
Wesha pages, "1) Should andle 3 drives (through the hub)" to you.
Wesha pages, "2) either NTFS, ext2/3, or UFS (prefferd but not obligatory) support (in other words > 4G files)." to you.
Wesha pages, "3) samba and (preferably but optionally) NFS support;" to you.
Wesha pages, "4) should support russian filenames (I assume that's automatic with all of the FSes above)" to you.
You page, "To my knowledge, all three store unicode." to Wesha.
Wesha pages, "I think that's about it. At least at this point I'm not aware of anything else that I'd want from it." to you.
Wesha pages, "Other capabilites a plus, but that's what I need it for, really." to you.
Wesha pages, "Also might want to research the webcam option, could buy another one to handle webcams." to you.
Wesha pages, "http://www.nslu2-linux.org/wiki/HowTo/AddUsbWebcam" to you.

SlugOS/BE Local LCD display with piping
On fresh slug:

A few conveniences:

echo "#!/bin/sh\nexec /bin/ls -la --color=auto ${@}" > /bin/ll && chmod 755 /bin/ll
echo "#!/bin/sh\nexec /bin/ps ${@}" > /bin/pp && chmod 755 /bin/pp

Install LCD stuff

ipkg update
ipkg install kernel-module-ftdi-sio
ipkg install lcdd
ipkg install lcdd-driver-mtxorb

Patch the config

patch -Ni <<EOF
--- /etc/LCDd.conf-orig 2008-01-18 20:06:01.000000000 +0000
+++ /etc/LCDd.conf      2008-01-18 20:07:07.000000000 +0000
@@ -41,7 +41,7 @@
 #   joy, lb216,lcdm001, lcterm, lirc,MD8800, ms6931, mtc_s16209x,
 #   MtxOrb, NoritakeVFD, pyramid, sed1330, sed1520, serialVFD,
 #   sli, stv5730, svga, t6963, text, tyan, ula200, xosd
-Driver=curses
+Driver=MtxOrb

 # Tells the driver to bind to the given interface
 Bind=127.0.0.1
@@ -65,7 +65,7 @@
 # If yes, the the serverscreen will be rotated as a usual info screen. If no,
 # it will be a background screen, only visible when no other screens are
 # active.
-#ServerScreen=no
+ServerScreen=no

 # The server will stay in the foreground if set to true.
 #Foreground=no
@@ -76,7 +76,7 @@
 #            the driver modules and will thus not be able to
 #            function properly.
 # NOTE: Always place a slash as last character !
-DriverPath=server/drivers/
+DriverPath=/usr/lib/lcdproc/

 # The "...Key=" lines define what the server does with keypresses that
 # don't go to any client.
@@ -622,10 +622,10 @@
 [MtxOrb]

 # Select the output device to use [default: /dev/lcd]
-Device=/dev/ttyS0
+Device=/dev/ttyUSB0

 # Set the display size [default: 20x4]
-Size=20x4
+Size=20x2

 # Switch on the backlight? [default: yes]
 # NOTE: The driver will ignore this if the display is a vfd or vkd
@@ -635,7 +635,7 @@
 # Set the initial contrast [default: 480]
 # NOTE: The driver will ignore this if the display
 #       is a vfd or vkd as they don't have this feature
-Contrast=800
+Contrast=400

 # Set the communication speed [default: 19200; legal: 1200, 2400, 9600, 19200]
 Speed=19200
EOF

A script to call home and start a command, piping lcdd from remote to local

#!/bin/sh

host=arba.cyberleo.net
port=22
user=cyberleo
pkey=/root/.ssh/id_rsa
command=lcdproc

checkpid() {
  if [ -z "${1}" ]
  then
    false
  else
    /bin/ps | /usr/bin/cut -c1-6 | /bin/grep -v grep | /bin/grep -c "${*}" > /dev/null
  fi
}
checkup() {
  /usr/bin/nc localhost 13022 </dev/null >/dev/null 2>&1
}

ssh_cmd=/usr/bin/ssh
ssh_arg="-C -g -L 13022:127.0.0.1:13022 -R 13022:127.0.0.1:22 -R 13666:127.0.0.1:13666 -l ${user} -i ${pkey} -p ${port} ${host} ${command}"

trap 'checkpid "${ssh_pid}" && /bin/kill -TERM ${ssh_pid}; /sbin/leds disk-1 off; exit 0' 0 SIGHUP SIGINT SIGTERM SIGQUIT

while true;
do
  if ! checkpid "${ssh_pid}"
  then
    /sbin/leds disk-1 flash
    ${ssh_cmd} ${ssh_arg} &
    ssh_pid=$!
    /sbin/leds disk-1 blink
    count=0
    while ! checkup && [ "${count}" -lt 10 ]
    do
      sleep 1
      count=$(( ${count} + 1 ))
    done
  fi
  if checkup
  then
    /sbin/leds disk-1 on
    sleep 10 &
    sleep_pid=$!
  else
    /sbin/leds disk-1 flash
    checkpid "${ssh_pid}" && kill -TERM ${ssh_pid}
    sleep 5
  fi
  wait ${ssh_pid} ${sleep_pid}
done

The debian init script:

#!/bin/sh -e

#### BEGIN INIT INFO
# Provides:          callhome
# Required-Start:    $syslog $local_fs $network $remote_fs LCDd
# Required-Stop:     $syslog $local_fs $network $remote_fs LCDd
# Default-Start:     2 3 4 5
# Default-Stop:      S 0 1 6
# Short-Description: callhome client
# Description:       Debian init script for the callhome script
### END INIT INFO

prefix=/root
exec_prefix=/root
bindir=/root/bin
sbindir=/root/sbin
etc=/etc

NAME=callhome
DAEMON=${bindir}/${NAME}
DESC="${NAME} 0.0.1"

OPTIONS=""


test -x ${DAEMON} || exit 0

case "$1" in
    start)
        printf "Starting ${DESC}: "
        start-stop-daemon --start --quiet --background --make-pidfile --pidfile /var/run/callhome.pid --exec ${DAEMON} -- ${OPTIONS}
        printf "${NAME}."
        ;;
    stop)
        printf "Stopping ${DESC}: "
        start-stop-daemon --stop  --quiet --pidfile /var/run/callhome.pid --name ${NAME}
        printf "${NAME}."
        ;;
    restart|force-restart)
        $0 stop
        sleep 4
        $0 start
        ;;
    *)
        printf "Usage: $0 {start|stop|restart|force-restart}\n" >&2
        exit 1
        ;;
esac

exit 0