diff options
Diffstat (limited to 'addons/x11infoscreen/etc/init.d')
-rwxr-xr-x | addons/x11infoscreen/etc/init.d/flashybrid | 128 | ||||
-rw-r--r-- | addons/x11infoscreen/etc/init.d/flashybrid.diff | 12 | ||||
-rwxr-xr-x | addons/x11infoscreen/etc/init.d/flashybrid.orig | 125 | ||||
-rwxr-xr-x | addons/x11infoscreen/etc/init.d/local-infoscreen | 106 |
4 files changed, 371 insertions, 0 deletions
diff --git a/addons/x11infoscreen/etc/init.d/flashybrid b/addons/x11infoscreen/etc/init.d/flashybrid new file mode 100755 index 0000000..5ab4037 --- /dev/null +++ b/addons/x11infoscreen/etc/init.d/flashybrid @@ -0,0 +1,128 @@ +#!/bin/sh +# Set up/shutdown the flashybrid system, including the ramdisk and partial +# directory bind mounts. This needs to run at the part of system bootup that +# mounts all the disks. It should also run at shutdown right before +# filesystems are unmounted. + +CONFDIR=/etc/flashybrid +if [ -e $CONFDIR/config ]; then + . $CONFDIR/config +fi + +ENABLED=no +if [ -e /etc/default/flashybrid ]; then + . /etc/default/flashybrid +fi + +if [ -z "$RAMMOUNT" ]; then + exit 0 +fi + +is_mounted () { + grep -q " $1 " /proc/mounts +} + +case "$1" in +start) + if [ "$ENABLED" != yes ]; then + echo "Not setting up flashybrid system: disabled." + exit + fi + + printf "Setting up flashybrid system..." + + # Set up partial directories and so on, make sure disk is + # unmounted. + fh-embed >/dev/null + + # Set up ram disk to hold variable data. + if ! is_mounted $RAMMOUNT; then + mount tmpfs -t tmpfs $RAMMOUNT + fi + + # Temporary directories on ram disk. + for dir in $(grep -v '^#' $CONFDIR/ramtmp); do + mkdir -p -m 1777 $RAMMOUNT/$dir + if is_mounted $dir; then + umount $dir + fi + mount --bind $RAMMOUNT/$dir $dir + done + + # Copy data from flash to ram disk for these directories. + for dir in $(grep -v '^#' $CONFDIR/ramstore); do + # Skip dirs that are not present. + if [ -d $dir ]; then + ramdir=$RAMMOUNT$dir + if is_mounted $dir; then + umount $dir + fi + if is_mounted $ramdir.flash; then + umount $ramdir.flash + fi + if [ ! -d $ramdir ]; then + mkdir -p ${ramdir%/*} # dirname + cp -a $dir $ramdir + fi + mkdir -p $ramdir.flash + mount --bind $dir $ramdir.flash + mount --bind $ramdir $dir + fi + done + + # Make sure virtual filesystems are properly mounted + invoke-rc.d mountvirtfs start || /bin/true + + echo "done." +;; +stop) + if [ "$ENABLED" != yes ]; then + echo "Not shutting down flashybrid system: disabled." + exit + fi + + printf "Shutting down flashybrid system..." + + # Copy data to flash. + # Remount the flash read-write so the copies to it will work. + mount -o remount,rw / + for dir in $(grep -v '^#' $CONFDIR/ramstore); do + if [ -d $RAMMOUNT/$dir ] && [ -d $RAMMOUNT/$dir.flash ]; then + # rsync is used to avoid churning the flash + # unnecessarily. The trailing slashes are very + # important.. + rsync --delete -a $RAMMOUNT/$dir/ $RAMMOUNT/$dir.flash/ + fi + done + + for dir in $(grep -v '^#' $CONFDIR/ramtmp); do + if is_mounted $dir; then + umount $dir + fi + done + + for dir in $(grep -v '^#' $CONFDIR/ramstore); do + ramdir=$RAMMOUNT$dir + if is_mounted $ramdir.flash; then + umount $ramdir.flash + fi + if is_mounted $dir; then + umount $dir + fi + done + + if is_mounted $RAMMOUNT; then + umount $RAMMOUNT + fi + + echo "done." +;; +restart|force-reload) + $0 stop + $0 start +;; +*) + echo "Usage: $0 {start|stop|restart|force-reload}" + exit 1 +;; +esac diff --git a/addons/x11infoscreen/etc/init.d/flashybrid.diff b/addons/x11infoscreen/etc/init.d/flashybrid.diff new file mode 100644 index 0000000..34c0fda --- /dev/null +++ b/addons/x11infoscreen/etc/init.d/flashybrid.diff @@ -0,0 +1,12 @@ +--- flashybrid.orig 2003-11-25 21:26:14.000000000 +0000 ++++ flashybrid 2004-11-17 02:05:22.000000000 +0000 +@@ -70,6 +70,9 @@ + fi + done + ++ # Make sure virtual filesystems are properly mounted ++ invoke-rc.d mountvirtfs start || /bin/true ++ + echo "done." + ;; + stop) diff --git a/addons/x11infoscreen/etc/init.d/flashybrid.orig b/addons/x11infoscreen/etc/init.d/flashybrid.orig new file mode 100755 index 0000000..9ea31d7 --- /dev/null +++ b/addons/x11infoscreen/etc/init.d/flashybrid.orig @@ -0,0 +1,125 @@ +#!/bin/sh +# Set up/shutdown the flashybrid system, including the ramdisk and partial +# directory bind mounts. This needs to run at the part of system bootup that +# mounts all the disks. It should also run at shutdown right before +# filesystems are unmounted. + +CONFDIR=/etc/flashybrid +if [ -e $CONFDIR/config ]; then + . $CONFDIR/config +fi + +ENABLED=no +if [ -e /etc/default/flashybrid ]; then + . /etc/default/flashybrid +fi + +if [ -z "$RAMMOUNT" ]; then + exit 0 +fi + +is_mounted () { + grep -q " $1 " /proc/mounts +} + +case "$1" in +start) + if [ "$ENABLED" != yes ]; then + echo "Not setting up flashybrid system: disabled." + exit + fi + + printf "Setting up flashybrid system..." + + # Set up partial directories and so on, make sure disk is + # unmounted. + fh-embed >/dev/null + + # Set up ram disk to hold variable data. + if ! is_mounted $RAMMOUNT; then + mount tmpfs -t tmpfs $RAMMOUNT + fi + + # Temporary directories on ram disk. + for dir in $(grep -v '^#' $CONFDIR/ramtmp); do + mkdir -p -m 1777 $RAMMOUNT/$dir + if is_mounted $dir; then + umount $dir + fi + mount --bind $RAMMOUNT/$dir $dir + done + + # Copy data from flash to ram disk for these directories. + for dir in $(grep -v '^#' $CONFDIR/ramstore); do + # Skip dirs that are not present. + if [ -d $dir ]; then + ramdir=$RAMMOUNT$dir + if is_mounted $dir; then + umount $dir + fi + if is_mounted $ramdir.flash; then + umount $ramdir.flash + fi + if [ ! -d $ramdir ]; then + mkdir -p ${ramdir%/*} # dirname + cp -a $dir $ramdir + fi + mkdir -p $ramdir.flash + mount --bind $dir $ramdir.flash + mount --bind $ramdir $dir + fi + done + + echo "done." +;; +stop) + if [ "$ENABLED" != yes ]; then + echo "Not shutting down flashybrid system: disabled." + exit + fi + + printf "Shutting down flashybrid system..." + + # Copy data to flash. + # Remount the flash read-write so the copies to it will work. + mount -o remount,rw / + for dir in $(grep -v '^#' $CONFDIR/ramstore); do + if [ -d $RAMMOUNT/$dir ] && [ -d $RAMMOUNT/$dir.flash ]; then + # rsync is used to avoid churning the flash + # unnecessarily. The trailing slashes are very + # important.. + rsync --delete -a $RAMMOUNT/$dir/ $RAMMOUNT/$dir.flash/ + fi + done + + for dir in $(grep -v '^#' $CONFDIR/ramtmp); do + if is_mounted $dir; then + umount $dir + fi + done + + for dir in $(grep -v '^#' $CONFDIR/ramstore); do + ramdir=$RAMMOUNT$dir + if is_mounted $ramdir.flash; then + umount $ramdir.flash + fi + if is_mounted $dir; then + umount $dir + fi + done + + if is_mounted $RAMMOUNT; then + umount $RAMMOUNT + fi + + echo "done." +;; +restart|force-reload) + $0 stop + $0 start +;; +*) + echo "Usage: $0 {start|stop|restart|force-reload}" + exit 1 +;; +esac diff --git a/addons/x11infoscreen/etc/init.d/local-infoscreen b/addons/x11infoscreen/etc/init.d/local-infoscreen new file mode 100755 index 0000000..c9ef034 --- /dev/null +++ b/addons/x11infoscreen/etc/init.d/local-infoscreen @@ -0,0 +1,106 @@ +#! /bin/sh +# +# local-infoscreen +# +# Author: Jonas Smedegaard <dr@jones.dk> +# + +set -e + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +DESC="infoscreen daemons" +NAME=infoscreen +DAEMON=/usr/sbin/$NAME +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$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 + +# +# Function that starts the daemon/service. +# +d_start() { +# start-stop-daemon --start --quiet --pidfile $PIDFILE \ +# --exec $DAEMON + killall XFree86 -wq || /bin/true + /usr/local/bin/launch-x11 + /usr/local/bin/launch-sync + sleep 5 + /usr/local/bin/launch-unclutter +# /usr/local/bin/launch-feh + /usr/local/bin/launch-qiv +} + +# +# Function that stops the daemon/service. +# +d_stop() { +# start-stop-daemon --stop --quiet --pidfile $PIDFILE \ +# --name $NAME + /usr/local/bin/launch-qiv -k || /bin/true +# /usr/local/bin/launch-feh -k || /bin/true + /usr/local/bin/launch-unclutter -k || /bin/true + /usr/local/bin/launch-sync -k || /bin/true + /usr/local/bin/launch-x11 -k || /bin/true + killall XFree86 -wq || /bin/true +} + +# +# Function that sends a SIGHUP to the daemon/service. +# +d_reload() { + start-stop-daemon --stop --quiet --pidfile $PIDFILE \ + --name $NAME --signal 1 +} + +case "$1" in + start) + echo -n "Starting $DESC: $NAME" + d_start + echo "." + ;; + stop) + echo -n "Stopping $DESC: $NAME" + d_stop + echo "." + ;; + #reload) + # + # If the daemon can reload its configuration without + # restarting (for example, when it is sent a SIGHUP), + # then implement that here. + # + # If the daemon responds to changes in its config file + # directly anyway, make this an "exit 0". + # + # echo -n "Reloading $DESC configuration..." + # d_reload + # echo "done." + #;; + restart|force-reload) + # + # If the "reload" option is implemented, move the "force-reload" + # option to the "reload" entry above. If not, "force-reload" is + # just the same as "restart". + # + echo -n "Restarting $DESC: $NAME" + d_stop + sleep 1 + d_start + echo "." + ;; + *) + # echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 |