Anki: improving memory
- francois
- Contributor
- Posts: 6514
- Joined: 28 Dec 2010, 14:25
- Distribution: xfce plank porteus nemesis
- Location: Le printemps, le printemps, le printemps... ... l'hiver s'essoufle.
Anki: improving memory
@rava:
If you get to work with it, please comment.
If you get to work with it, please comment.
Prendre son temps, profiter de celui qui passe.
-
- Warlord
- Posts: 787
- Joined: 04 Jan 2014, 04:27
- Distribution: Porteus 5.0 x64 OpenBox
- Location: NZ
- Contact:
Anki: improving memory
francois, Before you started a new thread there had already been a module request thread for it Anki - Flash Card program to help studying ;-) where we had some discussion a bit similar to yours and some success. At least I successfully ran it in the end just to find out that I don't really like it. We of course can freely create multiple threads on the same topic or the same App, but I hope it's known how to find out previous threads on the same topic: https://www.google.com/search?q=site%3A ... s.org+Anki
- Rava
- Contributor
- Posts: 5424
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
Anki: improving memory
And probably make an module out of it, since the binary itself is not enough.
And uncompressed into a folder it is rather large - 440 MB while the anki-23.10-linux-qt5.tar.zst itself is 121 MB.
Though how much can be trimmed off from the extracted anki-23.10-linux-qt5 remains to be seen.
How did you install it?
Created a module out of the extracted anki-23.10-linux-qt5.tar.zst ?
Cheers!
Yours Rava
Yours Rava
Anki: improving memory
Hi Rava,
4 commands:
Worked for me (Porteux Xfce)
4 commands:
Code: Select all
wget https://github.com/ankitects/anki/releases/download/23.10/anki-23.10-linux-qt5.tar.zst
tar -I zstd -xf anki-23.10-linux-qt5.tar.zst
cd anki-23.10-linux-qt5
./anki
- Rava
- Contributor
- Posts: 5424
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
Anki: improving memory
about making anki into a module, I ponder if using its install.sh to our advantage would work?
I browsed through it and found this:that means, when I create an empty folder on a Linux file system, let's say the extracted folder is here
/mnt/sda2/tmp/anki-23.10-linux-qt5
and I create this folder as the target "fake root" for its install:
/mnt/sda2/tmp/anki-23.10-linux-qt5_rava
go into /mnt/sda2/tmp/anki-23.10-linux-qt5 and execute ./install.sh like so as root:
it should move all files from /mnt/sda2/tmp/anki-23.10-linux-qt5 into /mnt/sda2/tmp/anki-23.10-linux-qt5_rava/usr/local ?
Your thoughts?
The full install.sh :
Not sure how to implement this line
I think it should be put into one of slackware's post-install scripts, yes?
I browsed through it and found this:
Code: Select all
if [ "$PREFIX" = "" ]; then
PREFIX=/usr/local
fi
/mnt/sda2/tmp/anki-23.10-linux-qt5
and I create this folder as the target "fake root" for its install:
/mnt/sda2/tmp/anki-23.10-linux-qt5_rava
go into /mnt/sda2/tmp/anki-23.10-linux-qt5 and execute ./install.sh like so as root:
Code: Select all
PREFIX=/mnt/sda2/tmp/anki-23.10-linux-qt5_rava/usr/local ./install.sh
Your thoughts?
The full install.sh :
Code: Select all
#!/bin/bash
set -e
if [ "$(dirname "$(realpath "$0")")" != "$(realpath "$PWD")" ]; then
echo "Please run from the folder install.sh is in."
exit 1
fi
if [ "$PREFIX" = "" ]; then
PREFIX=/usr/local
fi
rm -rf "$PREFIX"/share/anki "$PREFIX"/bin/anki
mkdir -p "$PREFIX"/share/anki
cp -av --no-preserve=owner,context -- * "$PREFIX"/share/anki/
mkdir -p "$PREFIX"/bin
ln -sf "$PREFIX"/share/anki/anki "$PREFIX"/bin/anki
# fix a previous packaging issue where we created this as a file
(test -f "$PREFIX"/share/applications && rm "$PREFIX"/share/applications)||true
mkdir -p "$PREFIX"/share/pixmaps
mkdir -p "$PREFIX"/share/applications
mkdir -p "$PREFIX"/share/man/man1
cd "$PREFIX"/share/anki && (\
mv -Z anki.xpm anki.png "$PREFIX"/share/pixmaps/;\
mv -Z anki.desktop "$PREFIX"/share/applications/;\
mv -Z anki.1 "$PREFIX"/share/man/man1/)
xdg-mime install anki.xml --novendor
xdg-mime default anki.desktop application/x-colpkg
xdg-mime default anki.desktop application/x-apkg
xdg-mime default anki.desktop application/x-ankiaddon
rm install.sh
echo "Install complete. Type 'anki' to run."
Code: Select all
xdg-mime install anki.xml --novendor
Cheers!
Yours Rava
Yours Rava
-
- Warlord
- Posts: 787
- Joined: 04 Jan 2014, 04:27
- Distribution: Porteus 5.0 x64 OpenBox
- Location: NZ
- Contact:
Anki: improving memory
For me too: see the old thread: Anki - Flash Card program to help studying ;-) (Post by rych #94779) where we ran it under root as well, either with the Qt6 or Qt5. No need to "install.sh". No need to turn the bundle into a module. If you want to have it compressed then keep it as the archive (or .squashfs) and expand (or mount) it just before use. I'm going to redirect that thread to here so that people don't post there by mistake: the community have chosen to continue, after some duplication, the Anki discussion here for some reason

- Rava
- Contributor
- Posts: 5424
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
Anki: improving memory
Anyone suggestions for the parameters for creating a .squashfs out of the extracted tar ?
Cheers!
Yours Rava
Yours Rava
-
- Warlord
- Posts: 787
- Joined: 04 Jan 2014, 04:27
- Distribution: Porteus 5.0 x64 OpenBox
- Location: NZ
- Contact:
Anki: improving memory
We talked about this one year ago:
why modules (Post by rych #91468)
why modules (Post by rych #91537)
Of course you first extract tar into a folder and then apply a simple command
Code: Select all
mksquashfs $1 $1.sqfs -noappend -comp zstd -b 256K
- Rava
- Contributor
- Posts: 5424
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
Anki: improving memory
^
Thanks.
And one could experiment with the block size, if e.g. -b 512K would make the resulting file significantly smaller.
I will browse the two posts and make me a help.mksquashfs script that will outline the basics.
Thanks.

I will browse the two posts and make me a help.mksquashfs script that will outline the basics.
- Rava
- Contributor
- Posts: 5424
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
Anki: improving memory
^ How embarrassing, I totally forgot my participation in the why modules thread.
Anyhow, now I did it. Done 3 instances of creating a .sqfs file:
Results:
Seems the standard of using -b 256K gives the best results.
Added in 7 minutes 20 seconds:
And now for thinking of a way to robust mount and umount that (since it is only a mount, one could use /tmp/ as base folder for the creation of the folder to be mounted into, and also the base for the symlink to the binary in that folder), and also to create the needed symlinks into e.g. /usr/local/bin .
And when umounting it, also delete the created symlinks to the binary. And while I am at it, I make it so that the module name is allowed to have whitespace.
At least I can carry on with the debugging attempts from my very own posts in why modules; so no need to start from scratch.
Anyhow, now I did it. Done 3 instances of creating a .sqfs file:
Code: Select all
mksquashfs anki-23.10-linux-qt5 anki-23.10-linux-qt5-128K.sqfs -noappend -comp zstd -b 128K
# and
mksquashfs anki-23.10-linux-qt5 anki-23.10-linux-qt5-256K.sqfs -noappend -comp zstd -b 256K
# and
mksquashfs anki-23.10-linux-qt5 anki-23.10-linux-qt5-512K.sqfs -noappend -comp zstd -b 512K
Code: Select all
root@rava:/8/tmp# /bin/ls -o --time-style=long-iso --quoting-style=shell *.sqfs| cut -c 19-$(expr 18 + $(tput cols))
153780224 2023-11-06 04:37 anki-23.10-linux-qt5-128K.sqfs
149106688 2023-11-06 04:34 anki-23.10-linux-qt5-256K.sqfs
157491200 2023-11-06 04:35 anki-23.10-linux-qt5-512K.sqfs
Added in 7 minutes 20 seconds:
And now for thinking of a way to robust mount and umount that (since it is only a mount, one could use /tmp/ as base folder for the creation of the folder to be mounted into, and also the base for the symlink to the binary in that folder), and also to create the needed symlinks into e.g. /usr/local/bin .
And when umounting it, also delete the created symlinks to the binary. And while I am at it, I make it so that the module name is allowed to have whitespace.
At least I can carry on with the debugging attempts from my very own posts in why modules; so no need to start from scratch.

-
- Warlord
- Posts: 787
- Joined: 04 Jan 2014, 04:27
- Distribution: Porteus 5.0 x64 OpenBox
- Location: NZ
- Contact:
Anki: improving memory
In the same place where you keep those .sqfs compressed images (won't call them modules as that name is taken), why not make a namesake folder unless it exists already and simply:
Code: Select all
mount HugeSoftware.sqfs HugeSoftware
On restart those unmount automatically.
In my experiments I found, unsurprisingly as this is the whole promise of SquashFS, that reading from such a mounted compressed image feels faster than decompressing the whole archive all at once and work with all its extracted data as usual via ext4 -- not to mention the time and SIZE such expansion would take
- Rava
- Contributor
- Posts: 5424
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
Anki: improving memory
About the why modules thread: I re-read it and for some reason you not implemented the small changes to make your script work with filenames containing whitespace.
mkdir /tmp/filename
mount /path/to/filename.sqfs /tmp/filename
ln -s /tmp/filename/BINARY /usr/local/bin/BINARY
and for the reverse:
killall BINARY
rm /usr/local/bin/BINARY
umount /tmp/filename
Why use /tmp instead of the folder where the .sqfs sits?
because that would be unnecessary writing to a folder that is meant as temp. Since it is only a mount point it will take no space in /tmp/ (aside from the very small space a folder takes)
And finally: to make it more robust. What if the user tries moving or renaming /path/to/filename.sqfs while it is mounted? Would the umount part still find the folder to umount? But when it's always the same base folder /tmp/ and for the same .sqfs compressed image always the same mount point ( /tmp/filename/ ) umounting should be more reliable.
What I cannot envision is how to determine which symlinks to create when there are more than one binary in /tmp/filename/ to be found.
Therefore, in my view, it would be a good thing when you have a script that does extract the filename (=filename sans .sqfs)rych wrote: ↑06 Nov 2023, 15:42In my experiments I found, unsurprisingly as this is the whole promise of SquashFS, that reading from such a mounted compressed image feels faster than decompressing the whole archive all at once and work with all its extracted data as usual via ext4 -- not to mention the time and SIZE such expansion would take
mkdir /tmp/filename
mount /path/to/filename.sqfs /tmp/filename
ln -s /tmp/filename/BINARY /usr/local/bin/BINARY
and for the reverse:
killall BINARY
rm /usr/local/bin/BINARY
umount /tmp/filename
Why use /tmp instead of the folder where the .sqfs sits?
because that would be unnecessary writing to a folder that is meant as temp. Since it is only a mount point it will take no space in /tmp/ (aside from the very small space a folder takes)
And finally: to make it more robust. What if the user tries moving or renaming /path/to/filename.sqfs while it is mounted? Would the umount part still find the folder to umount? But when it's always the same base folder /tmp/ and for the same .sqfs compressed image always the same mount point ( /tmp/filename/ ) umounting should be more reliable.
What I cannot envision is how to determine which symlinks to create when there are more than one binary in /tmp/filename/ to be found.
Cheers!
Yours Rava
Yours Rava
- francois
- Contributor
- Posts: 6514
- Joined: 28 Dec 2010, 14:25
- Distribution: xfce plank porteus nemesis
- Location: Le printemps, le printemps, le printemps... ... l'hiver s'essoufle.
Anki: improving memory
@rava:
Did you used the software?
Did you used the software?

Prendre son temps, profiter de celui qui passe.
- Rava
- Contributor
- Posts: 5424
- Joined: 11 Jan 2011, 02:46
- Distribution: XFCE 5.01 x86_64 + 4.0 i586
- Location: Forests of Germany
Anki: improving memory
I would if I knew where to get the learning packages or whatever you call it.
Cheers!
Yours Rava
Yours Rava