Triggering pamac-manager from website


#41

the simplest thing you can do is create a custom repo for the aur apps you recommend.and use the above script that installs app from pamac after clicking on website.as you may know that compilation takes long time.so just provide binaries.

take a look at these repositories they might contain aur packages that you want to recommend
like herecura repository
https://wiki.archlinux.org/index.php/Unofficial_user_repositories

and add some of these repos to your manjaro spin.


#42

Great ideas! The best would be to create a custom repo for our spin. The downside is that you have to maintain it and update it. I am unsure how difficult this is - I managed to do it once so I have to check more about it.

I had no idea there is a list with other repos, I will look into it for sure. How are duplicated packages dealt with? Like if 4 repos have the same package


#43

I don’t think this is possible with your current URL setup, since the files in AUR is not actual packages, but tarballs containing the packages.

You would have to create another MIME type, like x-aur-package:// and make it use pamac build instead of pamac install.


#44

Exactly what I thought. But then how can this be done? I realized that the one I use it is based on installing rather than building.


#45

about the duplicate packages
i think higher version number takes priority.
if they have same version number then they will take priority as they are added to the pacman.conf and of course manjaro repo takes priority.
correct me if im wrong.


#46

I will have to test that. If anyone knows for sure let me know please.


#47

using packages outside the manjaro repositories is a very, very bad idea
The user then installs a package without any control - it’s great for entering any virus :clap:

but if you want break your users:

#!/usr/bin/env bash

# ALPM package URL handler
# x-alpm-package://packagename
# install: xdg-mime default pamac-url-handler.desktop x-scheme-handler/x-alpm-package

packagename="${1#x-alpm-package://}"
if [[ "http" == "${packagename:0:4}" ]]; then
    name="${packagename##*/}"
    wget -q "$packagename" -O "/tmp/${name}"
    packagename="/tmp/${name}"
fi
pamac-installer "$packagename"
rm "$packagename"

for test :
<a href="x-alpm-package://https://afur.archlinux.fr/pkg/any/php-box-2.7.5-1-any.pkg.tar.xz">Install from extern repo my virus: php-box</a>
any other website, can offer this link and infect manjaro users.
if this version of x-alpm-package is offered to users, tomorrow we have 500 web sites with bad links!

with a PKGBUILD, it’s the same shame


#48

I understand but so it is when users install from AUR. It is good to always warn them about these.

Ok but I was thinking to make it work with AUR and pamac build. SO to basically install from AUR not from any random .tar file.

So the script seems to work with that package, but I am unsure how to make it work with say AUR ones.


#49

aur is collection of pkgbuild scripts installing from aur is same as installing random tar packages.what aur does is simplify the process to install the tar file and make a package that can be installed.


#50

Thanks. I understand. So then to be more reliable it should pull these pkgbuild(s) from AUR, like pamac build does right? As far as I understand something like “pamac build” is using pkgbuild files only from AUR. And so, I was thinking, to do the same that pamac does only to be triggered from and url.


#51

with aur you can BUT without GUI the user will not wait for the compilation time

#!/usr/bin/env bash

# ALPM package URL handler
# x-alpm-package://packagename
# install: xdg-mime default pamac-url-handler.desktop x-scheme-handler/x-alpm-package

packagename="${1#x-alpm-package://}"
echo "${packagename:0:4}"
if [[ "aur/" == "${packagename:0:4}" ]]; then
    name="${packagename##*/}"
    echo -e "n\ny\n" | LANG=C pamac build "$name"
    exit 0
fi
if [[ "http" == "${packagename:0:4}" ]]; then
    #extension="${packagename##*.}"
    name="${packagename##*/}"
    echo "ext: $extension name:$name"
    #exit 0
    wget -q "$packagename" -O "/tmp/${name}"
    packagename="/tmp/${name}"
fi
pamac-installer "$packagename"

<a href="x-alpm-package://aur/pamac-aur-git">Install from aur: pamac-git</a>

  • it is necessary to write a program with a GUI - aur is not manjaro ! there is no reason to write this app here

#52

Isn’t it using the same ALPM package URL handler that the original script here uses?

I was thinking since it can work with pamac it can be useful for ease of installing from AUR. After all AUR is part of Manjaro - meaning in the distro you can enable AUR and there is even a support forum here for AUR.


#53

Basically now, using this script, it seems to work with AUR though it having no GUI then the process is waiting for a password to be able to install, somewhere in the background. Thus, if such a link gets clicked, from the user’s perspective nothing happens. Maybe is it possible to do it through terminal?


#54

I am also trying this path. I think I’ve done everything as said in Manjaro Wiki https://wiki.manjaro.org/index.php?title=Buildiso_with_AUR_packages:_Using_buildpkg - this is the repo https://www.tromjaro.com/repository/TROMrepo/x86_64/ and I added the following to etc/pamac.conf:

[TROMrepo]
SigLevel = Never
Server = https://www.tromjaro.com/repository/TROMrepo/$repo/$arch

Then I done:


[tio@tio-pc ~]$ sudo pacman -Syu
:: Synchronizing package databases...
 core is up to date         0,0   B  0,00B/s 00:00 [----------------------]   0%
 extra is up to date        0,0   B  0,00B/s 00:00 [----------------------]   0%
 community is up to date    0,0   B  0,00B/s 00:00 [----------------------]   0%
 multilib is up to date     0,0   B  0,00B/s 00:00 [----------------------]   0%
:: Starting full system upgrade...
 there is nothing to do

I cannot see the repo…am I doing something wrong?

EDIT: ah stupid mistake I edited pamac.conf instead of pacman.conf. Works now. I am trying this path with custom repos as well.


#55

I start to get the idea of custom repos and I like it :slight_smile: - I tested with some updates and it is not that difficult. I know this is not the topic here but it is in a way a solution for the topic. So I have one more question in regards to the custom repo: how are the updates pushed? Basically after I update the repo database and files, the pamac (add/remove software program) is auto-refreshing every repo database (extra, community, mine, etc.)? And then it notifies if it sees any updates?

Thanks!


#56

Thats the whole ‘refresh databases’ part … like if you do -Syu, or force with -Syyu :wink:
If the user only did sudo pacman -Su they might not get the changes.
(and one of the reason why it is never suggested, considered a partial upgrade)


#57

Mind you I am only using Manjaro for 4 months or so :smiley: - so to understand it properly, will the system basically refresh my custom repo database automatically or the users have to do -Syu ? :slight_smile:


#58

If you mean after the repo/mirror is added?
Then it I’m pretty sure it must be sudo pacman -Syyu (or pamac equivalent)
If you mean after it is established, and during normal usage? Yes the mirror will be queried, and updates/changes from it will be issued by using pamac or pacman normally
(ie -Syu or better to update, standard package search/installation as well)

[Extra Note]
as to the difference of Syu vs Syyu …
Syyu will always do something like this

:: Synchronizing package databases...
 core     147.3 KiB   818K/s 00:00 [####################################################################] 100%
 extra     1842.4 KiB  2.70M/s 00:01 [####################################################################] 100%
 community     5.2 MiB  1504K/s 00:04 [####################################################################] 100%
 multilib     185.5 KiB  2.48M/s 00:00 [####################################################################] 100%
:: Starting full system upgrade...

Whereas if the databses are fine and there is supposedly no need to sync, such as after performing above, Syu might look like this:

:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
 multilib is up to date
:: Starting full system upgrade...

#59

After the repo is integrated I was interested :slight_smile: - so basically every X hours/minutes all repos are being updated automatically? Probably that’s the case as far as I understand from you :wink:

Thanks for explaining the difference! I am learning more and more.


#60

No, I mean if there is any change and the user says update … it should be seen. the only ‘time’ on it is before/after.
This isnt like manjaro mirrors - manjaro has dozens around the world that sync at certain times from the ‘main’ repo the devs use. So they might ‘populate’ at different intervals. yours is just the one.