Merge pull request 'Add flatpak support' (#1) from add-flatpak-support into master
Reviewed-on: #1
This commit is contained in:
commit
e2f789f7d0
6
Makefile
6
Makefile
|
@ -1,12 +1,12 @@
|
||||||
# makefile for pamac-url-handler
|
# makefile for pamac-url-handler
|
||||||
build:
|
build:
|
||||||
makepkg
|
makepkg -s
|
||||||
|
|
||||||
install:
|
install:
|
||||||
pamac-installer pamac-url-handler-*.tar.xz
|
pamac-installer pamac-url-handler-*.tar.zst
|
||||||
|
|
||||||
remove:
|
remove:
|
||||||
pamac-installer --remove pamac-url-handler
|
pamac-installer --remove pamac-url-handler
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) -rf src/ pkg/ *.tar.xz
|
$(RM) -rf src/ pkg/ *.tar.zst
|
||||||
|
|
17
PKGBUILD
17
PKGBUILD
|
@ -1,22 +1,25 @@
|
||||||
# Maintainer: Your Name <youremail@domain.com>
|
# Maintainer: TROM <contact@tromsite.com>
|
||||||
pkgname=pamac-url-handler
|
pkgname=pamac-url-handler
|
||||||
pkgver=1.0.0
|
pkgver=1.0.0
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Install ALPM packages with pamac-installer from URL scheme x-alpm-package://packagename"
|
pkgdesc="Install ALPM packages with pamac-installer from URL scheme x-alpm-package://packagename"
|
||||||
arch=(any)
|
arch=(any)
|
||||||
url=""
|
url="https://git.trom.tf/TROMjaro/pamac-url-handler-package"
|
||||||
license=(unknown)
|
license=(unknown)
|
||||||
depends=('pamac-gtk')
|
depends=('pamac-gtk'
|
||||||
|
'yad'
|
||||||
|
'exo'
|
||||||
|
'flatpak')
|
||||||
provides=('pamac-url-handler')
|
provides=('pamac-url-handler')
|
||||||
backup=()
|
backup=()
|
||||||
options=(!strip)
|
options=(!strip)
|
||||||
install='pamac-url-handler.install'
|
install='pamac-url-handler.install'
|
||||||
source=("pamac-url-handler"
|
source=("pamac-url-handler"
|
||||||
"pamac-url-handler.desktop")
|
"pamac-url-handler.desktop")
|
||||||
md5sums=('61007bb8b0d00dabb04c06a7e334653f'
|
sha256sums=('SKIP'
|
||||||
'ca911444c12149c3f11be0a26dd9b2dc')
|
'SKIP')
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
install -Dm644 ${srcdir}/pamac-url-handler.desktop ${pkgdir}/usr/share/applications/pamac-url-handler.desktop
|
install -Dm644 ${srcdir}/pamac-url-handler.desktop ${pkgdir}/usr/share/applications/pamac-url-handler.desktop
|
||||||
install -Dm755 ${srcdir}/pamac-url-handler ${pkgdir}/usr/bin/pamac-url-handler
|
install -Dm755 ${srcdir}/pamac-url-handler ${pkgdir}/usr/bin/pamac-url-handler
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# pamac URL handler package
|
# pamac URL handler package
|
||||||
|
|
||||||
Install ALPM packages with `pamac-installer` from URL scheme `x-alpm-package://[aur/]<packagename>`
|
Install ALPM packages with `pamac-installer` or `flatpak` from URL scheme `x-alpm-package://[aur// or flatpak//]<packagename>`
|
||||||
|
|
||||||
## Building the package
|
## Building the package
|
||||||
|
|
||||||
|
@ -19,4 +19,3 @@ To remove just installed package, use:
|
||||||
To cleanup the project, use:
|
To cleanup the project, use:
|
||||||
|
|
||||||
`make clean`
|
`make clean`
|
||||||
|
|
||||||
|
|
33
pamac-url-handler
Normal file → Executable file
33
pamac-url-handler
Normal file → Executable file
|
@ -4,12 +4,31 @@
|
||||||
# x-alpm-package://packagename
|
# x-alpm-package://packagename
|
||||||
# install: xdg-mime default pamac-url-handler.desktop x-scheme-handler/x-alpm-package
|
# install: xdg-mime default pamac-url-handler.desktop x-scheme-handler/x-alpm-package
|
||||||
|
|
||||||
packagename="${1#x-alpm-package://}"
|
if [ $# != 1 ] || [[ "$1" != 'x-alpm-package://'* ]]; then
|
||||||
echo "${packagename:0:4}"
|
echo "Usage: $0 [URL]"
|
||||||
if [[ "aur/" == "${packagename:0:4}" ]]; then
|
exit 1
|
||||||
name="${packagename##*/}"
|
|
||||||
pamac-installer --build "$name"
|
|
||||||
exit 0
|
|
||||||
fi
|
fi
|
||||||
pamac-installer "$packagename"
|
|
||||||
|
|
||||||
|
content="${1#x-alpm-package://}"
|
||||||
|
|
||||||
|
# AUR install
|
||||||
|
if [[ "$content" == 'aur//'* ]]; then
|
||||||
|
packagename="${content#aur//}"
|
||||||
|
pamac-installer --build "$packagename"
|
||||||
|
|
||||||
|
# Flatpak install
|
||||||
|
elif [[ "$content" == 'flatpak//'* ]]; then
|
||||||
|
appID="${content#flatpak//}"
|
||||||
|
info=$(flatpak remote-info flathub "$appID") || {
|
||||||
|
yad --image 'dialog-error' --title 'Alert' --buttons-layout=center --text-align=center --button=yad-close --borders=10 --text "Flatpak ID not found:\n$appID"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
yad --image 'dialog-question' --title 'Flatpak install' --button=Cancel:1 --button=Install:0 --text "$info" &&
|
||||||
|
exo-open --launch TerminalEmulator \
|
||||||
|
bash -c "flatpak install --assumeyes flathub $appID ; printf '\n'; read -n1 -rsp 'press any key to close window...'"
|
||||||
|
|
||||||
|
# Repo install
|
||||||
|
else
|
||||||
|
packagename=$content
|
||||||
|
pamac-installer "$packagename"
|
||||||
|
fi
|
||||||
|
|
Loading…
Reference in New Issue
Block a user