Skip to content

main.sh issue #13

@yabo-boye

Description

@yabo-boye

i ran into an issue and grok ai provided a fix. i paste it here for dev reference.

https://github.com/jothi-prasath/gnomintosh

abo@odojo:~/gnomintosh$ sudo ./main.sh install
Cleaning directories...
Cloning required files...
Cloning into 'WhiteSur-gtk-theme'...
remote: Enumerating objects: 2971, done.
remote: Counting objects: 100% (2971/2971), done.
remote: Compressing objects: 100% (1941/1941), done.
remote: Total 2971 (delta 1068), reused 2603 (delta 998), pack-reused 0 (from 0)
Receiving objects: 100% (2971/2971), 4.08 MiB | 1.21 MiB/s, done.
Resolving deltas: 100% (1068/1068), done.
Cloning into 'WhiteSur-icon-theme'...
remote: Enumerating objects: 14813, done.
remote: Counting objects: 100% (14813/14813), done.
remote: Compressing objects: 100% (7882/7882), done.
remote: Total 14813 (delta 5316), reused 10867 (delta 3728), pack-reused 0 (from 0)
Receiving objects: 100% (14813/14813), 9.83 MiB | 843.00 KiB/s, done.
Resolving deltas: 100% (5316/5316), done.
Cloning into 'WhiteSur-cursors'...
remote: Enumerating objects: 322, done.
remote: Counting objects: 100% (322/322), done.
remote: Compressing objects: 100% (180/180), done.
remote: Total 322 (delta 149), reused 274 (delta 115), pack-reused 0 (from 0)
Receiving objects: 100% (322/322), 657.49 KiB | 1.30 MiB/s, done.
Resolving deltas: 100% (149/149), done.

Removing the old 'WhiteSur' themes...

Installing 'WhiteSur' themes in '/usr/share/themes'...

--->>> GTK | GNOME Shell | Cinnamon | Metacity | XFWM | Plank <<<---
Color variants : Dark
Theme variants : default
Opacity variants : normal;solid
Alt variants : normal
Scheme variants : standard
Start icon style : apple
Nautilus style : stable

                       ••••  

Done!

Do not run '--libadwaita' option with sudo!

Run 'WhiteSur-gtk-theme/install.sh --help' to explore more customization features!

Connecting 'WhiteSur' themes to your Flatpak...

Without options it will only install default themes

Found theme located at: /usr/share/themes/WhiteSur-Dark

Converting theme: WhiteSur-Dark...

Processing application org.gtk.Gtk3theme.WhiteSur-Dark
Saving AppStream /root/.cache/pakitheme/WhiteSur-Dark/build/files/share/app-info/xmls/org.gtk.Gtk3theme.WhiteSur-Dark.xml.gz
Done!
68a59e507febb6759286e69184bd5c68c18ccb4315cc37560ac802911bb955f6
bb4f733a0730998335a6b64bf8f91ae45e6302cab43241d99b531d360a42857c
Executing 'flatpak install -y --system /root/....' as root

    ID                                Branch   Op   Remote                Download
  1. [✓] org.gtk.Gtk3theme.WhiteSur-Dark 3.22 i whitesur-dark-origin 0 bytes

Installation complete.
Found theme located at: /usr/share/themes/WhiteSur-Dark-solid

Converting theme: WhiteSur-Dark-solid...

Processing application org.gtk.Gtk3theme.WhiteSur-Dark-solid
Saving AppStream /root/.cache/pakitheme/WhiteSur-Dark-solid/build/files/share/app-info/xmls/org.gtk.Gtk3theme.WhiteSur-Dark-solid.xml.gz
Done!
3775b3a810ef51cd352b87005016b802cbdb95d466bdb038506c8375bd0cc8e5
278c0280cfd71b31bbcafb5ac9898249b67252e70a46aa3e9452047f091d1cd8
Executing 'flatpak install -y --system /root/....' as root

    ID                                    Branch Op Remote                     Download
  1. [✓] org.gtk.Gtk3theme.WhiteSur-Dark-solid 3.22 i whitesur-dark-solid-origin 0 bytes

Installation complete.
Converting theme: WhiteSur-Light...

Processing application org.gtk.Gtk3theme.WhiteSur-Light
Saving AppStream /root/.cache/pakitheme/WhiteSur-Light/build/files/share/app-info/xmls/org.gtk.Gtk3theme.WhiteSur-Light.xml.gz
Done!
478a83e4d49f19ddc1e35b876e5b43fa5d8ce1d3a6fe19c1d982ac177712393d
8f0cc33e0bf0a8e49c435355391c20861562212965508a092d32dc006c9ef739
Executing 'flatpak install -y --system /root/....' as root

    ID                                 Branch  Op  Remote                 Download
  1. [✓] org.gtk.Gtk3theme.WhiteSur-Light 3.22 i whitesur-light-origin 0 bytes

Installation complete.
Converting theme: WhiteSur-Light-solid...

Processing application org.gtk.Gtk3theme.WhiteSur-Light-solid
Saving AppStream /root/.cache/pakitheme/WhiteSur-Light-solid/build/files/share/app-info/xmls/org.gtk.Gtk3theme.WhiteSur-Light-solid.xml.gz
Done!
fb72905acd747937493208f7d7af6c5f4c1e4b860ea9412dd4adb7bc393ffe71
d332e0b7eb1bdca99060ab97e5fbe4554d4e0b2a5730bd0011b3a914e521f8ce
Executing 'flatpak install -y --system /root/....' as root

    ID                                     Branch Op Remote                      Download
  1. [✓] org.gtk.Gtk3theme.WhiteSur-Light-solid 3.22 i whitesur-light-solid-origin 0 bytes

Installation complete.
Done! 'WhiteSur' theme has been connected to your Flatpak.

Installing 'bold' version...
Installing '/usr/share/icons/WhiteSur'...
gtk-update-icon-cache: Cache file created successfully.
Installing '/usr/share/icons/WhiteSur-light'...
gtk-update-icon-cache: Cache file created successfully.
Installing '/usr/share/icons/WhiteSur-dark'...
gtk-update-icon-cache: Cache file created successfully.
cp: cannot create regular file '/root/.local/share/fonts/': Not a directory

FIND THE ERROR AND FIX IT

From the output you provided, the error occurs near the end of the installation process:
text
cp: cannot create regular file '/root/.local/share/fonts/': Not a directory

This error indicates that the script is trying to copy a file into /root/.local/share/fonts/, but it fails because /root/.local/share/fonts/ is not a directory. This could happen if:

The directory does not exist yet, and the script assumes it does without creating it first.
There’s a typo or misconfiguration in the script pointing to the wrong path.
The script lacks the logic to ensure the directory exists before copying files into it.

Likely Cause

The main.sh script (or one of its sub-scripts) is attempting to install font files into /root/.local/share/fonts/, but this directory hasn’t been created during the execution with sudo. When running as root (via sudo), the .local/share/fonts/ directory might not exist in /root/ by default, unlike a regular user’s home directory where it might already be set up.
Fix

To resolve this, you need to ensure the directory /root/.local/share/fonts/ exists before the script attempts to copy files into it. You can either:

Modify the script to create the directory if it doesn’t exist.
Manually create the directory before running the script again.
Run the script differently to avoid using /root/ as the target.

Option 1: Modify the Script

Since the issue occurs in the main.sh script (or a script it calls), you can add a check to create the directory. Here’s how you might fix it:

Open the main.sh script (or the relevant sub-script if you can identify it) in a text editor:
bash

nano main.sh
Look for the section where it copies files to /root/.local/share/fonts/ (likely a cp command). It might look something like:
bash
cp some_font_file /root/.local/share/fonts/
Add a command to create the directory if it doesn’t exist before the cp command:
bash
mkdir -p /root/.local/share/fonts/
cp some_font_file /root/.local/share/fonts/
The -p flag ensures the command creates parent directories as needed and doesn’t throw an error if the directory already exists.
Save the file and re-run the script:
bash

sudo ./main.sh install

Option 2: Manually Create the Directory

If you don’t want to modify the script or can’t easily find the exact spot, you can manually create the directory before running the script:

Create the directory:
bash

sudo mkdir -p /root/.local/share/fonts/
Re-run the script:
bash

sudo ./main.sh install

This should allow the script to proceed without encountering the error.
Option 3: Run Without sudo (if applicable)

The script might not need to run with sudo for all operations, and running it as a regular user could avoid this issue entirely (since ~/.local/share/fonts/ might already exist in your user’s home directory). However, since the script installs themes to /usr/share/themes/ and updates system-wide Flatpak settings, sudo is likely required for most of its functionality. Still, you could try:
bash
./main.sh install

If it fails due to permissions, stick with Option 1 or 2.
Recommendation

Option 2 is the quickest fix—manually create the directory and re-run the script. If you plan to reuse or share this script, Option 1 is better for a permanent solution, as it makes the script more robust.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions