Page 1 of 1

Save or not at shutdown - the real possibility of choice

Posted: 20 Apr 2018, 00:45
by por01
This is not really a bug report, but it is a bug if we consider bug a function that does not do what it should do really.

"Accidentaly," I observed in /mnt/live/cleanup file the following:

Code: Select all

# Save 'changes=EXIT:' session:
if [ -e /tmp/changes-exit ]; then
    echo -e "Your session will be saved in [1;33m3[0m seconds.\nPress space/enter to start doing it now or any other key to skip."; x=3
    while [ $x -gt 0 ]; do read -s -t1 -n1 ans && break || sleep 1; let x=x-1; done
So, at shutdown this message appears, and we have 3 seconds to press "any other key" to prevent saving the changes. Only I am sure the an average user does not even notice this message, and even he notices, he should be very vigilant and fast to be able to make a good decision. Why is this a problem for me? Because if you have a well set system, in most of the cases, there is no any reason to save the changes at shutdown, to wear your storage device...

I edited the file: replaced the above code with the following:

Code: Select all

# Save 'changes=EXIT:' session:
if [ -e /tmp/changes-exit ]; then
    echo -e "Do you want to save your session?\nPress space/enter if yes or any other key to skip."
    read -rsn1 ans
But /mnt/live/cleanup file is not saved when using persistence. So, I entered into /../../changes/etc/rc.d/rc-local file:

Code: Select all

sed -i '/Your session will be saved/c\    echo -e \"Do you want to save your session?\\nPress space/enter if yes or any other key to skip.\"' /mnt/live/cleanup

sed -i '/do read -s -t1 -n1 ans/c\    read -rsn1 ans' /mnt/live/cleanup

Save or not at shutdown - the real possibility of choice

Posted: 20 Apr 2018, 01:24
by Ed_P
Actually I have been using the changes=EXIT cheatcode for years and am therefore well aware of the 3 second prompt. When I am experimenting with the system and don't want anything I've done changed I look forward to the prompt to eliminate anything I may have screwed up. Otherwise I go get something to drink and let the system shutdown or restart.

Your script changes look interesting. I may play around with them or just changing the 3 to a 5 might be helpful for me. :)

Your change is a improvement for those that may be interested in such a change rather than a bug as such I am moving this to the Development section. ;)

Save or not at shutdown - the real possibility of choice

Posted: 21 Apr 2018, 13:41
by brokenman
Only I am sure the an average user does not even notice this message, and even he notices, he should be very vigilant and fast to be able to make a good decision.
If the user didn't open the configuration file and type in the cheatcode to save on exit then the 3 second message wouldn't appear. This only appears for people that opted for the changes on exit method and it offers them a last second 'opt out' of saving changes in case they made a mistake. We used to have a pause but for various reasons decided to no longer pause during boot/shutdown.