In Ubuntu/Debian ditros, the path for the hardlink utility differs
from other distros. Additionally, the tool also differs as it is
a different implementation. This patch fixed both, the path and
required arguments for the hardlink tool.
---
cobbler/action_hardlink.py | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/cobbler/action_hardlink.py b/cobbler/action_hardlink.py
index 33881ab..e19a845 100644
--- a/cobbler/action_hardlink.py
+++ b/cobbler/action_hardlink.py
@@ -37,6 +37,14 @@ class HardLinker:
if logger is None:
logger = clogger.Logger()
self.logger = logger
+ self.distro = utils.check_dist()
+ if self.distro == "ubuntu" or self.distro == "debian":
+ self.hardlink = "/usr/bin/hardlink"
+ self.hardlink_args = "-f -p -o -t -v /var/www/cobbler/ks_mirror
/var/www/cobbler/repo_mirror"
+ else:
+ self.hardlink = "/usr/sbin/hardlink"
+ self.hardlink_args = "-c -v /var/www/cobbler/ks_mirror
/var/www/cobbler/repo_mirror"
+ self.hardlink_cmd = "%s %s" % (self.hardlink, self.hardlink_args)
def run(self):
@@ -49,12 +57,12 @@ class HardLinker:
# FIXME: if these directories become configurable some
# changes will be required here.
- if not os.path.exists("/usr/sbin/hardlink"):
- utils.die(self.logger,"please install 'hardlink'
(/usr/sbin/hardlink) to use this feature")
+ if not os.path.exists(self.hardlink):
+ utils.die(self.logger,"please install 'hardlink' (%s) to use
this feature" % self.hardlink)
self.logger.info("now hardlinking to save space, this may take some
time.")
- rc = utils.subprocess_call(self.logger,"/usr/sbin/hardlink -c -v
/var/www/cobbler/ks_mirror /var/www/cobbler/repo_mirror",shell=True)
+ rc = utils.subprocess_call(self.logger,self.hardlink_cmd,shell=True)
return rc
--
1.7.4.1
Show replies by date