All Google fonts as a software package. Topic is solved

Suggestions for features and software you would like to see in DietPi, goes here.
Post Reply
maya95
Posts: 58
Joined: Tue Apr 20, 2021 12:20 pm

All Google fonts as a software package.

Post by maya95 »

Someone wrote a script here. Hope it can be integrated.

https://gist.github.com/keeferrourke/d2 ... e-fonts-sh
maya95
Posts: 58
Joined: Tue Apr 20, 2021 12:20 pm

Re: All Google fonts as a software package.

Post by maya95 »

I tried to run above script line by line, but it seems ran out of space and got a lot of errors after git clone $giturl command.

I expanded the VM's disk size to 80G beforehand. The VM got 2GB memory.

Code: Select all

error: unable to write file ofl/trochut/OFL.txt
error: unable to write file ofl/trochut/Trochut-Bold.ttf
error: unable to write file ofl/trochut/Trochut-Italic.ttf
error: unable to write file ofl/trochut/Trochut-Regular.ttf
error: unable to write file ofl/truculenta/DESCRIPTION.en_us.html
error: unable to write file ofl/truculenta/METADATA.pb
error: unable to write file ofl/truculenta/OFL.txt
error: unable to write file ofl/truculenta/Truculenta[opsz,wdth,wght].ttf
.
.
.
error: unable to write file ufl/ubuntumono/UFL.txt
error: unable to write file ufl/ubuntumono/UbuntuMono-Bold.ttf
error: unable to write file ufl/ubuntumono/UbuntuMono-BoldItalic.ttf
error: unable to write file ufl/ubuntumono/UbuntuMono-Italic.ttf
error: unable to write file ufl/ubuntumono/UbuntuMono-Regular.ttf
Checking out files: 100% (10823/10823), done.
fatal: unable to checkout working tree
warning: Clone succeeded, but checkout failed.
You can inspect what was checked out with 'git status'
and retry the checkout with 'git checkout -f HEAD'

root@DietPiVM:/tmp/google-fonts# 

After reboot, some services stop running. I couldn't even run Dietpi-Config and it exited immediately.

Image

Image
maya95
Posts: 58
Joined: Tue Apr 20, 2021 12:20 pm

Re: All Google fonts as a software package.

Post by maya95 »

Tried with original VM 8GB disk , also given 2GM RAM. Change /var/swap from 1027MB to 2048MB with Dietpi-Drive_Manager, same result.

many write errors when running git clone command with the script.
User avatar
MichaIng
Site Admin
Posts: 2987
Joined: Sat Nov 18, 2017 6:21 pm

Re: All Google fonts as a software package.

Post by MichaIng »

Probably the file system is damaged, as it switched to read-only.

Please try to either scan the drive on another Linux system or have it scanned at reboot:

Code: Select all

> forcefsck
reboot
# then after reboot
journalctl -t systemd-fsck
User avatar
Joulinar
Posts: 4783
Joined: Sat Nov 16, 2019 12:49 am

Re: All Google fonts as a software package.

Post by Joulinar »

@MichaIng
This is a VM I guess :)


@maya95
can you try to clone git somewhere else than /tmp as this is an own mountpoint and a tmpfs file system. It has no relation to the size of the root file system
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
maya95
Posts: 58
Joined: Tue Apr 20, 2021 12:20 pm

Re: All Google fonts as a software package.

Post by maya95 »

Yep, I run DietPi in a VM.

===

I ran mount -o remount,rw / and the file system is back.

Linux's file system is really confusing for a Windows guy.

I change /tmp to /temp in the script and the script ran most part OK. But got some errors:

Code: Select all

Receiving objects: 100% (38116/38116), 1016.69 MiB | 1.76 MiB/s, done.
Resolving deltas: 100% (18744/18744), done.
Checking out files: 100% (10825/10825), done.
Installing fonts...
Cleaning up...
...
find: paths must precede expression: `;'
find: paths must precede expression: `;'
...
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Package 'fonts-roboto' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Updating font-cache...
...
/etc/scripts/install-google-fonts.sh: line 31: unexpected EOF while looking for matching `"'
/etc/scripts/install-google-fonts.sh: line 32: syntax error: unexpected end of file
===
questions:
1.
Don't quite understand the -Dm644 and \; part in the bash command:
sudo find /temp/google-fonts -type f -name "*.ttf" -exec install -Dm644 {} $pkgdir \;
2.
What exactly is the command that I can increase the size of tmpfs /tmp from 1G to 2G?
3.
Is Mate Font Viewer always slow? It took almost 2 minutes to display the fonts installed in the system.
(Found Google fonts took 1.5GB space though)
User avatar
Joulinar
Posts: 4783
Joined: Sat Nov 16, 2019 12:49 am

Re: All Google fonts as a software package.

Post by Joulinar »

size of /tmp depends on the available physical memory + swap. It is defined in /etc/fstab
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
User avatar
MichaIng
Site Admin
Posts: 2987
Joined: Sat Nov 18, 2017 6:21 pm

Re: All Google fonts as a software package.

Post by MichaIng »

It seems the script is a little buggy.
  • -Dm644 is the permission mode of the target file, i.e. in this case it means that only the user which runs the script (in this case root, because of sudo) shall have read(4)+write(2) access to the files (4+2=6) while everyone else (other users in the same group and other users not in the same group) shall have read access (4) only.
  • \; means that every file that is returned by the find command should be handed over to an individual install call. The opposed option would be +, which would append all returned file paths to a single install command. That would work as well, but I'm not sure how clean the state is when then one file fails to be copied in the middle.
  • What I would try is to double quote $pkgdir in the find > install command.
  • To increase the /tmp size, edit /etc/fstab and replace size=... with what you require. Then mount -o remount /tmp to apply it. But note that of course the maximum usable size is limited by your memory size. By default DietPi applies a size of 50% RAM+swap to /tmp. When you double /tmp, then it would be possible to fill your whole available memory only with /tmp content. So it might make sense to increase the swap size then: /boot/dietpi/func/dietpi-set_swapfile 2048 sets the swap file size to 2048 MiB and will automatically adjust /tmp size to match 50% of the combined RAM+swap size.
  • Now sure how fast a font user should usually be. Probably the limited GPU memory size of the VM is an issue. Check the VMs memory GPU and probably you can change the emulated GPU hardware as well. On our VirtualBox image e.g. we apply low GPU memory and the older VBoxVGA, while VMSVGA and like 64 MiB GPU memory are likely required to get a smooth desktop experience.
Post Reply