- Array depends if this fails does the installation stop?
- Can we download and install the missing packages using the package() functions? Or does this need to be down using the prepare() function? Because the script even I’ve built it to run on enos, I want it to run on something outside enos as well. It uses
eos-bash-shared
andeos-script-lib-yad
. So I want to install them if they are missing. - Would I be able check if the above files are in the system or not using bash commands in PKGBUILD script?
Fails in what way? If the packages are not available then pacman will complain and not proceed with the installation.
No, downloading and installing packages is the job of the package manager.
You can check on files installed in the build environment, but the PKGBUILD can’t check on anything on the target system. (If you think you want packaging variables determined at runtime then you’re probably trying to do something the wrong way round.)
You could create a local repo with those packages in it or just add the EOS repo to that install.
I mean if the dependency files are not in the system.
Like this?
url="https://gitlab.com/s4ndm4n82/$pkgname/-/tree/main/" #My original one
eos_url="https://raw.githubusercontent.com/endeavouros-team/PKGBUILDS/master/eos-bash-shared"
source=(
$eos_url/eos-bash-shared
$url/$pkgname
)
package() {
install -Dm644 eos-script-lib-yad $pkgdir/usr/share/endeavouros/scripts/eos-script-lib-yad
install -Dm755$pkgname $pkgdir/usr/share/$pkgnmae
}
Most are used as examples in the above code just want to know if I understood correctly what @dalto said.
P.S: Going to go to bed now it’s 2.15 AM have to get up at 6.15 AM. I will reply tomorrow.
Ahh…not at all.
I meant add it in pacman.conf
That being said, I suppose you could add the path in master to the source array, manually install them and then remove them from the depends.
Do you mean by writing the repo to pacman.conf
on the user computer?
Yes. Is there a reason you cannot?
Part of the problem here is you haven’t told us what you are actually trying to do. It is possible there is a better solution.
The problem with EndeavourOS goodies is that scripts executed with them won’t work on other systems (unless you add in the EndeavourOS repo to their /etc/pacman.conf, of course). Few would wish to - after all they would already be here is that was the idea!
Better to abstract the functionality of the EnOS goody into your script directly if it will be useful on other Arch-based systems. Luckily that is reasonably possible, if you have sufficient motivation! It certainly points out how useful some of these ‘little’ goodies really are, though!
Nope. I don’t know this is the first time I’m dealing with PKGBUILD or any Linux installation system. I’m familiar with Windows stuff like Inno setup. I just wanted to check if the shared files are there if not get them from enos repo. Put them or install them onto the user system and install my script without letting the user go through all the trouble.
First I thought of using the pkgbuild functions itself so I can put the enos files in place. If they are not in the system. That’s why I asked because PKGBUILD seems to be another .sh file.
So according to you I can use prepare() add the repo to pacman.conf
then install them using pacages()?
Yeah, I thought about this at first. Seems I might have to write the things I use into my script or clone the repo to mine.
I have the motivation my issue is time and well, don’t know how to use full this is going to be because I actually started creating this to be a simple front end for pacman
and to be used with enos like the other enos tools. But after knowing it’s not going to be in there my motivation kind of just died. But I’m doing this just to learn something and to keep from doing something bad to myself (it’s my mental issue no worries).
I will see what I can do might be not the best but will try it my way or any other way to make this more universal to Arch.
No, that won’t work. Again, it would be helpful if you shared the specifics of what you are trying to accomplish so we can propose an appropriate solution.
I’m trying to do is this.
I have a script that I’ve written using bash
and yad
which is a small front end for pacman
. In this script it users /usr/share/endeavouros/scripts/eos-script-lib-yad
which part of enos eos-bash-shared
.
Now I’m trying to add my script to AUR using PKGBUILD. But the dependency eos-bash-shared
is not going to be available in other Arch or Arch-based distros. So due to this pacman will stop the installation. What I want to do is to continue the installation without stopping. If the mentioned files are missing I want to download them and add them to the users’ system. Without making the user go around searching for the dependencies.
If the dependency files are in the system I don’t want to add them to the system just want to continue the installation of my script. This is what I’m trying to achieve.
Can’t you just take whatever part of that you need and embed it into your script instead of depending on it?
If not, just add this git url to the source array of your package build and only install the two files you need.
Try to have as few dependencies in your scripts as possible. Having dependencies that other users are unlikely to have installed for a simple script is just terrible practice.
When I write scripts, I even go to the extreme of trying to avoid using utilities which are not part of the shell, like sed
and awk
, even though it is reasonable to expect every user has them installed. This is typically not necessary, but it is nice to have a script that has zero dependencies (except Bash that runs it, of course).
Having to install packages just to be able to run a simple script is usually inconvenient for users. Depending on another AUR package is very inconvenient and should be avoided at all costs. And depending on adding a third-party repo (like endeavouros
) should be considered out of the question from the start.
This is what I kind of did here.
And you said.
And adding the git to sources and installing it if it’s missing the files is what I’m trying to achieve.
Totally agree with what you’re saying. I’m just starting off in this area mainly in Linux Bash scripts. So that’s why I used eos script. But eventually, I would be writing it into my script.
Umm…not really. What you did there is totally broken
When I said that, I didn’t understand what you were trying to do. Now that I know you are trying to make an AUR package, the advice to add the repo doesn’t make sense.
Why not make this even easier? You can just download the current versions of the two files you need and upload them to your gitlab along with your script. Then they can be installed as part of your package.
Yeah, that was my first thought. But was kind of worried if not updated it might break. But then I’m not using the entire thing so why not. Is it ok to rename the files? I’ll keep commented names details inside the files.
Since that package doesn’t have a license, we would have to ask @manuel