You are not logged in.
Pages: 1
Topic closed
I have started using Arch linux only two weeks ago, and installed it on my x64 intel Desktop and Raspberry Pi Model2 alarmpi).
I needed to build dump1090-fa package from source code of Flightaware on GitHub. This is my first attempt to make a package, and I did succeed in building packiage and installing a working dump1090-fa on both x64 desktop and RPi arm.
Although my code has successfully done the job, I want it to be reviewed by senior and experienced members, and give suggestions to improve it. Thanks in advance.
File 1 of 3 - PKGBUILD
#Creater: abcd567
#Maintener: abcd567
pkgname=dump1090-fa
pkgver=latest
pkgrel=1
arch=('x86_64' 'armh6' 'armh7' 'armv6h' 'armv7h')
license=('GPL')
depends=('rtl-sdr' 'lighttpd' 'bladerf')
conflicts=('dump1090' 'dump1090-mutability' 'dump1090-mutability-git' 'dump1090-fa-git' 'dump1090-git' 'dump1090_mr-git')
function checkPkg {
echo ""
echo "CHECKING TOOLS NEEDED TO BUILD THE PACKAGE ....."
echo ""
if [[ ! `pacman -Qqe $1` ]]
then
echo ".... Installing" $1;
yes | sudo pacman -Sy $1;
else
echo $1 "is already installed .......";
fi
}
checkPkg git
checkPkg make
checkPkg pkgconf
checkPkg binutils
checkPkg gcc
checkPkg fakeroot
source=('dump1090::git+git://github.com/flightaware/dump1090')
md5sums=('SKIP')
install="foo.install"
build() {
cd ${srcdir}/dump1090
make
}
package() {
mkdir -p ${pkgdir}/usr/bin
cp ${srcdir}/dump1090/dump1090 ${pkgdir}/usr/bin/dump1090-fa
mkdir -p ${pkgdir}/usr/share/dump1090-fa/html
cp -r ${srcdir}/dump1090/public_html/* ${pkgdir}/usr/share/dump1090-fa/html/
mkdir -p ${pkgdir}/etc/default
cp ${srcdir}/dump1090/debian/dump1090-fa.default ${pkgdir}/etc/default/dump1090-fa
mkdir -p ${pkgdir}/usr/lib/systemd/system
cp ${srcdir}/dump1090/debian/dump1090-fa.service ${pkgdir}/usr/lib/systemd/system/dump1090-fa.service
cp -r ${srcdir}/dump1090/debian/lighttpd ${pkgdir}/lighttpd }
File 2 of 3 - foo.install
post_install () {
## ENABLE DUMP1090-FA SERVICE
systemctl enable dump1090-fa.service
useradd --system dump1090
## DUMP1090-FA INTEGRATION TO LIGHTTPD
mkdir -p /etc/lighttpd/conf.d
cp -r ${pkgdir}/lighttpd/* /etc/lighttpd/conf.d/
chmod 777 /etc/lighttpd/lighttpd.conf
echo "" >> /etc/lighttpd/lighttpd.conf
echo "server.modules += ( \"mod_alias\" )" >> /etc/lighttpd/lighttpd.conf
echo "include \"/etc/lighttpd/conf.d/*\"" >> /etc/lighttpd/lighttpd.conf
chmod 644 /etc/lighttpd/lighttpd.conf
systemctl enable lighttpd.service
## RESTART LIGHTTPD & DUMP1090-FA
systemctl restart lighttpd
systemctl restart dump1090-fa
echo ""
echo ""
echo "============================================"
echo " T H I N G - TO - DO "
echo "============================================"
echo ""
echo "IMPORTANT: REBOOT COMPUTER/RPi" echo ""
echo "OTHERWISE DUMP1090-FA WILL FAIL TO START"
echo "AND A ROTATING WHEEL WILL APPEAR ON THE MAP, OR MAP WILL NOT SHOW"
echo ""
echo "To make SkyView Map show range rings, do following"
echo "(1) Open file for editing"
echo "sudo nano /etc/default/dump1090-fa "
echo ""
echo "(2) Go to following line"
echo "RECEIVER_OPTIONS=\"--device-index 0 --gain -10 --ppm 0 --net-bo-port 30005\""
echo "In above line, add your latitude and longitude, so the line becomes like below:"
echo "RECEIVER_OPTIONS=\"--device-index 0 --gain -10 --lat xx.xxxx --lon yy.yyyy --ppm 0 --net-bo-port 30005\""
echo "NOTE: Repalce xx.xxxx and yy.yyyy by your actual latitude and Longitude"
echo ""
echo "(3) Restart dump1090-fa "
echo "sudo systemctl restart dump1090-fa "
echo "(4) Clear browser cache and reload browser"
echo ""
echo ""
}
File 3 of 3 - README
#dump1090-fa-arch dump1090-fa (AUR) for Arch Linux
Enter cloned directory. It contains following three files
- PKGBUILD
- foo.install
- README.md
Give command `makepkg -si `
Above command will run the PKGBUILD script which will:
1. Check for conflicts with existing other versions of dump1090
2. Check Build tools (git, make, gcc, pkgconf, binutils, and fakeroot) and will install any missing tools
3. Install dependencies rtl-sdr, lighttpd, and bladerf
4. Will build package `dump1090-fa-latest-*-*.pkg.tar.xz`
5. Offer to install the above package[yes/no]
The above package can be install later also by following command:
cd dump1090-fa-arch sudo pacman -U dump1090-fa-latest-*-*.pkg.tar.xz
### IMPORTANT: AFTER INSTALLATION, REBOOT COMPUTER / RPI.
**To check status:**
sudo systemctl status dump1090-fa
**To restart:**
sudo systemctl restart dump1090-fa
############################################################ ##
T H I N G S - TO - DO (AFTER INSTALLATION IS COMPLETED)
############################################################
IMPORTANT: REBOOT COMPUTER/RPi
OTHERWISE DUMP1090-FA WILL FAIL TO START
AND A ROTATING WHEEL WILL APPEARS ON THE MAP, OR MAP WILL NOT SHOW
To make SkyView Map show range rings, do following:
1. Open file "dump1090-fa" for editing sudo nano /etc/default/dump1090-fa
2. In the opened file, go to following line: RECEIVER_OPTIONS="--device-index 0 --gain -10 --ppm 0 --net-bo-port 30005" In above line, add your latitude and longitude, so the line becomes like below: RECEIVER_OPTIONS="--device-index 0 --gain -10 --lat xx.xxxx --lon yy.yyyy --ppm 0 --net-bo-port 30005" NOTE: Repalce xx.xxxx and yy.yyyy by your actual latitude and Longitude
3. Restart dump1090-fa `sudo systemctl restart dump1090-fa `
4. Clear browser cache and reload browser
Last edited by abcd567 (2018-11-14 22:20:50)
Offline
That checkPkg function will at best get your package deleted with extreme prejudice, and at worst, your account banned.
Also from a cursory reading, every aspect of your install script is wrong.
Also there's no such thing as READMEs for the AUR.
Also there's a -git package in the AUR already which does a decent job as far as I can tell, and your PKGBUILD is running from git master, which means it is a duplicate of the existing one.
Last edited by eschwartz (2018-11-14 22:37:54)
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
Welcome back abcd567
I was hoping you'd post this to get some feedback, please don't take any of the following posts too harshly.
That isn't a valid pkgver. As you're pulling from git master you need to read VCS package guidelines and write an approprite pkgver function.
Get rid of the whole checkPkg function. This is already automatically handled by makepkg using it's -s flag.
Packaging - does this softwares makefile support a make install target? If so then all of your current package() function can be replaced with a couple of lines.
The .install file - Get rid of it altogether. Seriously. Nearly everything that it does goes against Arch packaging standards. You should never enable services or edit files belonging to another package.
Offline
To elaborate on the elimination of the checkPkg function, those packages should likely just be listed in the 'makedepends' array. See the wiki:
https://wiki.archlinux.org/index.php/PKGBUILD
But also note that there is no need to list any of those packages that are already in the base-devel group (which is all of them except for git, so just add `makedepends=(git)`).
On a tangential note, never ever use `pacman -Sy $packagename`. The attempt to automate the use of such a command on other people's systems is likely a major contributor to the above-mentioned ban-worthiness. It's certainly unintentional on your part, but you should take time to learn why that would be such an offense.
Please see example or existing PKGBUILDs in the AUR to see how things are done. Most of what you have done is well meaning, but quite inappropriate.
Last edited by Trilby (2018-11-14 22:47:16)
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Online
Thanks eschwartz, Slithery, and Trilby for your valuable comments and suggestions. Any way I have not yet posted it in AUR repository, and I do not intend to post it there.
I have posted it here to get feedback and suggestions.
Last edited by abcd567 (2018-11-14 23:02:08)
Offline
One more point:
In the Arch linux x64_86 on my Desktop, I have base-devel, but in alarmpi on Raspberry Pi, there is no base-devel. It is basically for AlarmPi that I had to add function "checkPackage".
I will now try replacing "checkPackage" by "makedepends"
Last edited by abcd567 (2018-11-14 23:19:59)
Offline
but in alarmpi on Raspberry Pi, there is no base-devel. It is basically for AlarmPi that I had to add function "checkPackage".
You are incorrect. archlinuxarm uses the same PKGBUILDs we do, and only changes things when it is needed to compile -- and then, they track our package to reduce deviations. The package group definitively exists. Their forum has lots of discussion about building packages, and lots of mentioning base-devel.
I will now try replacing "checkPackage" by "makedepends"
It is wrong to have base-devel packages in makedepends.
There are recent cases (the pkg-config to pkgconf migration) where this has resulted in packages that were impossible to build. (pkgconf provides pkg-config, but it doesn't provide a *versioned* pkg-config, and there were silly packages that not only makedepends on pkg-config, but on a *versioned* makedepends of it!)
Similarly, gcc-multilib is often used by packages that are lib32, but this is wrong and users should install multilib-devel... because it is now a "provides" for the core/gcc package which does *not* allow you to build 32-bit ABI code, but its optional dependency "lib32-gcc-libs" does.
People should *not* try to outsmart the base-devel system.
Managing AUR repos The Right Way -- aurpublish (now a standalone tool)
Offline
In the Arch linux x64_86 on my Desktop, I have base-devel, but in alarmpi on Raspberry Pi, there is no base-devel. It is basically for AlarmPi that I had to add function "checkPackage".
Unfortunately we can't help you with that here. These forums are for Arch Linux support only - Arch Linux ARM is a different project run by different people.
Their forums have some just as knowledgeable folk as us (sometimes even the same people) that can help you with that issue
Offline
Done Today:
(1) Formatted Hard Drive and did a fresh install of Arch Linux with base and base-devel.
(2) From my PKGBUILD file:
(a) Removed function checkPkg and all checkPkg $pkg.
(b) Added makedepends=(git)
(3) Ran command makepkg -si.
(a) It installed following packages (with their dependencies):
lighttpd rtl-sdr bladerf git
(b) Made x86_64.pkg.tar.xz package
(c) Installed dump1090-fa
NEXT TO DO
(a) Format microSD card and fresh install of Alarm Pi
(b) Test modified PKGBUILD on RPi
MODIFIED PKGBUILD
#Creater: abcd567
#Maintener: abcd567
pkgname=dump1090-fa
pkgver=latest
pkgrel=1
arch=('x86_64' 'armh6' 'armh7' 'armv6h' 'armv7h')
license=('GPL')
depends=('rtl-sdr' 'lighttpd' 'bladerf')
makedepends=(git)
conflicts=('dump1090'
'dump1090-mutability'
'dump1090-mutability-git'
'dump1090-fa-git'
'dump1090-git'
'dump1090_mr-git')
source=('dump1090::git+git://github.com/flightaware/dump1090')
md5sums=('SKIP')
install="foo.install"
build() {
cd ${srcdir}/dump1090
make
}
package() {
mkdir -p ${pkgdir}/usr/bin
cp ${srcdir}/dump1090/dump1090 ${pkgdir}/usr/bin/dump1090-fa
mkdir -p ${pkgdir}/usr/share/dump1090-fa/html
cp -r ${srcdir}/dump1090/public_html/* ${pkgdir}/usr/share/dump1090-fa/html/
mkdir -p ${pkgdir}/etc/default
cp ${srcdir}/dump1090/debian/dump1090-fa.default ${pkgdir}/etc/default/dump1090-fa
mkdir -p ${pkgdir}/usr/lib/systemd/system
cp ${srcdir}/dump1090/debian/dump1090-fa.service ${pkgdir}/usr/lib/systemd/system/dump1090-fa.service
cp -r ${srcdir}/dump1090/debian/lighttpd ${pkgdir}/lighttpd
}
File foo.install (not modified, same as before)
post_install () {
## ENABLE DUMP1090-FA SERVICE
systemctl enable dump1090-fa.service
useradd --system dump1090
## DUMP1090-FA INTEGRATION TO LIGHTTPD
mkdir -p /etc/lighttpd/conf.d
cp -r ${pkgdir}/lighttpd/* /etc/lighttpd/conf.d/
chmod 777 /etc/lighttpd/lighttpd.conf
echo "" >> /etc/lighttpd/lighttpd.conf
echo "server.modules += ( \"mod_alias\" )" >> /etc/lighttpd/lighttpd.conf
echo "include \"/etc/lighttpd/conf.d/*\"" >> /etc/lighttpd/lighttpd.conf
chmod 644 /etc/lighttpd/lighttpd.conf
systemctl enable lighttpd.service
## RESTART LIGHTTPD & DUMP1090-FA
systemctl restart lighttpd
systemctl restart dump1090-fa
echo ""
echo ""
echo "============================================"
echo " T H I N G - TO - DO "
echo "============================================"
echo ""
echo "IMPORTANT: REBOOT COMPUTER/RPi"
echo ""
echo "OTHERWISE DUMP1090-FA WILL FAIL TO START"
echo "AND A ROTATING WHEEL WILL APPEAR ON THE MAP, OR MAP WILL NOT SHOW"
echo ""
echo "To make SkyView Map show range rings, do following"
echo "(1) Open file for editing"
echo "sudo nano /etc/default/dump1090-fa "
echo ""
echo "(2) Go to following line"
echo "RECEIVER_OPTIONS=\"--device-index 0 --gain -10 --ppm 0 --net-bo-port 30005\""
echo "In above line, add your latitude and longitude, so the line becomes like below:"
echo "RECEIVER_OPTIONS=\"--device-index 0 --gain -10 --lat xx.xxxx --lon yy.yyyy --ppm 0 --net-bo-port 30005\""
echo "NOTE: Repalce xx.xxxx and yy.yyyy by your actual latitude and Longitude"
echo ""
echo "(3) Restart dump1090-fa "
echo "sudo systemctl restart dump1090-fa "
echo "(4) Clear browser cache and reload browser"
echo ""
echo ""
}
Offline
That's a good start
But please take a look at the following as well...
That isn't a valid pkgver. As you're pulling from git master you need to read the VCS package guidelines and write an appropriate pkgver function.
The .install file - Get rid of it altogether. Seriously. Nearly everything that it does goes against Arch packaging standards. You should never enable services or edit files belonging to another package.
Offline
That's a good start
But please take a look at the following as well...
Slithery wrote:That isn't a valid pkgver. As you're pulling from git master you need to read the VCS package guidelines and write an appropriate pkgver function.
The .install file - Get rid of it altogether. Seriously. Nearly everything that it does goes against Arch packaging standards. You should never enable services or edit files belonging to another package.
Thanks Slithery for guidance.
I will try to incorporate your advise this weekend.
About foo.install file:
(1) I can remove systemctl enable lighttpd, as it is already enabled and this step is not needed.
(2) I can also remove systemctrl enable dump1090-fa and let it to be manually enabled by the user. In my opinion, if someone installs a custom package, he does this with an intention to use it, and will sure enable it if it is not automatically enabled. So why not to include enabling with installation? or are there user who will install a custom package, but wont enable and wont use it?
(3) The dump1090-fa map display in a browser depends on its integration to lighttpd. The Map display fails if this integration is not done.
To do this integration, following is required to be done:
(a) Create a directory /etc/lighttpd/conf.d and copy dump1090-fa config files from source to this folder.
(b) Add following two lines to lighttpd.config
server.modules += ( "mod_alias" )
include "/etc/lighttpd/conf.d/*"
I tried to do (a) and (b) inside package() { }, but did not succeed, and had do it in foo.install.
I will comeback and report after i attempt to incorporate your advises.
Regards
Last edited by abcd567 (2018-11-16 18:41:57)
Offline
AlarmPI Update
Formatted microSD card, created new partitions, and installed AlarmPi,slipped microSd card in Raspberry Pi and powered-up.
Tried modified PKGBUILD (one without checkPackage funtion) on AlarmPi.
[alarm@alarmpi dump1090-fa-arch]$ makepkg -si
==> ERROR: Cannot find the strip binary required for object file stripping.
This problem is caused by the fact that AlarmPi does not have binutils.
Looks like AlarmPi has only base, and NOT base-devel
Edited file PKGBUILD and added binutils to makedepends
sudo nano PKGBUILD
#added 'binutils' to 'makedepends'
makedepends=('git' 'binutils')
Re-run makepkg -si
[alarm@alarmpi dump1090-fa-arch]$ makepkg -si
==> ERROR: Cannot find the strip binary required for object file stripping.
So including 'binutils' in makedepends did not help.
How can I make PKGBUILD to install binutils right at start? Any suggestions?
Thanks in advance.
Regards
Last edited by abcd567 (2018-11-16 19:03:56)
Offline
As has been pointed out to you, you are incorrect in your assertation that there is no base-devel group in Arch Linux ARM. You are also incorrect in stating that it doesn't have binutils. Installing base-devel would fix all your issues, but in order to understand why you are unable to do so is not an Arch Linux question, and as such you should ask about your issue on the Arch Linux ARM support channels, as you have already been directed to.
Closing.
EDIT: It has been pointed out that you are making an effort and improving your PKGBUILD implementing the community's advice, so I will re-open this thread for the time being. However, any further attempts to solicit support for your Arch Linux ARM build problems will result in the closure being reapplied.
Last edited by WorMzy (2018-11-16 19:36:51)
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
About foo.install file:
(2) I can also remove systemctrl enable dump1090-fa and let it to be manually enabled by the user. In my opinion, if someone installs a custom package, he does this with an intention to use it, and will sure enable it if it is not automatically enabled. So why not to include enabling with installation? or are there user who will install a custom package, but wont enable and wont use it?
All Arch users have services that aren't enabled, have you enabled all of the service files for all of the packages installed on your system? I very much doubt it but if you don't believe me then try...
systemctl list-unit-files --type=service --state=disabled
and post the output. If you want the service files to be automatically enabled for every package that you install then Arch is the wrong distro, you should be using Ubuntu instead.
(3) The dump1090-fa map display in a browser depends on its integration to lighttpd. The Map display fails if this integration is not done.
I very much doubt that the entire package depends on lighttpd, more likely if you want to use the map functionality then you need to have any web server properly configured. I use nginx for all of my web-servers, why should you force me to install and configure lighttpd if it's unneeded on my system?
To do this integration, following is required to be done:
(a) Create a directory /etc/lighttpd/conf.d and copy dump1090-fa config files from source to this folder.
If you wish to install a config drop-in for lighttpd then that's fine, but it should be done as part of the package() function instead of an install script.
(b) Add following two lines to lighttpd.config
server.modules += ( "mod_alias" )
include "/etc/lighttpd/conf.d/*"
You should never ever alter files owned by another package.
Seriously, get rid of your install script.
Offline
There is dump1090-fa.service which uses the dump1090 user. dump1090-fa.service does contain any dependency on lighttpd.service and the reverse is also true.
If the two service files are correct the services can operate independently.
Edit:
Minor point in the package function you could swap the mkdir and cp calls to install.
Last edited by loqs (2018-11-16 21:16:40)
Offline
Thanks everybody for your participation and comments/advises.
I will attempt to modify my code according to your comments/advises during weekend.
Regards
Offline
Thanks everyone for your participation, comments and advises.
Unfortunately this weekend I did not find time to modify the code according to your advises/comments. I will do it when I get time, possibly next weekend.
All Arch users have services that aren't enabled
Agreed. I will remove "systemctl enable dump1090-fa" and "systemctl enable lighttpd" from foo.install, and leave this to be done by user manually.
I very much doubt that the entire package depends on lighttpd, more likely if you want to use the map functionality then you need to have any web server properly configured. I use nginx for all of my web-servers, why should you force me to install and configure lighttpd if it's unneeded on my system?
You are right. The dump1090-fa package does NOT depend on lighttpd or any other webserver. It performs (1) receiver, (2) decoder, and (3) map generator function independently.
Only when it's generated map is required to be served in a browser, it depends on a web server like lighttpd.
The installation of lighttpd has been chosen by the author of the dump1090-fa source code as a "dependency", and he has included in source code, the files to be added to lighttpd config by adding following line:
include "/path/to/dump1090-fa configuration files"
There is dump1090-fa.service which uses the dump1090 user. dump1090-fa.service does contain any dependency on lighttpd.service and the reverse is also true.
If the two service files are correct the services can operate independently.
This is right. The two services run independently of each other, except when it comes to serving dump1090-fa's map to a browser.
The dump1090-fa has 3 functions:
(1) 1090 Mhz Receiver Software SDR (Software Defined Radio)
(2) Decoder of ADS-B RF Signals received from airplanes.
(3) Map Generator (plotting airplanes on Openstreet map)
All these functions are independent of lighttpd or any web server, but to display the generated map in a browser, it requires lighttpd. This is where webserver's config is to be modified for dump1090-fa.
Minor point in the package function you could swap the mkdir and cp calls to install.
Good point. Will do it. This will bring the code in line with standard practice.
Thank you all,
Regards
Offline
The current release of Stratux European Edition compiles and runs on X86_64 as well as ARM.
https://github.com/b3nn0/stratux
Maybe could make a PKGBUILD for it pretty easily, but I haven’t made any PKGBUILDs since they switched over to the git format on AUR.
Go is one of the build dependencies.
Last edited by nomorewindows (2021-12-05 20:51:49)
I may have to CONSOLE you about your usage of ridiculously easy graphical interfaces...
Look ma, no mouse.
Offline
Good information. I am going to use this opportunity to close this old thread.
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Online
Pages: 1
Topic closed