[jhbuild/desrt/master] sysid: Use freebsd-version to get the pretty name on FreeBSD
- From: Ting-Wei Lan <lantw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [jhbuild/desrt/master] sysid: Use freebsd-version to get the pretty name on FreeBSD
- Date: Sat, 3 Jan 2015 05:07:00 +0000 (UTC)
commit 494a61f0db088bb48c8b65f2df1ddab7030c44d8
Author: Ting-Wei Lan <lantw src gnome org>
Date: Sat Jan 3 13:01:06 2015 +0800
sysid: Use freebsd-version to get the pretty name on FreeBSD
freebsd-version is a new utility appeared in FreeBSD 10 and later version,
which returns the version of userland. We can fallback to uname on older
version of FreeBSD, but uname reports the version of kernel.
jhbuild/utils/sysid.py | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/jhbuild/utils/sysid.py b/jhbuild/utils/sysid.py
index 04bc224..4719d45 100644
--- a/jhbuild/utils/sysid.py
+++ b/jhbuild/utils/sysid.py
@@ -93,6 +93,26 @@ def get_macos_info():
except:
return False
+def get_freebsd_info():
+ global sys_name
+ global sys_id
+
+ try:
+ ver = subprocess.check_output('freebsd-version').strip()
+
+ sys_name = 'FreeBSD ' + ver
+ return True
+ except:
+ pass
+
+ try:
+ ver = subprocess.check_output(['uname', '-r']).strip()
+
+ sys_name = 'FreeBSD ' + ver
+ return True
+ except:
+ return False
+
def ensure_loaded():
global default_conditions
global sys_name
@@ -133,7 +153,8 @@ def ensure_loaded():
sys_name = "Unknown Linux Distribution (no 'os-release' file)"
elif sys_id.startswith('freebsd'):
- sys_name = 'FreeBSD (%s)' % (sys_id)
+ if not get_freebsd_info():
+ sys_name = 'FreeBSD (%s)' % (sys_id)
elif sys_id.startswith('macos'):
if not get_macos_info():
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]