Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: newbie000 on April 10, 2012, 01:30:55 AM

Title: Edit TC-Exit Options
Post by: newbie000 on April 10, 2012, 01:30:55 AM
Hi all,

If i would like to hide backup options on TC-Exit menu (shutdown-reboot-backup), to prevent user to save any changes to the OS that has been customized, any file / script i can edit? (in this case only admin allowed to backup: i.e. using terminal).

Have looked at exitcheck.sh, tc-function script, i don't see anything related to menu options..

Thanks!
Title: Re: Edit TC-Exit Options
Post by: curaga on April 10, 2012, 05:16:27 AM
The source to that GUI is available at any mirror, release/src/fltk_projects/exittc. You can compile a custom version that doesn't have the checkbox.
Title: Re: Edit TC-Exit Options
Post by: Rich on April 10, 2012, 10:28:23 AM
Hi newbie000
You could try moving  /usr/bin/filetool.sh  and replacing it with a dummy script  that looks like this:
Code: [Select]
#!/bin/sh
exit 0
This may or may not be enough to fool the exit menu as well as the backup app in control panel into thinking the
backup was done. Save the dummy script (called filetool.sh) in /opt and make it part of your backup. Then in your
/opt/bootlocal.sh, add something like this:
Code: [Select]
mv /usr/bin/filetool.sh /root/filetool.sh
chmod 600 /root/filetool.sh
chown root:root /root/filetool.sh
chmod 700 /root
cp /opt/filetool.sh /usr/bin/filetool.sh
chmod 755 /usr/bin/filetool.sh
chown root:root /usr/bin/filetool.sh
After you have created the dummy file and modified the bootlocal.sh script, call up the exit menu, select Reboot, and
let it backup your changes. If it works, the backup functions in the exit menu and control panel will be non-functional
after rebooting. That still leaves the problem of someone finding filetool.sh, and running  sudo /root/filetool.sh -b
from a terminal or a file manager that supports sudo and execute.
Title: Re: Edit TC-Exit Options
Post by: cep33920 on July 27, 2012, 11:19:26 AM
Hello,

i'm interessed in compiling exittc to set to none the default shutdown or reboot backup option.
I've the sources files (the link from curaga), gcc and even compiletc, but a gcc exittc.cxx -o exittc do nothing,

an advice ?

thanks
Title: Re: Edit TC-Exit Options
Post by: curaga on July 27, 2012, 11:39:47 AM
You don't need to edit it for that, see .profile - you can just set BACKUP=0 so that it defaults to no backup.
Title: Re: Edit TC-Exit Options
Post by: cep33920 on July 27, 2012, 11:54:42 AM
ok,
thank you curaga,
done in /home/tc/.profile
export BACKUP=0
Title: Re: Edit TC-Exit Options
Post by: TomyTurbos on February 06, 2019, 05:00:29 PM
I know this thread is old enough to grow a beard but I'm wondering how to (rather, which file to edit) in order to change the default shutdown menu linked to wbar to make 'reboot' the default option rather than 'shutdown'.  I have looked but not found the answer.

Related to this (but somewhat less important) would be forcing the Power Button to call the same script.

If it matters, this is on a Dell Mini 1010.

I am asking this because I need to out-stupid any users.  I am also working toward a system which protects itself in the case of a power outage.

As always, thanks in advance.
Title: Re: Edit TC-Exit Options
Post by: Juanito on February 06, 2019, 08:45:52 PM
If you look at the wbar icon desktop file for the exit icon - /usr/local/share/applications/tinycore-exittc.desktop - you will see it points to /usr/local/bin/exittc, provided by the Xprogs extension.

You can find details of exittc at https://github.com/tinycorelinux/fltk_projects/tree/master/exittc showing that it calls, amongst other things, /usr/bin/exitcheck.sh

You can use the acpid extension to execute commands when the power, or other buttons, are pressed.

Title: Re: Edit TC-Exit Options
Post by: Rich on February 06, 2019, 10:28:25 PM
Hi TomyTurbos
I worked out a change that allows the default exit mode of  exittc  to be changed by setting  EXITPROMPT  to "shutdown",
"reboot", or "prompt" in your  /home/tc/.profile  file. The following patch is attached:

    [EDIT]: Patch removed. Revised patch posted in reply #33 and to http://patches.tinycorelinux.net/
Title: Re: Edit TC-Exit Options
Post by: Rich on February 07, 2019, 01:29:26 PM
Hi TomyTurbos
If you want to try out my patch, here's an easy (I hope) step by step.

Open your  /home/tc/.profile  file and add the following line:
Code: [Select]
export EXITPROMPT="reboot"Save the file and close the editor.

Download the attached bz2 file into your  /home/tc/ directory. Now open a terminal and execute the following commands:
Code: [Select]
tce-load -w compiletc fltk-1.3-dev sstrip
tce-load -i compiletc fltk-1.3-dev sstrip
tar xjvf exittc.tar.bz2
cd exittc
./CompileExittc
cp exittc ~/.local/bin/
export EXITPROMPT="reboot"
./exittc

The  exittc  applet should pop up with the  reboot  option preselected. Click  OK  to let the machine reboot.  When it comes
back up, it should default to  reboot  whether using the icon, the desktop menu, or entering  exittc  at the command line.

Reply #17 in this thread shows a screenshot of commands and expected responses

    [EDIT]: Re-arranged the instructions in an attempt to make them clearer.  Rich
Title: Re: Edit TC-Exit Options
Post by: TomyTurbos on February 07, 2019, 01:29:49 PM
Hi TomyTurbos
I worked out a change that allows the default exit mode of  exittc  to be changed by setting  EXITPROMPT  to "shutdown",
"reboot", or "prompt" in your  /home/tc/.profile  file. The following patch is attached:
~snip~

Awesome! 

Now, if only I knew what to do with it!

PS:  You're awesome too, Juanito.
Title: Re: Edit TC-Exit Options
Post by: TomyTurbos on February 07, 2019, 01:30:48 PM
I guess we were posting simultaneously.
Title: Re: Edit TC-Exit Options
Post by: Rich on February 07, 2019, 01:36:15 PM
Hi TomyTurbos
I guess we were posting simultaneously.
Great minds think alike. :)

... Awesome! 

Now, if only I knew what to do with it!
Well, now you do. Try the instructions in reply #9.
Title: Re: Edit TC-Exit Options
Post by: TomyTurbos on February 07, 2019, 02:40:58 PM
Well, we're not quite there yet.

First off, the tce-load -w 'etc.' command d/l'ed a LOT of stuff, some of which was already in my tce directory.  I realize this is probably a deficiency in tce-load; only mentioning it to bring it to your attention.

Next, would it not have been more efficient to use '-wi' as the switch rather than doing it separately?  Not that big a deal but I'm a simple guy here...

Also, the explicit path to the tar.bz2 was required.  (in my case it was my tce dir.)

That last step either has me confused and I did it wrong or some combination of the above.  In either event it did not work.  You said, "Finally enter './exittc'".  I tried that in aterm.  I tried it as sudo.  I added it to the .profile file.  Net result is no change, even after reboot.

Title: Re: Edit TC-Exit Options
Post by: coreplayer2 on February 07, 2019, 05:16:38 PM
Well, we're not quite there yet.

First off, the tce-load -w 'etc.' command d/l'ed a LOT of stuff, some of which was already in my tce directory.  I realize this is probably a deficiency in tce-load; only mentioning it to bring it to your attention.

Next, would it not have been more efficient to use '-wi' as the switch rather than doing it separately?  Not that big a deal but I'm a simple guy here...

Also, the explicit path to the tar.bz2 was required.  (in my case it was my tce dir.)

That last step either has me confused and I did it wrong or some combination of the above.  In either event it did not work.  You said, "Finally enter './exittc'".  I tried that in aterm.  I tried it as sudo.  I added it to the .profile file.  Net result is no change, even after reboot.
Hello Tommy,
Next time try using the --help menu,   most if not all programs have a --help (or -h) menu to help with syntax and usage

example
Code: [Select]
tc@box:~$ tce-load --help
Illegal option --
Version 10.0
Usage: tce-load [ -i -w -wi -wo -wil -ic -wic -wicl]{s} extensions
  -i   Loads local extension
  -w   Download extension only
  -wi  Download and install extension
  -wo  Download and create an ondemand item
  Adding -c to any -i option will force a one time copy to file system
  Adding -l to any -i option indicates load only - do not update onboot or ondemand
  Adding -s to any option will suppress OK message used by apps GUI

Example usage:
 Load local extension:
   tce-load -i /mnt/hda1/tce/optional/nano.tcz
 Download into tce/optional directory, updates OnBoot and installs:
   tce-load -w -i nano.tcz
 Download only into tce/optional directory:
   tce-load -w nano.tcz
tc@box:~$

Am fairly sure you'd of figured out what you were not doing right after reading this and tce-load  downloads and install's, it doesn't delete stuff..

:)
Title: Re: Edit TC-Exit Options
Post by: Rich on February 07, 2019, 06:05:30 PM
Hi TomyTurbos
... Also, the explicit path to the tar.bz2 was required.  (in my case it was my tce dir.) . ...

Sorry, don't put the  .bz2  file in your  tce  directory. Place it in your  /home/tc/  directory.

... That last step either has me confused and I did it wrong or some combination of the above.  In either event it did not work.  You said, "Finally enter './exittc'".  I tried that in aterm.  I tried it as sudo.  I added it to the .profile file.  Net result is no change, even after reboot.
A couple of things. Don't add  ./exittc  to your  .profile  file, enter it in the terminal.  All the steps should be performed from the
same terminal.

Title: Re: Edit TC-Exit Options
Post by: TomyTurbos on February 07, 2019, 06:58:52 PM
Well, we're not quite there yet.

First off, the tce-load -w 'etc.' command d/l'ed a LOT of stuff, some of which was already in my tce directory.  I realize this is probably a deficiency in tce-load; only mentioning it to bring it to your attention.

Next, would it not have been more efficient to use '-wi' as the switch rather than doing it separately?  Not that big a deal but I'm a simple guy here...

Also, the explicit path to the tar.bz2 was required.  (in my case it was my tce dir.)

That last step either has me confused and I did it wrong or some combination of the above.  In either event it did not work.  You said, "Finally enter './exittc'".  I tried that in aterm.  I tried it as sudo.  I added it to the .profile file.  Net result is no change, even after reboot.
Hello Tommy,
Next time try using the --help menu,   most if not all programs have a --help (or -h) menu to help with syntax and usage

example
Code: [Select]
tc@box:~$ tce-load --help
Illegal option --
Version 10.0
Usage: tce-load [ -i -w -wi -wo -wil -ic -wic -wicl]{s} extensions
  -i   Loads local extension
  -w   Download extension only
  -wi  Download and install extension
  -wo  Download and create an ondemand item
  Adding -c to any -i option will force a one time copy to file system
  Adding -l to any -i option indicates load only - do not update onboot or ondemand
  Adding -s to any option will suppress OK message used by apps GUI

Example usage:
 Load local extension:
   tce-load -i /mnt/hda1/tce/optional/nano.tcz
 Download into tce/optional directory, updates OnBoot and installs:
   tce-load -w -i nano.tcz
 Download only into tce/optional directory:
   tce-load -w nano.tcz
tc@box:~$

Am fairly sure you'd of figured out what you were not doing right after reading this and tce-load  downloads and install's, it doesn't delete stuff..

:)

I did know it didn't delete anything.  The point is that it re-downloaded stuff I already have.

But really all that is of concern here is that it still doesn't work as per your instructions in Post #9 when we get to the last statement.  I did that in aterm.  I did it again with sudo.  It still doesn't work for me.
 
Title: Re: Edit TC-Exit Options
Post by: Rich on February 07, 2019, 07:57:22 PM
Hi TomyTurbos
Quote
But really all that is of concern here is that it still doesn't work as per your instructions in Post #9 when we get to the last statement.  I did that in aterm.  I did it again with sudo.  It still doesn't work for me.
Assuming you still have the extensions for compiling downloaded run:
Code: [Select]
tce-load -i compiletc fltk-1.3-dev sstripHere are the remaining commands and expected results:
Code: [Select]
tc@box:~$ tar xjvf exittc.tar.bz2
exittc/
exittc/exittc.h
exittc/CompileExittc
exittc/exittc.patch
exittc/exittc.cxx.old
exittc/exittc.cxx
exittc/exittc.fl
tc@box:~$ cd exittc
tc@box:~/exittc$ ./CompileExittc
tc@box:~/exittc$ cp exittc ~/.local/bin/
tc@box:~/exittc$ export EXITPROMPT="reboot"
tc@box:~/exittc$ ./exittc
tc@box:~/exittc$

Here is a screenshot:
(https://i.postimg.cc/J4rv5vhR/grabber2019-Feb07-224133.png)


Title: Re: Edit TC-Exit Options
Post by: TomyTurbos on February 07, 2019, 09:05:40 PM
That worked, but not on reboot.

Title: Re: Edit TC-Exit Options
Post by: Rich on February 07, 2019, 09:17:36 PM
Hi TomyTurbos
That worked, but not on reboot.
You need to provide more information. When you click on the exit icon, it doesn't default to reboot? Did you remember to
add this line to your  .profile  file:
Code: [Select]
export EXITPROMPT="reboot"If you didn't, you need to add it and reboot for it to take effect.
Title: Re: Edit TC-Exit Options
Post by: TomyTurbos on February 08, 2019, 02:15:24 PM
Hi TomyTurbos
That worked, but not on reboot.
You need to provide more information. When you click on the exit icon, it doesn't default to reboot? Did you remember to
add this line to your  .profile  file:
Code: [Select]
export EXITPROMPT="reboot"If you didn't, you need to add it and reboot for it to take effect.

That is correct, Sir.  It still defaults to 'Shutdown' after rebooting.
Title: Re: Edit TC-Exit Options
Post by: Rich on February 08, 2019, 04:56:04 PM
Hi TomyTurbos
Run the following commands:
Code: [Select]
ls -l ~/.local/bin/ > system.txt
cat .profile >> system.txt
env >> system.txt
showbootcodes >> system.txt
cat /opt/.filetool.lst >> system.txt
and attach the  system.txt  file to your next post.
Title: Re: Edit TC-Exit Options
Post by: TomyTurbos on February 08, 2019, 08:13:23 PM
Hi TomyTurbos
Run the following commands:
Code: [Select]
ls -l ~/.local/bin/ > system.txt
cat .profile >> system.txt
env >> system.txt
showbootcodes >> system.txt
cat /opt/.filetool.lst >> system.txt
and attach the  system.txt  file to your next post.

Hmm...  That's harder than it looks (because I'm not using the same machine to post here)

Title: Re: Edit TC-Exit Options
Post by: Rich on February 08, 2019, 08:29:14 PM
Hi TomyTurbos
Download the attached file. Copy it to the  /home/tc/  directory of the machine in question. Make it executable like this:
Code: [Select]
chmod 774 systemstats.shNow run it like this:
Code: [Select]
./systemstats.shUse a thumb drive to transfer the  system.txt  file and attach it to your next post.
Title: Re: Edit TC-Exit Options
Post by: TomyTurbos on February 08, 2019, 09:07:00 PM
Hi TomyTurbos
Download the attached file. Copy it to the  /home/tc/  directory of the machine in question. Make it executable like this:
Code: [Select]
chmod 774 systemstats.shNow run it like this:
Code: [Select]
./systemstats.shUse a thumb drive to transfer the  system.txt  file and attach it to your next post.

I did it the other way while you wrote that script.

Here's what I got:

Code: [Select]
total 24
-rwxr-xr-x 1 tc staff 20912 Feb  7 23:37 exittc
  # ~/.profile: Executed by Bourne-compatible login SHells.
#
# Path to personal scripts and executables (~/.local/bin).
[ -d "$HOME/.local/bin" ] || mkdir -p "$HOME/.local/bin"
export PATH=$HOME/.local/bin:$PATH

ONDEMAND=/etc/sysconfig/tcedir/ondemand
[ -d "$ONDEMAND" ] && export PATH=$PATH:"$ONDEMAND"

# Environment variables and prompt for Ash SHell
# or Bash. Default is a classic prompt.
#
PS1='\u@\h:\w\$ '
PAGER='less -EM'
MANPAGER='less -isR'

EDITOR=vi

export PS1 PAGER FILEMGR EDITOR MANPAGER

export BACKUP=1
[ "`id -un`" = "`cat /etc/sysconfig/tcuser`" ] && echo "$BACKUP" | sudo tee /etc/sysconfig/backup >/dev/null 2>&1
export FLWM_TITLEBAR_COLOR="58:7D:AA"

if [ -f "$HOME/.ashrc" ]; then
   export ENV="$HOME/.ashrc"
   . "$HOME/.ashrc"
fi

TERMTYPE=`/usr/bin/tty`
[ ${TERMTYPE:5:3} == "tty" ] && (
[ ! -f /etc/sysconfig/Xserver ] ||
[ -f /etc/sysconfig/text ] ||
[ -e /tmp/.X11-unix/X0 ] ||
startx
)

export EXITPROMPT="reboot"WM_PID=3929
XPID=3923
USER=tc
SHLVL=6
HOME=/home/tc
OLDPWD=/home/tc
PAGER=less -EM
PS1=\u@\h:\w\$
ENV=/home/tc/.ashrc
BACKUP=1
COLORTERM=rxvt
LOGNAME=tc
WINDOWID=8388610
COLORFGBG=15;0
TERM=rxvt
PATH=/home/tc/.local/bin:/usr/local/sbin:/usr/local/bin:/apps/bin:/usr/sbin:/usr/bin:/sbin:/bin:/etc/sysconfig/tcedir/ondemand
G_FILENAME_ENCODING=iso8859-1
DISPLAY=:0.0
LANG=C
MANPAGER=less -isR
XAUTHORITY=/home/tc/.Xauthority
SHELL=/bin/sh
ICONS=wbar
DESKTOP=flwm_topside
FLWM_TITLEBAR_COLOR=58:7D:AA
PWD=/home/tc
EDITOR=editor
BOOT_IMAGE=/boot/vmlinuz quiet loglevel=0 waitusb=2:UUID=F885-DB9E showapps desktop=flwm_topside blacklist=bcma,ssb,b43  initrd=/boot/core.gz
opt
home
etc/lighttpd
Title: Re: Edit TC-Exit Options
Post by: Rich on February 08, 2019, 09:28:11 PM
Hi TomyTurbos
It looks like you added  export EXITPROMPT="reboot"  to the end of your  .profile  file but didn't add a carriage return to the end
of the line.
Title: Re: Edit TC-Exit Options
Post by: TomyTurbos on February 09, 2019, 09:36:00 AM
Hi TomyTurbos
It looks like you added  export EXITPROMPT="reboot"  to the end of your  .profile  file but didn't add a carriage return to the end
of the line.

Well, I fixed that.  But still no joy.
Title: Re: Edit TC-Exit Options
Post by: Rich on February 09, 2019, 09:40:19 AM
Hi TomyTurbos
Did you reboot?
Title: Re: Edit TC-Exit Options
Post by: TomyTurbos on February 09, 2019, 09:55:39 AM
Yes.  Several times since then. (For different reasons, of course).
Title: Re: Edit TC-Exit Options
Post by: Rich on February 09, 2019, 10:04:19 AM
Hi TomyTurbos
Try moving the  export EXITPROMPT="reboot"  line so it's just below the  export BACKUP=1  line, save and reboot. If that
doesn't fix it, use the  systemstats.sh  script I attached in a previous post to get me a fresh  system.txt  file.
Title: Re: Edit TC-Exit Options
Post by: TomyTurbos on February 09, 2019, 10:20:04 AM
w00t!

That did it.

Thanks a million!
Title: Re: Edit TC-Exit Options
Post by: Rich on February 09, 2019, 11:21:40 AM
Hi TomyTurbos
Looks like additions to  .profile  probably need to be added above this section of the file in order to be seen:
Code: [Select]
TERMTYPE=`/usr/bin/tty`
[ ${TERMTYPE:5:3} == "tty" ] && (
[ ! -f /etc/sysconfig/Xserver ] ||
[ -f /etc/sysconfig/text ] ||
[ -e /tmp/.X11-unix/X0 ] ||
startx
)
Title: Re: Edit TC-Exit Options
Post by: TomyTurbos on February 09, 2019, 02:55:38 PM
You did a great job, Rich.  I guess we're all still learning...

Thinking forward, it would be cool if what you started grew into a package or script where one can select or change the default behavior, but don't rush to do that on my account.  I got what I needed for the moment.  It would be a cool feature though.

I haven't yet looked into the ACPI for how to change the power button's behavior, mostly because I'm still wrapped up in the webserver portion of my project.  But at some point I'll get back to that, and I'm sure to call on your expertise at that time.
Title: Re: Edit TC-Exit Options
Post by: Rich on February 09, 2019, 06:01:53 PM
Hi TomyTurbos
You did a great job, Rich.  ...
Thank you.

Quote
... Thinking forward, it would be cool if what you started grew into a package or script where one can select or change the default behavior, but don't rush to do that on my account. ...
Since  exittc  is part of  Xprogs.tcz  I'd prefer to see if my changes will be accepted. I've finalized the patch and added a few
comments to the code. The patch file is attached here and has also been submitted to  http://patches.tinycorelinux.net/.

This is what it looks like:
Code: [Select]
--- exittc.cxx.old 2019-02-07 00:24:19.498731367 +0000
+++ exittc.cxx 2019-02-09 20:28:21.511600298 +0000
@@ -115,6 +115,37 @@
 Fl_Return_Button *btnOK=(Fl_Return_Button *)0;
 
 int main(int argc, char **argv) {
+
+// Variables used to override default radio button for shutdown.
+int shutdownDefault=1, rebootDefault=0, promptDefault=0;
+string exitpromptDefault;
+
+if ( getenv("EXITPROMPT"))
+{ // If environmental variable EXITPROMPT is set user wants to override default behavior.
+ shutdownDefault=0;
+ exitpromptDefault  = getenv("EXITPROMPT");
+ if (exitpromptDefault == "shutdown")
+ {
+ action = 1;
+ shutdownDefault=1;
+ }
+ else
+ if (exitpromptDefault == "reboot")
+ {
+ action = 2;
+ rebootDefault=1;
+ }
+ else
+ if (exitpromptDefault == "prompt")
+ {
+ action = 3;
+ promptDefault=1;
+ }
+ else // Invalid value for EXITPROMPT so revert to default behavior.
+ shutdownDefault=1;
+}
+
+
   setlocale(LC_ALL, "");
 bindtextdomain("tinycore","/usr/local/share/locale");
 textdomain("tinycore");
@@ -125,17 +156,19 @@
       { Fl_Round_Button* o = new Fl_Round_Button(25, 10, 85, 15, gettext("Shutdown"));
         o->type(102);
         o->down_box(FL_ROUND_DOWN_BOX);
-        o->value(1);
+        o->value(shutdownDefault); // Setting this to non-zero turns it on.
         o->callback((Fl_Callback*)btn_callback, (void*)("shutdown"));
       } // Fl_Round_Button* o
       { Fl_Round_Button* o = new Fl_Round_Button(25, 30, 65, 15, gettext("Reboot"));
         o->type(102);
         o->down_box(FL_ROUND_DOWN_BOX);
+        o->value(rebootDefault); // Setting this to non-zero turns it on.
         o->callback((Fl_Callback*)btn_callback, (void*)("reboot"));
       } // Fl_Round_Button* o
       { btnExitPrompt = new Fl_Round_Button(25, 50, 110, 15, gettext("Exit to Prompt"));
         btnExitPrompt->type(102);
         btnExitPrompt->down_box(FL_ROUND_DOWN_BOX);
+        btnExitPrompt->value(promptDefault); // Setting this to non-zero turns it on.
         btnExitPrompt->callback((Fl_Callback*)btn_callback, (void*)("prompt"));
       } // Fl_Round_Button* btnExitPrompt
       o->end();
Title: Re: Edit TC-Exit Options
Post by: TomyTurbos on February 09, 2019, 07:58:33 PM
Saul Goodman!

('s all good, man)

I understand why you did this the way you did and I don't mind being a guinea pig, especially if it's a feature I need/want.  I try to give back to the community in any way I can, which is why I make an effort to recap on questions I have answers for such as my 'lighty' thread.

I still don't really get how to apply a patch, but I'll get there eventually.
Title: Re: Edit TC-Exit Options
Post by: Rich on February 09, 2019, 08:36:54 PM
Hi TomyTurbos
... I still don't really get how to apply a patch, ...
That's why I provided the  .tar.bz2  file, much simpler. A patch file merely documents how a file was changed. It is typically used
to submit source code changes. There is a program called  patch  that can read the  .patch  file and apply the changes to the
original source code. At any rate, the  .patch  file is really intended for someone like curaga or Juanito to apply to the original
source code if the changes are accepted.
Title: Re: Edit TC-Exit Options
Post by: curaga on February 10, 2019, 02:16:53 AM
The FLTK projects are generated from the fluid files, so a patch against a cxx file would just vanish on the next build. Please edit the fluid file (in fluid). The changes themselves look ok.
Title: Re: Edit TC-Exit Options
Post by: TomyTurbos on February 10, 2019, 08:21:52 AM
... At any rate, the  .patch  file is really intended for someone like curaga or Juanito to apply to the original source code if the changes are accepted.

Roger that!
Title: Re: Edit TC-Exit Options
Post by: Rich on February 10, 2019, 09:32:26 AM
Hi curaga
... a patch against a cxx file would just vanish on the next build. ...
Yeah, I hate it when that happens.  :)  Attached is the diff of the fluid file. Here's what it looks like:
Code: [Select]
--- exittc.fl.old 2019-02-10 08:50:39.097576708 +0000
+++ exittc.fl 2019-02-10 10:56:37.304126234 +0000
@@ -1,41 +1,57 @@
 # data file for the Fltk User Interface Designer (fluid)
-version 1.0110
-i18n_type 1
-i18n_include <libintl.h>
-i18n_function gettext
-header_name {.h}
+version 1.0304
+i18n_type 1
+i18n_include <libintl.h>
+i18n_function gettext
+header_name {.h}
 code_name {.cxx}
-decl {// (c) Robert Shingledecker 2008-2010} {}
+decl {// (c) Robert Shingledecker 2008-2010} {private local
+}
 
-decl {\#include <cstdlib>} {}
+decl {\#include <cstdlib>} {private local
+}
 
-decl {\#include <iostream>} {}
+decl {\#include <iostream>} {private local
+}
 
-decl {\#include <stdio.h>} {}
+decl {\#include <stdio.h>} {private local
+}
 
-decl {\#include <string>} {}
+decl {\#include <string>} {private local
+}
 
-decl {\#include <fstream>} {}
+decl {\#include <fstream>} {private local
+}
 
-decl {\#include <FL/fl_message.H>} {}
+decl {\#include <FL/fl_message.H>} {private local
+}
 
-decl {\#include <locale.h>} {}
+decl {\#include <locale.h>} {private local
+}
 
-decl {\#include <unistd.h>} {}
+decl {\#include <unistd.h>} {private local
+}
 
-decl {\#include <string.h>} {}
+decl {\#include <string.h>} {private local
+}
 
-decl {using namespace std;} {}
+decl {using namespace std;} {private local
+}
 
-decl {string backup_device="", command;} {}
+decl {string backup_device="", command;} {private local
+}
 
-decl {int action=1;} {}
+decl {int action=1;} {private local
+}
 
-decl {bool backup=true;} {}
+decl {bool backup=true;} {private local
+}
 
-decl {string commandStr = "exitcheck.sh ";} {}
+decl {string commandStr = "exitcheck.sh ";} {private local
+}
 
-decl {string cmdline, actionStr, backup_options, backup_command;} {}
+decl {string cmdline, actionStr, backup_options, backup_command;} {private local
+}
 
 Function {btn_callback(Fl_Widget*, void*userdata)} {open return_type {static void}
 } {
@@ -114,7 +130,7 @@
     exit(0);
   } 
 }} {}
-}
+}
 
 Function {} {open
 } {
@@ -128,13 +144,13 @@
     Fl_Group {} {open
       xywh {25 10 115 70}
     } {
-      Fl_Round_Button {} {
+      Fl_Round_Button btnExitShutdown {
         label Shutdown
         user_data {"shutdown"}
         callback btn_callback
         xywh {25 10 85 15} type Radio down_box ROUND_DOWN_BOX value 1
       }
-      Fl_Round_Button {} {
+      Fl_Round_Button btnExitReboot {
         label Reboot
         user_data {"reboot"}
         callback btn_callback
@@ -180,6 +196,35 @@
       xywh {100 150 70 20}
     }
   }
+  code {// Environmental value used to override default radio button for shutdown.
+// Valid values are "shutdown", "reboot", or "prompt"
+string exitpromptDefault;
+
+if ( getenv("EXITPROMPT"))
+{ // If environmental variable EXITPROMPT is set user wants to override default behavior.
+ exitpromptDefault  = getenv("EXITPROMPT");
+ btnExitShutdown->value(0); // Clear current default.
+ if (exitpromptDefault == "shutdown")
+ {
+ action = 1;
+ btnExitShutdown->value(1);
+ }
+ else
+ if (exitpromptDefault == "reboot")
+ {
+ action = 2;
+ btnExitReboot->value(1);
+ }
+ else
+ if (exitpromptDefault == "prompt")
+ {
+ action = 3;
+ btnExitPrompt->value(1);
+ }
+ else // Invalid value for EXITPROMPT so revert to default behavior.
+ btnExitShutdown->value(1);
+}} {selected
+  }
   code {ifstream backup_device_file("/etc/sysconfig/backup_device");
 if ( backup_device_file.is_open())
 {
@@ -249,6 +294,5 @@
 if (cmdline.find("xonly") != string::npos) btnExitPrompt->hide();
 
 window->show(argc, argv);
-btnOK->take_focus();} {selected
-  }
-}
+btnOK->take_focus();} {}
+}
Doing this through fluid forced me to alter my method slightly. I named the 2 unnamed radio buttons and overrode the default
directly by using ButtonName->value.

I didn't know if you want diffs on the cxx and header files so I've attached them as well.
Title: Re: Edit TC-Exit Options
Post by: curaga on February 10, 2019, 11:54:26 PM
Applied, thanks.
Title: Re: Edit TC-Exit Options
Post by: Juanito on February 11, 2019, 03:48:33 AM
Xprogs updated in tc-10.x x86 repo - please test.
Title: Re: Edit TC-Exit Options
Post by: Rich on February 11, 2019, 07:25:29 AM
Hi TomyTurbos
OK, time to finalize the changes. First remove the  exittc  program you compiled:
Code: [Select]
rm ~/.local/bin/exittcEnter  y  when it asks you to confirm.

Next update your system:
Code: [Select]
tce-audit builddb
tce-audit updatedeps
tce-audit fetchmissing
tce-update

Click on the  Exit  icon. Click  Reboot  and then  OK. When the machine comes back up, open a terminal and enter this command:
Code: [Select]
tc@box:~$ which exittc
/usr/local/bin/exittc
tc@box:~$
Confirm you got the same response.

Finally, click on the  Exit  icon. It should be defaulting to  Reboot  again.
Title: Re: Edit TC-Exit Options
Post by: TomyTurbos on February 12, 2019, 04:22:03 PM
Xprogs updated in tc-10.x x86 repo - please test.

I'm curious to know why apache2.4 is a dependency.

Just trying to understand this.
Title: Re: Edit TC-Exit Options
Post by: TomyTurbos on February 12, 2019, 04:23:46 PM
Hi TomyTurbos
OK, time to finalize the changes. First remove the  exittc  program you compiled:
Code: [Select]
rm ~/.local/bin/exittcEnter  y  when it asks you to confirm.

Next update your system:
Code: [Select]
tce-audit builddb
tce-audit updatedeps
tce-audit fetchmissing
tce-update

Click on the  Exit  icon. Click  Reboot  and then  OK. When the machine comes back up, open a terminal and enter this command:
Code: [Select]
tc@box:~$ which exittc
/usr/local/bin/exittc
tc@box:~$
Confirm you got the same response.

Finally, click on the  Exit  icon. It should be defaulting to  Reboot  again.

Thanks.  I had already applied the update via Apps and all is well.
Title: Re: Edit TC-Exit Options
Post by: Rich on February 12, 2019, 05:10:29 PM
Hi TomyTurbos
Xprogs updated in tc-10.x x86 repo - please test.
I'm curious to know why apache2.4 is a dependency.

Just trying to understand this.
What make you think  apache  is a dependency? According to this:
http://tinycorelinux.net/10.x/x86/tcz/Xprogs.tcz.dep
the dependencies are:
Code: [Select]
Xlibs.tcz
fltk-1.3.tcz
imlib2-bin.tcz
Title: Re: Edit TC-Exit Options
Post by: TomyTurbos on February 12, 2019, 05:27:20 PM
Hi TomyTurbos
Xprogs updated in tc-10.x x86 repo - please test.
I'm curious to know why apache2.4 is a dependency.

Just trying to understand this.
What make you think  apache  is a dependency? According to this:
http://tinycorelinux.net/10.x/x86/tcz/Xprogs.tcz.dep
the dependencies are:
Code: [Select]
Xlibs.tcz
fltk-1.3.tcz
imlib2-bin.tcz

When downloaded through 'Apps>Update'  Apache2.4 and Xorg-7-7-bin were listed as such.  They are now installed, but neither of them was previously.
Title: Re: Edit TC-Exit Options
Post by: Rich on February 12, 2019, 06:32:54 PM
Hi Hi TomyTurbos
Unless you can point to a specific  .dep  that lists an incorrect dependency I don't know what to tell you. If you execute:
Code: [Select]
for i in /etc/sysconfig/tcedir/optional/*.tcz.dep ; do grep -H apache $i ; doneIt will list which of your dependency files contain  apache.

Title: Re: Edit TC-Exit Options
Post by: TomyTurbos on February 12, 2019, 07:57:29 PM
Hi Hi TomyTurbos
Unless you can point to a specific  .dep  that lists an incorrect dependency I don't know what to tell you. If you execute:
Code: [Select]
for i in /etc/sysconfig/tcedir/optional/*.tcz.dep ; do grep -H apache $i ; doneIt will list which of your dependency files contain  apache.

It wasn't really a problem.  More, it was a confusion because of what 'Apps' said when I used 'Update'.

All I know is that 'Apps' d/l'd the two other modules AS dependencies.  Neither of those files were in my TCE before.

I just tested this using 'Apps'; marked them for deletion and rebooted.  It still works as designed.

That's all the more input I can offer other than to make the remark that 'Apps' itself is sorely in need of improvement (IMO).  I'll start another thread on that rather than discuss it here.
Title: Re: Edit TC-Exit Options
Post by: Juanito on February 12, 2019, 11:19:48 PM
Xprogs updated in CorePure64 repo