From 0b7e77cb50c52965234ae8768086fbf50b5f527d Mon Sep 17 00:00:00 2001 From: Sebastien GODARD Date: Mon, 16 Mar 2015 21:14:34 +0100 Subject: [PATCH] Additional fixes for system w/o systemd For systems without systemd, some variables may get expanded into empty strings, eg.: if [ -z "$(SYSTEMD_UNIT_DIR)" -o ! -d $(DESTDIR)$(SYSTEMD_UNIT_DIR) ]... may be expanded into: if [ -z "" -o ! -d ]... when DESTDIR is also unset. This causes an error when executed: /bin/sh: line 0: [: argument expected The solution is to enclose these variables in double quotes. Signed-off-by: Sebastien GODARD --- Makefile.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile.in b/Makefile.in index 659b6ec..6098a81 100644 --- a/Makefile.in +++ b/Makefile.in @@ -385,7 +385,7 @@ else mkdir -p $(DESTDIR)$(RC_DIR); \ fi endif - if [ -z "$(SYSTEMD_UNIT_DIR)" -o ! -d $(DESTDIR)$(SYSTEMD_UNIT_DIR) ]; then \ + if [ -z "$(SYSTEMD_UNIT_DIR)" -o ! -d "$(DESTDIR)$(SYSTEMD_UNIT_DIR)" ]; then \ if [ -d $(DESTDIR)/etc/cron.d ]; then \ $(INSTALL_DATA) cron/sysstat.crond $(DESTDIR)/etc/cron.d/sysstat; \ elif [ -d $(DESTDIR)/etc/cron.hourly -a -d $(DESTDIR)/etc/cron.daily ]; then \ @@ -394,7 +394,7 @@ endif fi \ fi ifeq ($(COPY_ONLY),n) - if [ \( -z "$(SYSTEMD_UNIT_DIR)" -o ! -d $(DESTDIR)$(SYSTEMD_UNIT_DIR) \) -a ! -d $(DESTDIR)/etc/cron.d ]; then \ + if [ \( -z "$(SYSTEMD_UNIT_DIR)" -o ! -d "$(DESTDIR)$(SYSTEMD_UNIT_DIR)" \) -a ! -d $(DESTDIR)/etc/cron.d ]; then \ if [ ! -d $(DESTDIR)/etc/cron.hourly -o ! -d $(DESTDIR)/etc/cron.daily ]; then \ su $(CRON_OWNER) -c "crontab -l > /tmp/crontab-$(CRON_OWNER).save"; \ $(CP) -a /tmp/crontab-$(CRON_OWNER).save ./crontab-$(CRON_OWNER).`date '+%Y%m%d.%H%M%S'`.save; \ @@ -403,7 +403,7 @@ ifeq ($(COPY_ONLY),n) fi \ fi endif - if [ -n "$(SYSTEMD_UNIT_DIR)" -a -d $(DESTDIR)$(SYSTEMD_UNIT_DIR) ]; then \ + if [ -n "$(SYSTEMD_UNIT_DIR)" -a -d "$(DESTDIR)$(SYSTEMD_UNIT_DIR)" ]; then \ $(INSTALL_DATA) sysstat.service $(DESTDIR)$(SYSTEMD_UNIT_DIR); \ $(INSTALL_DATA) cron/sysstat-collect.service $(DESTDIR)$(SYSTEMD_UNIT_DIR); \ $(INSTALL_DATA) cron/sysstat-collect.timer $(DESTDIR)$(SYSTEMD_UNIT_DIR); \ @@ -435,7 +435,7 @@ endif fi \ fi ifeq ($(COPY_ONLY),n) - if [ -x $(SYSTEMCTL) ]; then \ + if [ -x "$(SYSTEMCTL)" ]; then \ $(SYSTEMCTL) enable sysstat.service; \ fi endif -- 2.40.0