Skip to content

Commit

Permalink
pupmode 13 timer is now a service
Browse files Browse the repository at this point in the history
- works in cli and gui modes
- rename pm13trayicon to pm13 and add more functions
- eventmanager configures the service (RAMSAVEINTERVAL)
- in cli mode it only a shows a very helpful msg
  will probably add ncurses dialog
- remove relevant code from pup_event_frontend_d
  • Loading branch information
wdlkmpx committed Jul 13, 2019
1 parent 78e887c commit 8358e77
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 66 deletions.
24 changes: 24 additions & 0 deletions woof-code/rootfs-skeleton/etc/init.d/pupmode13
@@ -0,0 +1,24 @@
#!/bin/sh
# daemon for PUPMODE 13

. /etc/rc.d/PUPSTATE
if [ "$PUPMODE" != "13" ] ; then
exit
fi

case $1 in
start)
if ! pidof pm13 ; then
pm13 service &
fi
;;
restart)
killall pm13 2>/dev/null
pm13 service &
;;
stop)
killall pm13 2>/dev/null
;;
esac

### END ###
6 changes: 4 additions & 2 deletions woof-code/rootfs-skeleton/root/.profile
Expand Up @@ -17,9 +17,11 @@ if which Xorg >/dev/null 2>&1 ; then
touch /tmp/bootcnt.txt
dmesg > /tmp/bootkernel.log
xwin
else
/usr/sbin/pm13 cli
fi
else
/usr/sbin/pm13 cli
fi

/usr/sbin/pm13trayicon cli

### END ###
4 changes: 2 additions & 2 deletions woof-code/rootfs-skeleton/root/Startup/pm13trayicon
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/ash

exec pm13trayicon "$@"
exec pm13 trayicon "$@"

22 changes: 0 additions & 22 deletions woof-code/rootfs-skeleton/usr/local/pup_event/pup_event_frontend_d
Expand Up @@ -3,19 +3,7 @@

#exec &>/tmp/${0##*/}.log ; set -x #debug

if ! /usr/local/pup_event/frontend_startup $@ ; then
exit 1
fi

rm -f /tmp/services/pup_event_timeout

. /etc/eventmanager #has RAMSAVEINTERVAL, HOTPLUGNOISY, BACKENDON, POWERTIMEOUT
. /etc/rc.d/PUPSTATE

#===============================================

MINUTE=0;
SAVECNT=0
MOUSECNT=0
CURPOS1=""
CURPOS2=""
Expand All @@ -27,18 +15,8 @@ do
MINUTE=$((MINUTE+1))

. /etc/eventmanager
[ "$RAMSAVEINTERVAL" = "" ] && RAMSAVEINTERVAL=60
[ "$POWERTIMEOUT" = "" ] && POWERTIMEOUT=0

if [ "$PUPMODE" = "13" ] ; then
SAVECNT=$(( $SAVECNT + 1 ))
if [ $RAMSAVEINTERVAL -ne 0 -a $SAVECNT -ge $RAMSAVEINTERVAL ];then
if save2flash pup_event ; then #periodic save of tmpfs top layer...
SAVECNT=0
fi
fi
fi

if [ $POWERTIMEOUT -ne 0 ];then #power-off computer after inactivity.
MOUSECNT=$(( $MOUSECNT + 1 ))
CURPOS2="`getcurpos`"
Expand Down

This file was deleted.

8 changes: 6 additions & 2 deletions woof-code/rootfs-skeleton/usr/sbin/eventmanager
Expand Up @@ -11,7 +11,7 @@

[ "`whoami`" != "root" ] && exec sudo -A ${0} ${@} #110505

[ -z "$ROX_DESKTOP" ] && pidof ROX-Filer &>/dev/null && ROX_DESKTOP=yes
[ -z "$ROX_DESKTOP" ] && pidof ROX-Filer >/dev/null 2>&1 && ROX_DESKTOP=yes

export TEXTDOMAIN=eventmanager
export OUTPUT_CHARSET=UTF-8
Expand Down Expand Up @@ -366,11 +366,15 @@ set_em_item ICONDESK ${NEWICONDESK}
set_em_item PM13_TRAYICON ${NEWPM13_TRAYICON}

if [ "${NEWPM13_TRAYICON}" = "true" ] ; then
pm13trayicon
pm13 trayicon
else
killall pm13tray 2>/dev/null
fi

if [ "$RAMSAVEINTERVAL" != "${NEWRAMSAVEINTERVAL}" ] ; then
/etc/init.d/pupmode13 restart
fi

if [ "$ROX_DESKTOP" ] ; then
if [ "$NEWHOTPLUGON" = "false" ];then
NEWICONDESK="false"
Expand Down
72 changes: 72 additions & 0 deletions woof-code/rootfs-skeleton/usr/sbin/pm13
@@ -0,0 +1,72 @@
#!/bin/ash

. /etc/eventmanager #only need $RAMSAVEINTERVAL
. /etc/rc.d/PUPSTATE #PUPMODE

if [ "$PUPMODE" != "13" ] ; then
exit
fi

case $1 in

service)
MINUTE=0
SAVECNT=0
while [ 1 ]
do
sleep 60
MINUTE=$((MINUTE+1))
. /etc/eventmanager
if [ "$RAMSAVEINTERVAL" = "" -o $RAMSAVEINTERVAL = "0" ] ; then
continue
fi
SAVECNT=$(( $SAVECNT + 1 ))
if [ $RAMSAVEINTERVAL -ne 0 -a $SAVECNT -ge $RAMSAVEINTERVAL ];then
if save2flash pup_event ; then #periodic save of tmpfs top layer...
SAVECNT=0
fi
fi
done
exit
;;

cli)
echo
echo -n "* Running in"
echo -en "\\033[1;36m PUPMODE 13 \\033[0;39m "
echo "(saving changes to RAM)"
if [ "$RAMSAVEINTERVAL" != "" -a $RAMSAVEINTERVAL != "0" ] ; then
echo -n "-- Saving session every"
echo -en "\\033[1;35m $RAMSAVEINTERVAL minutes \\033[0;39m"
echo "(automatically)"
fi
echo -n "* Type "
echo -en "\\033[1;31msave2flash\\033[0;39m "
echo "whenever you want to save session to pupsave"
echo "# /etc/eventmanager has RAMSAVEINTERVAL which you can adjust to your liking"
echo
;;

trayicon)
[ "$DISPLAY" ] || exit

if [ "$PM13_TRAYICON" = "false" ] ; then
exit
fi

if [ ! -e /tmp/pm13tray ] ; then
yad=$(which yad 2>/dev/null)
ln -s $yad /tmp/pm13tray
fi

yad=/tmp/pm13tray

if ! pidof ${yad##*/} >/dev/null 2>&1; then
$yad --notification \
--command="eventmanager pm13" \
--image=/usr/share/pixmaps/puppy/floppy.svg &
fi
;;

esac

37 changes: 0 additions & 37 deletions woof-code/rootfs-skeleton/usr/sbin/pm13trayicon

This file was deleted.

0 comments on commit 8358e77

Please sign in to comment.