Skip to content

Commit

Permalink
Merge branch 'master' of git+ssh://www.opensvc.com/home/opensvc/opensvc
Browse files Browse the repository at this point in the history
  • Loading branch information
cvaroqui committed Sep 23, 2018
2 parents 88ad333 + 42d0eb1 commit 2105f0a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
24 changes: 23 additions & 1 deletion bin/postinstall
Expand Up @@ -495,6 +495,17 @@ def activate_SunOS(launcher):
os.symlink(rc, l)
return True

def activate_gentoo(launcher):
logit("begin")
cmd = ['rc-update', 'delete', '-a', 'opensvc']
ret = osrun(' '.join(cmd))
cmd = ['rc-update', 'add', 'opensvc', 'default']
ret = osrun(' '.join(cmd))
if ret > 0:
logit("issue met while trying to install opensvc rc launchers", stderr=True)
return False
return True

def activate_FreeBSD(launcher):
logit("begin")
return True
Expand Down Expand Up @@ -570,7 +581,18 @@ def install_rc():
copyrc = True
reldata = os_release()

if reldata["ID"] in ("ubuntu", "debian") or os.path.exists('/etc/debian_version'):
if reldata["ID"] in ("gentoo"):
rc = '/etc/init.d/opensvc'
params = '/etc/default/opensvc'
src = os.path.join(pathini, 'opensvc.init.debian')
if systemd_mgmt():
logit("gentoo with systemd")
copyrc = False
activate = activate_systemd
else:
logit("gentoo with openrc")
activate = activate_gentoo
elif reldata["ID"] in ("ubuntu", "debian") or os.path.exists('/etc/debian_version'):
rc = '/etc/init.d/opensvc'
params = '/etc/default/opensvc'
src = os.path.join(pathini, 'opensvc.init.debian')
Expand Down
8 changes: 5 additions & 3 deletions lib/rcAssetLinux.py
Expand Up @@ -175,9 +175,10 @@ def _get_os_vendor(self):
"centos": "CentOS",
"fedora": "Fedora",
"caasp": "SuSE",
"gentoo": "Gentoo",
}
if self.os_release.id in vendors:
return vendors[self.os_release.id]
return vendors.get(self.os_release.id, "")
if os.path.exists('/etc/lsb-release'):
with open('/etc/lsb-release') as f:
for line in f.readlines():
Expand Down Expand Up @@ -244,12 +245,13 @@ def _get_os_release_debian_version(self):

def _get_os_release(self):
r = self._get_os_release_os_release()
if r:
if r and r != "/Linux":
return r
files = ['/etc/debian_version',
'/etc/vmware-release',
'/etc/oracle-release',
'/etc/redhat-release']
'/etc/redhat-release',
'/etc/gentoo-release']
if os.path.exists('/etc/SuSE-release'):
v = []
with open('/etc/SuSE-release') as f:
Expand Down
4 changes: 2 additions & 2 deletions lib/rcDevTree.py
Expand Up @@ -181,7 +181,7 @@ def print_dev(self, relation=None, node=None, highlight=[], verbose=False):
if parent_size == 0:
pct = "-"
else:
pct = str(100*self.size//parent_size)+"%"
pct = "%.2f%%" % (100*self.size//parent_size)

node_dev = node.add_node()
node_dev.add_column(self.alias, color.BROWN)
Expand Down Expand Up @@ -218,7 +218,7 @@ def print_dev_bottom_up(self, chain=[], node=None, highlight=[],
if prev_size == 0:
pct = "-"
else:
pct = str(100*used/self.size)+"%"
pct = "%.2f%%" % (100*used//self.size)

node_dev = node.add_node()
node_dev.add_column(self.alias, color.BROWN)
Expand Down

0 comments on commit 2105f0a

Please sign in to comment.