Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation of Clifm fails #1195

Closed
leo-arch opened this issue Dec 9, 2024 · 34 comments · Fixed by #1198
Closed

Installation of Clifm fails #1195

leo-arch opened this issue Dec 9, 2024 · 34 comments · Fixed by #1198

Comments

@leo-arch
Copy link

leo-arch commented Dec 9, 2024

Hi,

tried to install clifm (as a regular user) and failed. Here's the output:

$ am -i clifm
============================================================================

                  START OF ALL INSTALLATION PROCESSES

============================================================================

 ◆ "CLIFM": starting installation script

clifm-1.22-linux-x86_64.tar. 100%[================================================================>]  604.59K    --.-KB/s    in 0.08s
chmod: cannot access './clifm': No such file or directory

 "CLIFM" INSTALLED (2 MB OF DISK SPACE)
____________________________________________________________________________
============================================================================

                  END OF ALL INSTALLATION PROCESSES

             The following new programs have been installed:

 ◆ clifm 1.22

============================================================================

Files are properly installed in /opt/clifm/, but no symlink is created in /usr/local/bin/, nor anywhere else (which(1) report nothing for clifm after installation).

In case it matters, am -f lists clifm as installed.

Possible solution

The offending lines of the install script seem to be these:

chmod a+x ./$APP || exit 1

# LINK TO PATH
ln -s "/opt/$APP/$APP" "/usr/local/bin/$APP"

At this point of execution, the script is at /opt/clifm, whereas the executable file is in /opt/clifm/bin. Changing the above lines to this should make it work:

chmod a+x ./bin/$APP || exit 1

# LINK TO PATH
ln -s "/opt/$APP/bin/$APP" "/usr/local/bin/$APP"

I am not sure, since I don't know how to install a program using a custom install script.

@ivan-hc ivan-hc closed this as completed in c116143 Dec 9, 2024
@ivan-hc
Copy link
Owner

ivan-hc commented Dec 9, 2024

hi, thank you for this bug report, just fixed

@leo-arch
Copy link
Author

leo-arch commented Dec 9, 2024

Hey, that was quick! Thanks @ivan-hc.

One more thing. Clifm requires data files to function properly. These are in /opt/clifm/files, and should be linked to /usr/local/share/clifm

chmod a+x ./bin/$APP || exit 1

# LINK TO PATH
ln -s "/opt/$APP/bin/$APP" "/usr/local/bin/$APP"
# LINK DATA FILES
ln -s "/opt/$APP/files" "/usr/local/share/$APP"

Also, the symlink should be added to the remove script:

[ -n "$APP" ] && mkdir -p "/opt/$APP/tmp" "/opt/$APP/icons" && cd "/opt/$APP/tmp" || exit 1
printf "#!/bin/sh\nset -e\nrm -f /usr/local/bin/$APP\nrm -R -f /opt/$APP" > ../remove
printf '\n%s' "rm -f /usr/local/share/$APP" >> ../remove
printf '\n%s' "rm -f /usr/local/share/applications/$APP-AM.desktop" >> ../remove

ivan-hc added a commit that referenced this issue Dec 9, 2024
@ivan-hc
Copy link
Owner

ivan-hc commented Dec 9, 2024

I think this should be ok, I have tested with bot AM and AppMan

@Samueru-sama
Copy link
Contributor

One more thing. Clifm requires data files to function properly. These are in /opt/clifm/files, and should be linked to /usr/local/share/clifm

Does it at least check $XDG_DATA_DIRS?

https://specifications.freedesktop.org/basedir-spec/latest/

$XDG_DATA_DIRS defines the preference-ordered set of base directories to search for data files in addition to the $XDG_DATA_HOME base directory. The directories in $XDG_DATA_DIRS should be separated with a colon ':'.

If $XDG_DATA_DIRS is either not set or empty, a value equal to /usr/local/share/:/usr/share/ should be used.


Putting the files /usr/local/share isn't ideal because it would only work for AM and not appman (appman doesn't have elevated rights to do so). So this is something that the application instead should look for.

If the app checks XDG_DATA_DIRS then shipping it as an appimage is all that needs to be done, in the AppRun you can set $XDG_DATA_DIRS to include the bundled data files.

@ivan-hc
Copy link
Owner

ivan-hc commented Dec 9, 2024

@Samueru-sama I have done the test with both AM and AppMan, all it does is to symlink the "files" directory in /usr/local/share or ~/.local/share, as "clifm". No issues at all.

To be honest, I tried in first to test it as an AppImage, because I don't like to involve different directories out of the ones in the scheme I adopt normally. Anyway, I've done an ecception for this, since I was unable to made it work standalone.

If you have a better idea, you're wellcome.

Putting the files /usr/local/share isn't ideal because it would only work for AM and not appman (appman doesn't have elevated rights to do so). So this is something that the application instead should look for.

People using more accounts on the same machine would have the same app working on different configurations. AppMan is custom, AM is system wide installed to be shared among the accounts.

@Samueru-sama
Copy link
Contributor

Alright, if it works when the files are in ~/.local/share then no problem, it means it checks $XDG_DATA_HOME.

with that said application files in $XDG_DATA_HOME is not something that should be removed automatically when uninstalling the app, no idea if this happens just pointing it out.

@ivan-hc
Copy link
Owner

ivan-hc commented Dec 9, 2024

the only sources on how the app should be instlalled are in the fficial documentation, through make or using the AUR in Arch Linux.

@leo-arch
Copy link
Author

leo-arch commented Dec 9, 2024

It works out of the box now. Thank you guys for your work! I'll add am as an alternative install procedure to clifm's documentation.

@ivan-hc
Copy link
Owner

ivan-hc commented Dec 9, 2024

@leo-arch I was so busy solving this problem that even when I checked the source was correct, I didn't realize you were the developer XD Thanks!

@leo-arch
Copy link
Author

leo-arch commented Dec 9, 2024

You're welcome @ivan-hc! Keep up the good work. This is a great app.

@leo-arch
Copy link
Author

I'll add am as an alternative install procedure to clifm's documentation.

Done.

@leo-arch
Copy link
Author

leo-arch commented Dec 10, 2024

If the app checks XDG_DATA_DIRS then shipping it as an appimage is all that needs to be done, in the AppRun you can set $XDG_DATA_DIRS to include the bundled data files.

With the latest commit (leo-arch/clifm@1218107) clifm explicitly checks $XDG_DATA_HOME and $XDG_DATA_DIRS when attempting to set the data directory.

@ivan-hc
Copy link
Owner

ivan-hc commented Dec 10, 2024

Thank you @leo-arch

I have seen you have specified for x86_64... are there also other portable versions for other architectures? AM can support all of them.

@leo-arch
Copy link
Author

That's cool. But no, for the time being we provide precompiled binaries only for x86_64.

@ivan-hc
Copy link
Owner

ivan-hc commented Dec 10, 2024

OK, if you need it, let me know, I will create a dedicated script for each architecture you want to add.

@leo-arch
Copy link
Author

leo-arch commented Dec 10, 2024

A few observations that may be useful:

  1. I downloaded clifm' install script (via am -d), but had to create the ~/Desktop directory. Would it be possible to specify a custom destiny directory (or use the current directory if none is specified)?
  2. Once I got the script and modified it, I wanted to use that script to install clifm, but haven't figured out of to do it (it seems AM always use the script in the database)
  3. Would AM work outside Linux? I don't see any reason why it wouldn't on *BSD, to say the least.

@ivan-hc
Copy link
Owner

ivan-hc commented Dec 10, 2024

A few observations that may be useful:

  1. I downloaded clifm' install script (via am -d), but had to create the ~/Desktop directory. Would it be possible to specify a custom destiny directory (or use the current directory if none is specified)?

I could put an alternative directory in case ~/Desktop (or in my case ~/Scrivania) is not present. It remains to be seen.

  1. Once I got the script and modified it, I wanted to use that script to install clifm, but haven't figured out of to do it (it seems AM always use the script in the database)

impossible, you should drag the script into the terminal or open a terminal in the directory where you downloaded the script and start with ./, for example

am -i ./clifm
am -i '/path/to/clifm'
  1. Would AM work outside Linux? I don't see any reason why it wouldn't on *BSD, to say the least.

should work, as long as BASH is installed. My friend @Samueru-sama tried to convert various modules to POSIX, but there are some commands, like select, that only work with BASH

@leo-arch
Copy link
Author

leo-arch commented Dec 10, 2024

I could put an alternative directory in case ~/Desktop (or in my case ~/Scrivania) is not present.

That would be nice (I do not use any DE, so that this directory is absent in my case).

impossible, you should drag the script into the terminal...

A typo? Shouldn't it read possible instead?

should work, as long as BASH is installed.

Sounds reasonable. Bash is pretty much anywhere, so that it's not much to ask. It would be nice to see this in BSD systems.

@ivan-hc
Copy link
Owner

ivan-hc commented Dec 10, 2024

I could put an alternative directory in case ~/Desktop (or in my case ~/Scrivania) is not present.

That would be nice (I do not use any DE, so that this directory is absent in my case).

I'm just working on this

impossible, you should drag the script into the terminal...

A typo? Shouldn't it read possible instead?

the -i option takes account of the path to the script, if the argument has a path, it copies it in the ~/.cache/am directory with the patches needed to run the script. This is useful to test your own scripts with your changes.

should work, as long as BASH is installed.

Sounds reasonable. Bash is pretty much anywhere, so that it's not much to ask. It would be nice to see this in BSD systems.

for what I know, BASH has not a compatible license in BSD, but it can still be installed.

@ivan-hc
Copy link
Owner

ivan-hc commented Dec 10, 2024

Uhm... since "$SCRIPTDIR" (value SCRIPTDIR="$(xdg-user-dir DESKTOP 2>/dev/null || echo "$HOME")") is in the main CLI, APP-MANAGER, and since it is also used with -t, I need to change this in APP-MANAGER instead, in case xdg-user-dir DESKTOP does not exists.

@Samueru-sama any tip?

@leo-arch
Copy link
Author

the -i option takes account of the path to the script

Great! I suggest making this clear in the documentation (which at the moment says am -i {PROGRAM})

for what I know, BASH has not a compatible license in BSD, but it can still be installed.

The BSD licenses are quite permissive, so I think GPL does not conflict with them (though it's not the case the other way around). However, this is in fact not a problem. Bash is available on all BSD systems I've tried.

@ivan-hc
Copy link
Owner

ivan-hc commented Dec 10, 2024

Great! I suggest making this clear in the documentation (which at the moment says am -i {PROGRAM})

sure, it is here https://github.com/ivan-hc/AM/blob/main/docs/guides-and-tutorials/template.md#how-to-test-an-installation-script

it is the page where I explain how installation scripts can be created and how they work

@leo-arch
Copy link
Author

Ok, my bad. However, I was talking about am -h, which is what I consulted.

@ivan-hc
Copy link
Owner

ivan-hc commented Dec 10, 2024

same method is also used to install AppBundles, Toolpacks (-i with flag --toolpack) and appimages out of the database but hosted on github (option -e): the script in all these cases is created on-the-fly and submitted to -i

@Samueru-sama
Copy link
Contributor

  1. I downloaded clifm' install script (via am -d), but had to create the ~/Desktop directory. Would it be possible to specify a custom destiny directory (or use the current directory if none is specified)?

That's weird, when there is no such dir it should default to using $HOME since the location is determined by SCRIPTDIR="$(xdg-user-dir DESKTOP 2>/dev/null || echo "$HOME")"

Sounds reasonable. Bash is pretty much anywhere, so that it's not much to ask. It would be nice to see this in BSD systems.

We do make heavy use of sed -i which as far as I know the -i flag in sed isn't POSIX so I'm not sure even if you have bash installed that it will work on BSD, I think busybox sed does have -i flag support, no idea if the sed that's used on BSD does.

@leo-arch
Copy link
Author

leo-arch commented Dec 10, 2024

when there is no such dir it should default to using $HOME

This is what I see:

$ am -d clifm
/opt/am/modules/install.am: line 40: cd: /home/user/Desktop: No such file or directory.

We do make heavy use of sed -i

sed manpage (FreeBSD)
sed manpage (OpenBSD)

@ivan-hc
Copy link
Owner

ivan-hc commented Dec 10, 2024

Maybe we should do a mkdir -p, just in case.

@leo-arch would this be a solution?

@leo-arch
Copy link
Author

leo-arch commented Dec 10, 2024

IMHO, it would work, yes. But, creating a directory unnecessarily would be, well, unnecessary.

Btw, wouldn't it be better to default to the current directory instead of $HOME, provided ~/Desktop isn't found? I feel it more intuitive this way.

@Samueru-sama
Copy link
Contributor

Btw, wouldn't it be better to default to the current directory instead of $HOME, provided ~/Desktop isn't found? I feel it more intuitive this way.

Just made a PR that allows setting the dir but I can change it to default to $PWD instead of $HOME

@ivan-hc
Copy link
Owner

ivan-hc commented Dec 10, 2024

maybe this should solve the issue

SCRIPTDIR=$(xdg-user-dir DESKTOP 2>/dev/null)
[ ! -d "$SCRIPTDIR" ] && SCRIPTDIR="$HOME"
export SCRIPTDIR

@ivan-hc
Copy link
Owner

ivan-hc commented Dec 10, 2024

Btw, wouldn't it be better to default to the current directory instead of $HOME, provided ~/Desktop isn't found? I feel it more intuitive this way.

Just made a PR that allows setting the dir but I can change it to default to $PWD instead of $HOME

https://github.com/ivan-hc/AM/pull/1197/files 👀

this guy it telepathic

@leo-arch
Copy link
Author

Guys, whatever you decide, be it~/Desktop or whatever else, let the user know where the script file is after downloading it. When I download the script I only see "clifm" installation script downloaded, which is not very useful.

@Samueru-sama
Copy link
Contributor

Guys, whatever you decide, be it~/Desktop or whatever else, let the user know where the script file is after downloading it. When I download the script I only see "clifm" installation script downloaded, which is not very useful.

That's something for @ivan-hc because I don't know where that message is given lol

@ivan-hc
Copy link
Owner

ivan-hc commented Dec 10, 2024

this should fix the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants