You are not logged in.

#1 2016-05-22 22:58:42

mostlyharmless
Member
Registered: 2014-01-16
Posts: 72

PKGBUILD review request HP RGS remote receiver

First PKGBUILD I've made; seems to work OK but inelegant. Suggestions and fixes would be welcome:

# Maintainer: mostlyharmless <xxxx@gmail.com>
# needs multilib, user must be on sudoers
pkgname=hgsreceiver
pkgver=7.2.2
pkgrel=1
pkgdesc="HP remote RGS receiver"
arch=('x86_64')
url="https://h30670.www3.hp.com/portal/swdepot/displayProductInfo.do?productNumber=RGS52A"
license=('HP')
depends=('libudev.so.0 lib32-glu')
makedepends=('rpmextract rsync')
options=('emptydirs')
source=("RGS_Linux_64_Receiver_v7.2.2_Z7550-01884.tar.gz")
md5sums=('d9015067b8331bcbee4d4cb2b04c8d5a')

package() {

  tar -zxf ./RGS_Linux_64_Receiver_v7.2.2_Z7550-01884.tar.gz
  cd lin64/receiver

# HP license
echo ""
more LICENSE.txt
hpLicenseAccepted="no"
echo ""
echo -n "Do you accept this HP license agreement? (yes/no) [no]: "
read hpLicenseAccepted
if [[ $hpLicenseAccepted != "yes" ]]
then
    echo "Enter \"yes\" to accept the license"
    echo "Exiting without installing"
    exit 1
fi
  
rpmextract.sh ./rgreceiver_linux_64-7.2.2.8504-1.x86_64.rpm

# Security hole needed to register advance features

chmod 6755 opt/hpremote/rgreceiver/rgsmbiosreader
chmod a+w etc/opt
chmod a+w etc/opt/hpremote
chmod a+w etc/opt/hpremote/*
mkdir etc/ld.so.conf.d
echo opt/hpremote/rgreceiver/lib64 > etc/ld.so.conf.d/hpremote.conf

echo ""
echo -n "Do you want to enable Wacom device support? (yes/no) [yes]: "
read wacomEnabled
if [[ $wacomEnabled != "no" ]]
then
    mkdir etc/udev
    mkdir etc/udev/rules.d
    cp opt/hpremote/rgreceiver/rules/rgs-pen-tablet.rules etc/udev/rules.d/
fi
rsync -ruDq . $pkgdir

}

Last edited by mostlyharmless (2016-06-08 04:56:55)

Offline

#2 2016-05-22 23:18:22

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,539

Re: PKGBUILD review request HP RGS remote receiver

PKGBUILDs should never require input. Get rid of all of the prompts, get rid of extracting RGS_Linux_64_Receiver_v7.2.2_Z7550-01884.tar.gz, that's already done for you, get rid of rmpextract, bsdtar will do it, and get rid of rsync, just do everything in $pkgdir. That should be a good start on cleaning things up.

Offline

#3 2016-05-22 23:42:35

Steef435
Member
Registered: 2013-08-29
Posts: 577
Website

Re: PKGBUILD review request HP RGS remote receiver

Also, the license should be "custom", "custom:HP" or something like that: https://wiki.archlinux.org/index.php/Ar … s#Licenses

You can expect a user to agree to the license, it's their job to read the license file before installing a package.

If you like you could still include the choice for Wacom device support by adding it as a variable somewhere near the top of the file so that people can edit it in the PKGBUILD easily. It's advised to prepend custom global variable names with an underscore.

Offline

#4 2016-05-23 00:26:11

mostlyharmless
Member
Registered: 2014-01-16
Posts: 72

Re: PKGBUILD review request HP RGS remote receiver

Thanks, will get on it when I have the chance.

Offline

#5 2016-05-25 19:14:47

mostlyharmless
Member
Registered: 2014-01-16
Posts: 72

Re: PKGBUILD review request HP RGS remote receiver

Ok, second try; I could have used bsdtar to extract into pkgdir and then deleted some files rather than using cp -rp, however I've seen this approach in other PKGBUILDs and it seems cleaner IMO. Acceptable?

# Maintainer: mostlyharmless <xxxx@gmail.com>
# needs multilib, user must be on sudoers
# Wacom tablet support enabled by default
# Advance features cannot be registered or activated under KVM/QEMU/OVMF
_wacomEnabled=yes
pkgname=hgsreceiver
pkgver=7.2.2
pkgrel=1
pkgdesc="HP remote RGS receiver"
arch=('x86_64')
url="https://h30670.www3.hp.com/portal/swdepot/displayProductInfo.do?productNumber=RGS52A"
license=('custom:"HP"')
depends=('libudev.so.0' 'lib32-glu')
makedepends=('')
options=('emptydirs')
source=("RGS_Linux_64_Receiver_v7.2.2_Z7550-01884.tar.gz")
md5sums=('d9015067b8331bcbee4d4cb2b04c8d5a')

package() {

bsdtar xf lin64/receiver/rgreceiver_linux_64-7.2.2.8504-1.x86_64.rpm

cd "${srcdir}"
# install licence
install -m644 -D lin64/receiver/LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

# Security hole needed to register advance features 
# N.B. rgsmbiosreader does not work under KVM/QEMU/OVMF bios

chmod 6755 opt/hpremote/rgreceiver/rgsmbiosreader
chmod a+w etc/opt
chmod a+w etc/opt/hpremote
chmod a+w etc/opt/hpremote/*

# link to libraries included with program

install -d -m644 etc/ld.so.conf.d
echo opt/hpremote/rgreceiver/lib64 > etc/ld.so.conf.d/hpremote.conf

# Install WaCom tablet rules
if [[ $_wacomEnabled != "no" ]]
then
    install -d -m644 etc/udev/rules.d
    cp opt/hpremote/rgreceiver/rules/rgs-pen-tablet.rules etc/udev/rules.d/
fi

cp -rp ./opt/ $pkgdir
cp -rp ./etc/ $pkgdir
cp -rp ./usr/ $pkgdir
cp -rp ./source/ $pkgdir

}

post-install() {

/sbin/ldconfig

}

[EDIT: cp -rp not cp -r]

Last edited by mostlyharmless (2016-06-08 04:56:14)

Offline

#6 2016-05-26 22:02:31

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: PKGBUILD review request HP RGS remote receiver

I think the bsdtar command should be in a prepare() function instead of package() as it works on the sourcefiles.

Packages that don't compile sourcecode but install binaries usually have a -bin suffix to the packagename.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#7 2016-05-27 21:25:26

mostlyharmless
Member
Registered: 2014-01-16
Posts: 72

Re: PKGBUILD review request HP RGS remote receiver

I thought about using a prepare() section, but then read this in the wiki:

The package() function is the only required function in a PKGBUILD. If you must only copy files into their respective directories to install a program, do not put it in the build() function, put that in the package() function.

which sort of applies.  A matter of style, perhaps, easy enough to change.

As far as the name change, you mean rename the package name like hgsreceiver-bin ?

Offline

#8 2016-05-28 13:42:25

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,911

Re: PKGBUILD review request HP RGS remote receiver

yes, a name like hgsreceiver-bin reflects the type of package much better.

To understand that wiki quote, you have to know a bit aboutthe history of pacman/makepkg .

Originally PKGBUILD only had a build() function that allowed you to do everything.
At some point the package() function was introduced as an OPTION.
around pacman 4.x the package() function became mandatory and the build() function optional.

Plenty of (AUR) packages failed to build due to not having  a package() function.
That probably triggered the quote you posted.

man PKGBUILD does a decent job of explaining the different functions you can use in a PKGBUILD.

Last edited by Lone_Wolf (2016-05-28 14:03:58)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#9 2016-05-28 13:49:32

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,539

Re: PKGBUILD review request HP RGS remote receiver

I probably wouldn't rename it. The -bin suffix is used to differentiate things when it's also possible to build from source. If that's not possible here, -bin doesn't really mean anything.

Offline

#10 2016-05-28 20:04:28

mostlyharmless
Member
Registered: 2014-01-16
Posts: 72

Re: PKGBUILD review request HP RGS remote receiver

Is there something in the wiki or elsewhere regarding the naming convention?  I've never installed any packages called -bin, but have installed icaclient, which in some ways is a similar mostly binary package, if I recall.  I'll probably move the bsdtar to prepare(), that seems logical.

Offline

#11 2016-06-08 05:08:38

mostlyharmless
Member
Registered: 2014-01-16
Posts: 72

Re: PKGBUILD review request HP RGS remote receiver

OK, latest version with one more dumb question I probably know the answer to:

Since the source file is a binary file from HP without a clear download path (ie one has to login to HP and follow a convoluted set of instructions to get this free file), it is not possible to use source=(url of any sort) One has to manually download the file and manually build this (re)package.  Needless to say, that means that it cannot be uploaded to AUR, for without the source it will rejected, and with a binary from HP, I presume it ought to be deleted as well.  Nonetheless, I suppose someone out there besides me uses this fine piece of software and would like to use it on Arch instead of the officially sanctioned Redhat.  So the question is, is there a place for PKGBUILDs of this variety, or should we just let enterprising souls use google to find the recipe here in this thread?

# Maintainer: mostlyharmless <xxxx@gmail.com>
# needs multilib, user must be on sudoers
# Wacom tablet support enabled by default
# Advance features cannot be registered or activated under KVM/QEMU/OVMF
_wacomEnabled=yes
pkgname=hgsreceiver-bin
pkgver=7.2.3
pkgrel=1
pkgdesc="HP remote RGS receiver"
arch=('x86_64')
url="https://h30670.www3.hp.com/portal/swdepot/displayProductInfo.do?productNumber=RGS-LR"
license=('custom:"HP"')
depends=('libudev.so.0' 'lib32-glu')
makedepends=('')
options=('emptydirs')
source=("RGS_Linux_64_Receiver_v7.2.3_Z7550-01890.tar.gz")
md5sums=('f6b335e7ff929af51bfc7d840b56dd8d')

prepare() {
bsdtar xf lin64/receiver/*.rpm
}

package() {
cd "${srcdir}"

# install licence
install -m644 -D lin64/receiver/LICENSE.txt "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"

# Security hole needed to register advance features
# N.B. rgsmbiosreader does not work under KVM/QEMU/OVMF bios
chmod 6755 opt/hpremote/rgreceiver/rgsmbiosreader
chmod a+w etc/opt
chmod a+w etc/opt/hpremote
chmod a+w etc/opt/hpremote/*

# link to libraries included with program
install -d -m644 etc/ld.so.conf.d
echo opt/hpremote/rgreceiver/lib64 > etc/ld.so.conf.d/hpremote.conf

# Install WaCom tablet rules
if [[ $_wacomEnabled != "no" ]]
then
    install -d -m644 etc/udev/rules.d
    cp -u opt/hpremote/rgreceiver/rules/rgs-pen-tablet.rules etc/udev/rules.d/
fi

# copy the directories
cp -rp ./opt/ $pkgdir
cp -rp ./etc/ $pkgdir
cp -rp ./usr/ $pkgdir
cp -rp ./source/ $pkgdir

}

post-install() {
/sbin/ldconfig
}

Last edited by mostlyharmless (2016-06-08 05:13:37)

Offline

#12 2016-06-08 06:02:08

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: PKGBUILD review request HP RGS remote receiver

Typically such PKGBUILDs use file:// urls and require the user to download the login-protected sources themself.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#13 2016-06-08 13:18:50

mostlyharmless
Member
Registered: 2014-01-16
Posts: 72

Re: PKGBUILD review request HP RGS remote receiver

Thanks, I really appreciate the help.  I tried using file:// (and also local://, whatever the difference is), but still got the following message when trying to git push:

Counting objects: 4, done.
Delta compression using up to 12 threads.
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 1.42 KiB | 0 bytes/s, done.
Total 4 (delta 0), reused 0 (delta 0)
remote: error: The following error occurred when parsing commit
remote: error: 2be47f58830135cbbada3b116d5deda302f56052:
remote: error: missing source file: RGS_Linux_64_Receiver_v7.2.3_Z7550-01890.tar.gz
remote: error: hook declined to update refs/heads/master
To git+ssh://aur@aur.archlinux.org/hgsreceiver.git
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'git+ssh://aur@aur.archlinux.org/hgsreceiver.git'

The new source line reads:
source=("file://RGS_Linux_64_Receiver_v7.2.3_Z7550-01890.tar.gz")

What should it read?

Offline

#14 2016-06-08 13:50:30

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,539

Re: PKGBUILD review request HP RGS remote receiver

Look at the commit referenced, does it not have file://?

Offline

#15 2016-06-08 14:23:49

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: PKGBUILD review request HP RGS remote receiver

mostlyharmless wrote:

The new source line reads:
source=("file://RGS_Linux_64_Receiver_v7.2.3_Z7550-01890.tar.gz")

What should it read?

That should work, but keep in mind that each and every commit must validate... so you cannot simply add a new commit that fixes the issue. You need to fix it and then amend the commit that the AUR was rejecting.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#16 2016-06-09 02:07:24

mostlyharmless
Member
Registered: 2014-01-16
Posts: 72

Re: PKGBUILD review request HP RGS remote receiver

Thanks! that did the trick, and hgsreceiver-bin shows up in AUR.

Offline

Board footer

Powered by FluxBB