WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: persistent data  (Read 2537 times)

Offline michaelkj77

  • Newbie
  • *
  • Posts: 11
persistent data
« on: October 11, 2010, 12:57:41 PM »
I have TC booting from a compact flash drive.  I also have an application on the compact flash (/mnt/hda2/tce/options) called xastir.  Xastir displays maps and locations of items.  My maps are on the compact flash as well in /mnt/hda2/tce/maps.  However, when it is loaded, xastir expects to find maps in /usr/local/share/xastir/maps. 

At the command line, I can create a symbolic link like this:

ln -s /mnt/hda2/tce/maps /usr/local/share/xastir/maps/cfmaps

which works fine, but I need that link before xastir starts otherwise the app's startup configuration doesn't find the maps and removes them from its map list. 

I have tried adding the symbolic link to the /home/tc/.X.d/xastir file ahead of starting xastir, even with a sudo su ahead of it, but the link isn't created.  What is the correct way to create this link before starting the program?

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: persistent data
« Reply #1 on: October 11, 2010, 01:04:41 PM »
My advice is to choose an OSM (OpenStreetMap) in the map menu. In such case xastir will load map online automatically. No configuration needed other than to choose an OSM map. Downloaded maps are cached and saved in your home directory. Play a bit with OSM maps to find your favourite.

As downloaded maps are in home dir, theay will be saved and restored using backup.

Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline michaelkj77

  • Newbie
  • *
  • Posts: 11
Re: persistent data
« Reply #2 on: October 11, 2010, 02:43:11 PM »
BMarkis...thank you very much for your reply.  I see your name on the Xastir tcz so I appreciate your input very much.  Unfortunately, the computer is a little 12-volt DC computer and will be running in my car.  I'll be using Xastir for emergency management deployment so I won't have an internet connection.  I failed to mention that up front.  Sorry.  That would be a better solution though if I were able to get maps that way. 

I also tried replacing the /usr/local/bin/xastir command in the /home/tc/.X.d/xastir file with a call to a shell script, and in that shell script I tried to make the symbolic link and then start Xastir.  Same result.  Seems for some reason the OS won't create a symbolic link inside one of the .X.d startup files.  Still working on it though. 

One question, if I make the symbolic link (/usr/local/share/xastir/maps/cfmaps) and then put that path in my /opts/.filelist.lst file to be persistent, would that work?  Would just the symbolic link be preserved, or would everything the symbolic link points to get zipped up in the mydata file too?  I don't want to preserve the maps.  They're already on the compact flash.  I just want to preserve the link.  Thanks.


Offline michaelkj77

  • Newbie
  • *
  • Posts: 11
Re: persistent data
« Reply #3 on: October 11, 2010, 02:46:36 PM »
BMarkus, I might have misunderstood your previous reply.  I understood your message to say I should rely on online maps which I can't do because I won't have an internet connection.  If however you were suggesting placing maps in my home directory to make them persistent, I can do that.  If possible though, I would rather access the maps from the compact flash to preserve memory.  Thanks again for your help. 

Offline tinypoodle

  • Hero Member
  • *****
  • Posts: 3857
Re: persistent data
« Reply #4 on: October 11, 2010, 02:53:53 PM »
One question, if I make the symbolic link (/usr/local/share/xastir/maps/cfmaps) and then put that path in my /opts/.filelist.lst file to be persistent, would that work?  Would just the symbolic link be preserved, or would everything the symbolic link points to get zipped up in the mydata file too?  I don't want to preserve the maps.  They're already on the compact flash.  I just want to preserve the link.  Thanks.

That should work fine.
"Software gets slower faster than hardware gets faster." Niklaus Wirth - A Plea for Lean Software (1995)

Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: persistent data
« Reply #5 on: October 11, 2010, 03:46:14 PM »
OK, I see now the point. The best is to put

Quote
ln -s /mnt/hda2/tce/maps /usr/local/share/xastir/maps/cfmaps

to /opt/bootlocal.sh file which is executed after extensions loaded.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline michaelkj77

  • Newbie
  • *
  • Posts: 11
Re: persistent data
« Reply #6 on: October 11, 2010, 05:51:33 PM »
getting closer, but not there yet.  I've moved the command

ln -s /mnt/hda2/tce/maps /usr/local/share/xastir/maps/cfmaps

to /opt/bootlocal.sh. 

After booting, the symbolic link doesn't exist.  If I execute the script bootlocal.sh at the command prompt as user tc, there is a "permission denied" error when the ln -s command is executed.  If I run the script bootlocal.sh as root, it works. 

In the /opt directory, the bootlocal.sh script is owned by root so I would think it is running as root, but that doesn't seem to be the case.  Still researching and trying to figure it out but appreciate any assistance. 

Offline michaelkj77

  • Newbie
  • *
  • Posts: 11
Re: persistent data
« Reply #7 on: October 11, 2010, 06:33:03 PM »
A little more info:  /home/tc/.X.d/xastir now contains only the tce-load -i xastir command.  Nothing else.  The /opt/bootlocal.sh script contains:

sudo ln -s /mnt/hda2/tce/maps /usr/local/share/xastir/maps/cfmaps
/usr/bin/xastir

When TC boots, the .../.X.d/xastir script loads the xastir directories, no problem.  The /opt/bootlocal.sh script however doesn't seem to run, or must encounter some error because the symbolic link isn't created and xastir doesn't start.  Interesting thing though, I can run the bootlocal.sh script at a command prompt as user tc or root, and it works. 

Offline maro

  • Hero Member
  • *****
  • Posts: 1228
Re: persistent data
« Reply #8 on: October 12, 2010, 12:26:36 AM »
I can't help you with your application specific issues, but:
  • the '/opt/bootlocal.sh' file gets executed by user 'root' as part of the boot process, so you will not need 'sudo' (mind you when you want to execute it as user 'tc' you better use sudo /opt/bootlocal.sh)
  • as a quick test I've tried something fairly similar to what you are trying to do and added
      ln -s $( cat /opt/.tce_dir ) /tmp/tce-$( basename $0 | sed -e 's#^\.##' -e 's#\.sh$##' )
    to '/opt/bootlocal.sh' and put the same into '.X.d/try.sh'
    I end up with:
Code: [Select]
tc@box:~$ ls -l /tmp/tce-*
lrwxrwxrwx    1 root     root            13 Oct 12 07:15 /tmp/tce-bootlocal -> /mnt/hda1/tce/
lrwxrwxrwx    1 tc       staff           13 Oct 12 07:15 /tmp/tce-xsession -> /mnt/hda1/tce/
    and that is proof enough for myself that you could put an 'ln -s ...' in either type of startup file.

Offline ^thehatsrule^

  • Administrator
  • Hero Member
  • *****
  • Posts: 1726
Re: persistent data
« Reply #9 on: October 17, 2010, 11:57:24 AM »
bootlocal is started during boot (as root, for non-X) while .X.d entries are done after boot during X startup (as current user, for X).

So moving the /usr/bin/xastir part to .X.d is probably what you want.  Side note: you could just have xastir