From: Sebastien GODARD Date: Mon, 16 Mar 2015 20:14:34 +0000 (+0100) Subject: Additional fixes for system w/o systemd X-Git-Tag: v11.1.4~34 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0b7e77cb50c52965234ae8768086fbf50b5f527d;p=sysstat 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 --- 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