Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make asktosave_session work #4087

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions woof-code/rootfs-skeleton/etc/rc.d/rc.shutdown
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ which rfkill >/dev/null 2>&1 && rfkill unblock all

. /etc/rc.d/PUPSTATE #variables created at bootup by init script in initrd...
. /etc/DISTRO_SPECS
. /etc/eventmanager # 140417, SFR

PUPSFSFILE="`echo "$PUPSFS" | cut -f 3 -d ','`" #/etc/rc.d/PUPSTATE
PSUBDIR="`dirname "$PUPSFSFILE"`"
Expand Down Expand Up @@ -181,7 +180,7 @@ if [ $PUPMODE -eq 5 ];then
fi
fi #end ifpupmode5

if [ $PUPMODE -eq 13 ]; then
if [ $PUPMODE -eq 13 -o $PUPMODE -eq 66 ]; then
#read a file named /tmp/session_ramdisk_result, the answer file whether save the ramdisk session to savefile or not
#It contains variable RAMDISK_SAVE_SESSION where the values are 'y' or 'n'
if [ -s /tmp/session_ramdisk_result ]; then
Expand Down Expand Up @@ -220,17 +219,8 @@ rm -f /tmp/geany_socket* 2>/dev/null #if geany still running at shutdown
sync

asktosave_func () {
# if $RAMSAVEINTERVAL > 0, session is saved automatically
if [ "$RAMSAVEINTERVAL" ] && [ $RAMSAVEINTERVAL -gt 0 ] ; then
RETVAL=0
elif [ "$ASKTOSAVE" = "false" ]; then
RETVAL=0
else
dialog --timeout 60 --yes-label "$(gettext 'SAVE')" --no-label "$(gettext 'NO SAVE')" --yesno "$(gettext 'Press ENTER key to save session...
Or, press TAB then ENTER to not save session...
Or, wait 60 seconds to shutdown without saving session...')" 0 0 >/dev/console
RETVAL=$?
fi
asktosave_session >/dev/console
RETVAL=$?
[ $RETVAL -ne 0 ] && echo "$(gettext "Session not saved")" >/dev/console
return $RETVAL
}
Expand Down Expand Up @@ -337,9 +327,11 @@ case $PUPMODE in
STATUS=1
elif [ -e /tmp/rc.shutdown_config ]; then #is after shutdownconfig
STATUS=0
elif [ "$RAMDISK_SAVE_SESSION" == "y" ]; then
STATUS=0
elif [ "$RAMDISK_SAVE_SESSION" == "n" ]; then
STATUS=1
else
RAMSAVEINTERVAL=''
ASKTOSAVE='true'
asktosave_func
STATUS=$?
fi
Expand Down
6 changes: 6 additions & 0 deletions woof-code/rootfs-skeleton/usr/bin/wmexit
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ case $script in
shutdownconfig #dlgs for creating save-file.
#...writes results to /tmp/shutdownconfig_results, which /etc/rc.d/rc.shutdown reads.
[ $? -eq 255 ] && exit #abort shutdown.
elif [ $PUPMODE -eq 13 ] ; then
. /etc/eventmanager
[ "$ASKTOSAVE" = "true" ] && asktosave_session --file
#...writes results to /tmp/session_ramdisk_result, which /etc/rc.d/rc.shutdown reads.
elif [ $PUPMODE -eq 66 ] ; then
asktosave_session --file
fi
[ "$script" = 'wmreboot' ] && EXITMODE="reboot"
[ "$script" = 'wmpoweroff' ] && EXITMODE="poweroff"
Expand Down
14 changes: 10 additions & 4 deletions woof-code/rootfs-skeleton/usr/sbin/asktosave_session
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
#GUI dialog for saving session at PUPMODE 13
# --file parameter for saving user response in /tmp/session_ramdisk_result to be read by /etc/rc.d/rc.shutdown

. /etc/eventmanager
. /etc/rc.d/PUPSTATE

if [ $PUPMODE -ne 13 ]; then
echo "Not PUPMODE 13"
if [ $PUPMODE -eq 13 ]; then
. /etc/eventmanager
elif [ $PUPMODE -eq 66 ]; then
RAMSAVEINTERVAL=''
ASKTOSAVE='true'
else
echo "Not PUPMODE 13 or 66"
exit
fi

Expand All @@ -30,7 +34,9 @@ fi
DLGEXE="dialog"
fi

$DLGEXE --timeout 60 --yes-label "$(gettext 'SAVE')" --no-label "$(gettext 'NO SAVE')" --yesno "$(gettext 'Press ENTER key to save session...
$DLGEXE --timeout 60 --yesno "$(gettext 'Save session?

Press ENTER key to save session...
Or, press TAB then ENTER to not save session...
Or, wait 60 seconds to shutdown without saving session...')" 0 0

Expand Down