How to update Securities on Gnucash on Endless OS?

The applications on Endless OS are Flatpak packages. If you are using Gnucash to keep your Personal or Business Books of accounts and also maintain the Securities (Shares, Debentures, Mutual Funds etc.) you would have noticed that the Price Database can’t be updated in the Flatpak version of Gnucash. This is because Flatpak version of Gnucash does not include Finance::Quote module which works at the background to update the price database.

If you want to make it work on the Flatpak version you need to read this thread on this forum:
Running Ubuntu with Podman and build a Container modifying the instructions to suit your requirements.

First you need to know the Folder which contains the Gnucash Data Files. On my Computer I have put the files in “gnucash” Folder.

Download the needed image

podman image pull ubuntu:19.10

This will fetch the current stable release of Ubuntu and has Gnucash 3.7 which is same as on Endless OS.

Creating something like a share

We omit this step instead we use the Folder “gnucash” which contains the Gnucash data files.

Create your first container

podman run --interactive --tty --name mycontainer --volume /tmp/.X11-unix:/tmp/.X11-unix
–env DISPLAY --device /dev/dri --device /dev/snd --device /dev/input
–volume /etc/localtime:/etc/localtime:ro --volume /sysroot/home/$(whoami)/gnucash:/mnt ubuntu:19.10

Replace “gnucash” with the Folder in which you have data files.

This will create the container and open a terminal inside this container for doing your first configuration work.
root@d61c9266373d:/#
Now you can do various tasks like creating a user for you to use:

useradd  -d /home/egon -s /bin/bash egon
mkdir -p /home/egon
chmod -R 700 /home/egon
chown -R egon:users /home/egon

Replace egon with your username on Endless OS and leave this session by typing exit

Now we need to install gnucash in the Container.
podman start mycontainer

Login the Container as root:
podman exec --interactive --tty mycontainer /bin/bash

root@d61c9266373d:/#
apt update
apt install gnucash
This will take time since the original image is 75 MB only and Gnucash requires lot of dependencies on this image.

Type exit after gnucash is installed.

Now we need to write a script to update the securities in gnucash data file using the container.

#!/bin/bash

CONTAINER=mycontainer

podman ps | grep $CONTAINER 2>/dev/null 1>&2
if [ $? -ne 0 ]; then
podman start $CONTAINER
fi

docker exec -it mycontainer gnucash --add-price-quotes /mnt/myaccount.gnucash

podman stop $CONTAINER

Replace “myaccount” with the file name in your case.

At first, it will check if the container is running and start it if needed. Then the docker exec command will update the securities which will take some time. Finally it will stop the container.

Kamalakar

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.