Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: Zlika on November 17, 2016, 10:55:43 AM

Title: FLWM "Exit" menu does not shutdown the computer if Xprogs is not installed
Post by: Zlika on November 17, 2016, 10:55:43 AM
Hi all,

I try to make a custom tinycore image without the Xprogs extension. The problem is that now when I select "Exit" in the window manager menu it only closes the window manager but the computer is not halted.
How could I change that?

Thanks for your replies.
Title: Re: FLWM "Exit" menu does not shutdown the computer if Xprogs is not installed
Post by: gerald_clark on November 17, 2016, 05:17:41 PM
Include Xprogs.
Title: Re: FLWM "Exit" menu does not shutdown the computer if Xprogs is not installed
Post by: Misalf on November 17, 2016, 07:53:04 PM
Xprogs.tcz  is part of the default desktop base on Tiny Core.
If you don't want to use the features provided by  Xprogs.tcz  (f.e. exittc), you would need to modify the Window Manager accordingly.
I wasn't able to spot the part where it creates the "Exit" part of the menu via the scripts included in the FLWM extension (I'm not used to FLWM).
I suspect that you want to keep the size at a minimum? Otherwise, other WMs might be easier to configure to your needs.
Title: Re: FLWM "Exit" menu does not shutdown the computer if Xprogs is not installed
Post by: Misalf on November 17, 2016, 07:56:45 PM
Or extract only the stuff you need from  Xprogs.tcz  and include it in a self made  initrd  (i.e. core.gz  or an additional cpio archive that you would load in addition to core.gz) or  *.tcz .
Title: Re: FLWM "Exit" menu does not shutdown the computer if Xprogs is not installed
Post by: Zlika on November 18, 2016, 03:51:44 AM
Hi,

I don't want to include Xprogs because I don't need it and I want to produce a smaller image. The only thing I want is to understand how Xprogs/Exittc hooks the FLWM "Exit" menu to shutdown the computer, so I could do the same without Xprogs. I was not able to understand it by analyzing the Xprogs extension. I tried for example to add a .wmx/SystemTools/Exit script but it is not called on FLWM Exit.

Regards,
Thomas
Title: Re: FLWM "Exit" menu does not shutdown the computer if Xprogs is not installed
Post by: nitram on November 18, 2016, 04:55:21 AM
Hi Zlika.

To me Misalf's suggestion would probably be easiest, strip Xprogs.tcz to include only exittc executable related stuff. Rename it Xprogs_mod.tcz or similar so it's not overwritten in an update check.

However, unsquashing flwm.tcz -> usr/local/bin/flwm_initmenu appears to be the script that builds the menu, this appears to be how the menu gets created:
Code: [Select]
TARGET="$SYSMENU"/SystemTools && mkdir "$TARGET"
sync
for D in `ls /usr/local/share/applications/tinycore-*`; do
   writeFLWMitem "$D"
done

Everything in /usr/local/share/applications/tinycore-* coincidentally is part of Xprogs.tcz unsquashed:
Code: [Select]
tinycore-apps.desktop        tinycore-mnttool.desktop
tinycore-cpanel.desktop      tinycore-screenshot.desktop
tinycore-editor.desktop      tinycore-services.desktop
tinycore-exittc.desktop      tinycore-settime.desktop
tinycore-flrun.desktop

The tinycore-exittc.desktop file requires the exittc executable:
Code: [Select]
[Desktop Entry]
Name=Exit
Exec=exittc
Icon=exittc
X-FullPathIcon=/usr/local/share/pixmaps/exittc.png
Type=Application
Categories=System;

Although Xprogs contains 18 executables none are critical for backup and shutdown, as the base TC file system appears to contain the following:
/sbin/poweroff
/sbin/halt
/usr/bin/backup
/usr/bin/filetool.sh

So if you absolutely don't want Xprogs you could probably modify flwm.tcz, add this directory and desktop file: /usr/local/share/applications/tinycore-exittc.desktop. Then modify the desktop file to include something like: exec=sudo /sbin/poweroff. Not tested, just best guess.
Title: Re: FLWM "Exit" menu does not shutdown the computer if Xprogs is not installed
Post by: curaga on November 18, 2016, 05:44:00 AM
The exit menu item is hardcoded in the flwm source. You can build your own flwm with it edited to something else.
Title: Re: FLWM "Exit" menu does not shutdown the computer if Xprogs is not installed
Post by: Zlika on November 18, 2016, 07:56:44 AM
The exit menu item is hardcoded in the flwm source. You can build your own flwm with it edited to something else.

You're right, and it is the "exittc" command that is called:
Code: [Select]
tc@box:/usr$ grep -r exittc *
(...)
local/bin/flwm_topside:exittc
tc@box:/usr$ which exittc
/usr/local/bin/exittc

So I just had to add a /usr/local/bin/exittc script with:
Code: [Select]
#!/bin/sh
sudo poweroff

and it works!

Thank you all for your help.
Title: Re: FLWM "Exit" menu does not shutdown the computer if Xprogs is not installed
Post by: nitram on November 18, 2016, 06:20:54 PM
Thanks for posting your simply elegant solution!