]> arthur.barton.de Git - ax-linux.git/commitdiff
mksnapshot: Only try to install into /etc/apt/apt.conf.d if writable
authorAlexander Barton <alex@barton.de>
Thu, 15 May 2014 08:44:06 +0000 (10:44 +0200)
committerAlexander Barton <alex@barton.de>
Thu, 15 May 2014 08:44:52 +0000 (10:44 +0200)
Use $(PREFIX)/etc/apt/apt.conf.d when /etc/apt/apt.conf.d isn't writable.

btrfs/mksnapshot/Makefile

index f56c7fe0f6d3852dd12eac0f0c3a317c1269e742..49e0cf29cb8dc03c4e71f172f4c8c9ae3500b7e3 100644 (file)
@@ -1,6 +1,6 @@
 #
 # ax-linux: Alex' Linux Tools & Scripts
-# Copyright (c)2013 Alexander Barton (alex@barton.de)
+# Copyright (c)2013-2014 Alexander Barton (alex@barton.de)
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -22,10 +22,15 @@ install-local: $(ALL)
         $(DESTDIR)$(PREFIX)/sbin/btrfs-mksnapshot
        install -p -o $(USER) -g $(GROUP) -m 755 btrfs-mksnapshot-rootfs \
         $(DESTDIR)$(PREFIX)/sbin/btrfs-mksnapshot-rootfs
+       test -w /etc/apt/apt.conf.d \
+        && make PREFIX= install-local-apt \
+        || make PREFIX=$(PREFIX) install-local-apt
+
+install-local-apt:
        install -d -o $(USER) -g $(GROUP) -m 755 \
-        $(DESTDIR)/etc/apt/apt.conf.d
+        $(DESTDIR)$(PREFIX)/etc/apt/apt.conf.d
        install -p -o $(USER) -g $(GROUP) -m 644 06btrfs-mksnapshot \
-        $(DESTDIR)/etc/apt/apt.conf.d/06btrfs-mksnapshot
+        $(DESTDIR)$(PREFIX)/etc/apt/apt.conf.d/06btrfs-mksnapshot
 
 06btrfs-mksnapshot: 06btrfs-mksnapshot.tmpl
        cat 06btrfs-mksnapshot.tmpl | sed -e 's@:PREFIX:@$(PREFIX)@g' \