Re: [fpc-pascal] Detecting what is the linux distro
Am 12.10.2010 19:13, schrieb Marco van de Voort: In our previous episode, David W Noon said: ArchLinux does not use a System V init system, but a simpler BSD one. And thus it does not use /etc/init.d, but only /etc/rc.d. So does the BSD init use run levels? Yes. One of the major distinctions between /etc/init.d/ and /etc/rc.d is that the latter is segregated by run levels, so that each daemon can have a different environment for different run levels. .. but the mark of the sysV layout is the script per daemon per runtime level. Sometimes it is simplified by making symlinks though. While classic (pre SysV) Unix (including BSD) has just one or two scripts that handle everything. Modern BSD (like current FreeBSD) currently afaik do have a script per daemon btw, just not the added dimension of runlevels. ArchLinux also uses only one script per daemon which is located in /etc/rc.d/. The only difference that a runlevel has in ArchLinux is whether the multiuser or the singleuser rc file (which is in /etc/) is called. But this doesn't influence the daemons in /etc/rc.d/. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Detecting what is the linux distro
On 11 October 2010 20:51, ik ido...@gmail.com wrote: It's sad to see that there is no specific way to get this information on all distro's but at least I can get it on the most used distros out there. A general problem under Linux (and it's hundreds of distros). That is why I think it is so important to support freedesktop.org and LSB Foundation (Linux Standards Base). They are trying really hard to resolve these problems, *plus* make it easier for software developers to integrate there applications. Luckily the most popular distros (covering probably 90% of linux usage) do try and follow those standards. -- Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net:8080/fpgui/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Detecting what is the linux distro
On 11 October 2010 19:51, ik ido...@gmail.com wrote: Thanks all for the answers. It's sad to see that there is no specific way to get this information on all distro's but at least I can get it on the most used distros out there. Just curious, why would you like to detect this? Henry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Detecting what is the linux distro
On 12 October 2010 09:30, Henry Vermaak wrote: Just curious, why would you like to detect this? I don't know about the original poster, but I for one use such information for our custom security components - generating trial unlock keys for our commercial software. -- Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net:8080/fpgui/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Detecting what is the linux distro
On Tue, Oct 12, 2010 at 09:30, Henry Vermaak henry.verm...@gmail.comwrote: On 11 October 2010 19:51, ik ido...@gmail.com wrote: Thanks all for the answers. It's sad to see that there is no specific way to get this information on all distro's but at least I can get it on the most used distros out there. Just curious, why would you like to detect this? You want to know how to install files for daemons, append information in other existed packages etc... But instead of creating 1000% packages types for each distro, you can for example know that Gentoo and ArchLinux uses /etc/rc.d/ for init deamons. You know that Debian, CentOS, RedHat and few others uses /etc/init.d/ etc... BTW I had a program that created in my ArchLinux /etc/init.d/ and placed it there, while i was the wrong location. Henry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal Ido LINESIP websites: http://www.linesip.com http://www.linesip.co.il ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Detecting what is the linux distro
On Tue, 12 Oct 2010 09:54:35 +0200, ik wrote about Re: [fpc-pascal] Detecting what is the linux distro: On Tue, Oct 12, 2010 at 09:30, Henry Vermaak henry.verm...@gmail.comwrote: [snip] Just curious, why would you like to detect this? You want to know how to install files for daemons, append information in other existed packages etc... But instead of creating 1000% packages types for each distro, you can for example know that Gentoo and ArchLinux uses /etc/rc.d/ for init deamons. You know that Debian, CentOS, RedHat and few others uses /etc/init.d/ etc... Both of those directories are used by virtually all UNIX implementations. /etc/init.d/ contains the init scripts for system daemons, whereas /etc/rc.d/ contains the configuration files that are interpolated into the init scripts to establish environment variables for the daemons. These directories do not have an either/or relationship. This is a consequence of using an init process based on the System V model. Why don't you just use a package manager, such as apt/dpkg, Portage, RPM, etc., instead? Most distros can handle more than one of these. For example, I run Gentoo, and it will handle .deb and .rpm packages, as well as its native Portage ebuilds. -- Regards, Dave [RLU #314465] *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* david.w.n...@ntlworld.com (David W Noon) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* signature.asc Description: PGP signature ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Detecting what is the linux distro
Am 12.10.2010 14:01, schrieb David W Noon: On Tue, 12 Oct 2010 09:54:35 +0200, ik wrote about Re: [fpc-pascal] Detecting what is the linux distro: On Tue, Oct 12, 2010 at 09:30, Henry Vermaak henry.verm...@gmail.comwrote: [snip] Just curious, why would you like to detect this? You want to know how to install files for daemons, append information in other existed packages etc... But instead of creating 1000% packages types for each distro, you can for example know that Gentoo and ArchLinux uses /etc/rc.d/ for init deamons. You know that Debian, CentOS, RedHat and few others uses /etc/init.d/ etc... Both of those directories are used by virtually all UNIX implementations. /etc/init.d/ contains the init scripts for system daemons, whereas /etc/rc.d/ contains the configuration files that are interpolated into the init scripts to establish environment variables for the daemons. These directories do not have an either/or relationship. This is a consequence of using an init process based on the System V model. ArchLinux does not use a System V init system, but a simpler BSD one. And thus it does not use /etc/init.d, but only /etc/rc.d. Why don't you just use a package manager, such as apt/dpkg, Portage, RPM, etc., instead? Most distros can handle more than one of these. For example, I run Gentoo, and it will handle .deb and .rpm packages, as well as its native Portage ebuilds. ArchLinux handles only its own ArchLinux Package Manager format (basically a .tar.gz with some script files) - as far as I'm aware of. Regards, Sven ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Detecting what is the linux distro
On Tue, 12 Oct 2010 16:29:42 +0200, Sven Barth wrote about Re: [fpc-pascal] Detecting what is the linux distro: Am 12.10.2010 14:01, schrieb David W Noon: [snip] This is a consequence of using an init process based on the System V model. ArchLinux does not use a System V init system, but a simpler BSD one. And thus it does not use /etc/init.d, but only /etc/rc.d. So does the BSD init use run levels? One of the major distinctions between /etc/init.d/ and /etc/rc.d is that the latter is segregated by run levels, so that each daemon can have a different environment for different run levels. All of the actual init scripts in my /etc/rc.d/ ultimately resolve to symlinks into /etc/init.d/, which is typical for any System V style system. Indeed, this makes installing a script directly into /etc/rc.d/ a strict no-no under Gentoo, as all insertions into a run level have to be performed by the sysadmin by hand; other Linuxes are more permissive, though. Consequently, I would never want any program to install anything into that directory, except by the rc-update program run by hand. -- Regards, Dave [RLU #314465] *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* david.w.n...@ntlworld.com (David W Noon) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* signature.asc Description: PGP signature ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Detecting what is the linux distro
It's not just that. Lets say you have a UI for IPTables. In Redhat based, it will be located under /etc/sysconfig/iptables . On debian based, it should be under /etc/networking/post-config or something like that (don't have a debian based machine here), and so on... Please note that I do not talk about exited scripts such as Arno's scripts or shorewall, just plain IPTables client, and it's different on each distro. If you require to read settings of the system (that located at /etc/), no one guarantee you that all distro's will store then at the same place. That's the reason why so many software/driver vendors are so reluctant to release Linux support. For example Foomatic drivers for CUPS, the drivers of the printers in Mac OS-X are the same as with Linux, but many vendors ignore Linux just because this mess. So it's not just lets create a package and get over with it, It's not that simple. Ido LINESIP websites: http://www.linesip.com http://www.linesip.co.il On Tue, Oct 12, 2010 at 14:01, David W Noon david.w.n...@ntlworld.comwrote: On Tue, 12 Oct 2010 09:54:35 +0200, ik wrote about Re: [fpc-pascal] Detecting what is the linux distro: On Tue, Oct 12, 2010 at 09:30, Henry Vermaak henry.verm...@gmail.comwrote: [snip] Just curious, why would you like to detect this? You want to know how to install files for daemons, append information in other existed packages etc... But instead of creating 1000% packages types for each distro, you can for example know that Gentoo and ArchLinux uses /etc/rc.d/ for init deamons. You know that Debian, CentOS, RedHat and few others uses /etc/init.d/ etc... Both of those directories are used by virtually all UNIX implementations. /etc/init.d/ contains the init scripts for system daemons, whereas /etc/rc.d/ contains the configuration files that are interpolated into the init scripts to establish environment variables for the daemons. These directories do not have an either/or relationship. This is a consequence of using an init process based on the System V model. Why don't you just use a package manager, such as apt/dpkg, Portage, RPM, etc., instead? Most distros can handle more than one of these. For example, I run Gentoo, and it will handle .deb and .rpm packages, as well as its native Portage ebuilds. -- Regards, Dave [RLU #314465] *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* david.w.n...@ntlworld.com (David W Noon) *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Detecting what is the linux distro
On 12 October 2010 17:06, ik ido...@gmail.com wrote: It's not just that. Lets say you have a UI for IPTables. In Redhat based, it will be located under /etc/sysconfig/iptables . On debian based, it should be under /etc/networking/post-config or something like that (don't have a debian based machine here), and so on... Please note that I do not talk about exited scripts such as Arno's scripts or shorewall, just plain IPTables client, and it's different on each distro. If you require to read settings of the system (that located at /etc/), no one guarantee you that all distro's will store then at the same place. You can't rely on these things. Distros will even change things from version to version. That is why you put things in configuration files and let the maintainers/packagers supply the correct settings in the config files for their distro. This is how hundreds of apps do things. That's the reason why so many software/driver vendors are so reluctant to release Linux support. Nonsense. Most vendors are lazy, some are scared of licensing, etc. Most importantly they think they can get away with not supporting linux because of the small market share. For now. Henry ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Detecting what is the linux distro
In our previous episode, David W Noon said: ArchLinux does not use a System V init system, but a simpler BSD one. And thus it does not use /etc/init.d, but only /etc/rc.d. So does the BSD init use run levels? Yes. One of the major distinctions between /etc/init.d/ and /etc/rc.d is that the latter is segregated by run levels, so that each daemon can have a different environment for different run levels. .. but the mark of the sysV layout is the script per daemon per runtime level. Sometimes it is simplified by making symlinks though. While classic (pre SysV) Unix (including BSD) has just one or two scripts that handle everything. Modern BSD (like current FreeBSD) currently afaik do have a script per daemon btw, just not the added dimension of runlevels. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Detecting what is the linux distro
On 2010-10-11 13:33, ik wrote: Hello List, I'm looking for a proper way to detect the type of Linux distro. At first I thought about /etc/issue, but it seems that some are abusing this file. Many distro's uses /etc/__release, where is their name, but it's not a proper way either to detect, because not everyone uses it. Any additional ideas ? Most distros also include their name in the kernel, so using uname -a could also give a hint. But AFAIK there is no common place where all distros store the name. Kind regards, Torsten Bonde Christiansen. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Detecting what is the linux distro
On 11 October 2010 13:33, ik ido...@gmail.com wrote: At first I thought about /etc/issue, but it seems that some are abusing this file. Many distro's uses /etc/__release, where is their name, but it's not a proper way either to detect, because not everyone uses it. Any additional ideas ? If your distro complies with the LSB standards (most popular distros do), then you should have a /etc/lsb-release text file that you can parse. ~ $ cd /etc etc $ ls -l lsb-release -rw-r--r-- 1 root root 104 2010-07-08 16:55 lsb-release etc $ cat lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=10.04 DISTRIB_CODENAME=lucid DISTRIB_DESCRIPTION=Ubuntu 10.04.1 LTS -- Regards, - Graeme - ___ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net:8080/fpgui/ ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Detecting what is the linux distro
2010/10/11 ik ido...@gmail.com Hello List, I'm looking for a proper way to detect the type of Linux distro. At first I thought about /etc/issue, but it seems that some are abusing this file. Many distro's uses /etc/__release, where is their name, but it's not a proper way either to detect, because not everyone uses it. Any additional ideas ? Thanks, Ido Please, see the function LSGetLinuxDistro ( code.google.com/p/lazsolutions/source/browse/trunk/Core/LSUtils.pas#55); -- Silvio Clécio, *programmer* *ObjectPascal* ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Detecting what is the linux distro
In our previous episode, Graeme Geldenhuys said: file. Many distro's uses /etc/__release, where is their name, but it's not a proper way either to detect, because not everyone uses it. Any additional ideas ? If your distro complies with the LSB standards (most popular distros do), then you should have a /etc/lsb-release text file that you can parse. FC11, no such file, but there is a dir lsb-release.d with the contents 0 -rw-r--r--. 1 root root 0 2010-06-25 11:25 core-4.0-ia32 0 -rw-r--r--. 1 root root 0 2010-06-25 11:25 core-4.0-noarch 0 -rw-r--r--. 1 root root 0 2010-06-25 11:25 graphics-4.0-ia32 0 -rw-r--r--. 1 root root 0 2010-06-25 11:25 graphics-4.0-noarch 0 -rw-r--r--. 1 root root 0 2010-06-25 11:25 printing-4.0-ia32 0 -rw-r--r--. 1 root root 0 2010-06-25 11:25 printing-4.0-noarch ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Detecting what is the linux distro
Marco van de Voort wrote: If your distro complies with the LSB standards (most popular distros do), then you should have a /etc/lsb-release text file that you can parse. FC11, no such file, but there is a dir lsb-release.d with the contents You're not really supposed to be looking at /etc/lsb* files directly. Rather you should run lsb_release. Try lsb_release --all. For the short name of the distribution, something like lsb_release --id --short is appropriate, see the manpage. Michalis ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Detecting what is the linux distro
Thanks all for the answers. It's sad to see that there is no specific way to get this information on all distro's but at least I can get it on the most used distros out there. Ido ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal