WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Auto start X program from TCE  (Read 2497 times)

Offline ikeji

  • Newbie
  • *
  • Posts: 12
Auto start X program from TCE
« on: March 02, 2016, 02:06:22 AM »
Hi,

I want to create package that uses X and start automatically.
What's the correct way to do this?

Option A
Do something like "echo 'newprog&' >> /home/tc/.xsession" in tce.installed.

Option B
Include a file /home/tc/.X.d/newprog.sh

I feel both A and B is not good because it's will be backuped by filetool.sh.
Is there any good way to do this?

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14801
Re: Auto start X program from TCE
« Reply #1 on: March 02, 2016, 02:09:39 AM »
From the FAQ:
Quote
How do I start X apps on boot?
Add them to files in /home/tc/.X.d, one per file, backgrounded. Here's how to start Opera at boot:

opera &

You can add files to /opt/.xfiletool.lst to exclude them from your backup
« Last Edit: March 02, 2016, 02:13:51 AM by Juanito »

Offline ikeji

  • Newbie
  • *
  • Posts: 12
Re: Auto start X program from TCE
« Reply #2 on: March 02, 2016, 01:08:40 PM »
You can add files to /opt/.xfiletool.lst to exclude them from your backup
Did you prefer to add to /opt/.xfiletool.lst from tce.installed script?
I think it will be overwritten by restore step.

Offline gerald_clark

  • TinyCore Moderator
  • Hero Member
  • *****
  • Posts: 4254
Re: Auto start X program from TCE
« Reply #3 on: March 02, 2016, 03:55:01 PM »
Why are you worried about not backing up the file?

Offline Alatun

  • Newbie
  • *
  • Posts: 41
Re: Auto start X program from TCE
« Reply #4 on: March 16, 2016, 06:52:07 AM »
I had a similar problem, but I did not want anything that needs a writable disk (burnable to CD). So I repackaged TinyCore. To keep my changes separate from the original files, I did not modify the original files, but created a script that will patch the original files.

Another advantage of this approach is that I added a boot option for this. So I can boot the unmodified version or a patched version.

A script that will patch ".xsession" may look like this. I'm no sed expert, maybe there are better ways to do this. But it works.

Code: [Select]
#!/bin/sh
sed -i '
/"$DESKTOP"/ i if [ -s /etc/sysconfig/rdesktop ]; then
/"$DESKTOP"/ i XIT=1
/"$DESKTOP"/ i while [ $XIT -gt 0 ]; do
/"$DESKTOP"/ i /usr/local/bin/startrdesktop
/"$DESKTOP"/ i /usr/local/bin/exittc_a;
/"$DESKTOP"/ i XIT=$?;
/"$DESKTOP"/ i done
/"$DESKTOP"/ i fi
' /home/"$USER"/.xsession

It starts a RDP client. If the RDP client terminates a modified version of "exittc" will ask the user, if he likes to shutdown or restart the RDP client.