On Mon, Dec 6, 2010 at 5:24 PM, Carlos Jenkins <hastciberneo@gmail.com> wrote:
Hi,
Check the one used by Miro at line 157 of the source code:
www.getmiro.com
My recommendations:
1. Try not to hard to find "PPC Mac OS X" or something like that, try to
find something small, just like "Win" or "Mac" or something like that.
Now is Win and Mac.
2. Also, always provide an "else", if did you found "Linux" or "X11" at
least give me the option to download the source code tarball, or even
better, set a default package (I vote for .deb xD jejeje). I prefer that the
script offers me wrongly a rpm that anything.
For unknown linuxes let's guess Ubuntu because they are more and their
distro-awareness is probably often lower.
3. Also, separate the architecture from the OS detection and put it in the
first level of the algorythm.
Like so:
Check for "PPC", if found, you already know is MAC, so, why to search for
"Mac"? Already display for Mac PPC.
Then, check for 64bits, i think it was "x86_64"
1. Found? Good, now search for the OS.
2. Not found? Good, it's 32bits (no need to search nothing). Now search for
the OS.
// OS Seach:
"Win"/"Windows" -:: Ok, found.
"Mac" -:: Ok, found.
ELSE (Linux by default (you can search for "X11"/"Linux" if you want))
-- Now decide if it's RPM or DEB
---- Search for "SLED", "Fedora", etc of the distros that use RPM. (Check
this one http://banshee.fm/theme/js/download.js)
---- Not found? Ok, DEB. (As the Banshee link, if specific distros
instrucciones exists, we can search for that specific distro here)
:D
I think is a smarter algorythm. Sorry for the pseudocode, I'm in a hurry, I
hope you can understand it.
O_O
Master.
You just *logarithmed* the *algorithm*.
See:
http://vipinnova.com/libreoffice/download/package-negotiation.js
OS, Arch detection si black magic, we will never get there 100%, but al
least improve the one we have.
This site is very usefull:
http://www.useragentstring.com/pages/useragentstring.php
It is!
This is for Firefox
http://www.useragentstring.com/pages/Firefox/
As you can see, sometimes "Debian" is in the user string, sometimes not. And
that also happens with others distros.
Kind regards
--
http://www.cjenkins.net/
http://csl-tec.softwarelibrecr.org/
--
Unsubscribe instructions: E-mail to website+help@libreoffice.org
List archive: http://www.libreoffice.org/lists/website/
*** All posts to this list are publicly archived for eternity ***
OK now, I took the most popular distros from
http://distrowatch.com/stats.php?section=popularity
and made this:
if (ua.indexOf('Ubuntu') > -1 ||
ua.indexOf('Mint') > -1 ||
ua.indexOf('Debian') > -1 ||
ua.indexOf('Arch') > -1) return 'deb';
if (ua.indexOf('Fedora') > -1 ||
ua.indexOf('SUSE') > -1 ||
ua.indexOf('PCLinuxOS') > -1 ||
ua.indexOf('Mandriva') > -1) return 'rpm';
Does anyone know if any of these package manager associations is wrong?
And, about the user agent infixes, I'm not sure of it for Arch. I'd
say the rest are OK.
Thank you!
--
"Make sure that Office documents very well depends on PROPRIETARY IE
capabilities."
Bill Gates, 1998.
--
Unsubscribe instructions: E-mail to website+help@libreoffice.org
List archive: http://www.libreoffice.org/lists/website/
*** All posts to this list are publicly archived for eternity ***
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.