]> arthur.barton.de Git - ax-linux.git/blob - btrfs/mksnapshot/Makefile
mksnapshot: Only try to install into /etc/apt/apt.conf.d if writable
[ax-linux.git] / btrfs / mksnapshot / Makefile
1 #
2 # ax-linux: Alex' Linux Tools & Scripts
3 # Copyright (c)2013-2014 Alexander Barton (alex@barton.de)
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 #
10
11 ALL = btrfs-mksnapshot btrfs-mksnapshot-rootfs 06btrfs-mksnapshot
12
13 include ../../Makefile.ax
14
15 clean-local:
16         rm -f 06btrfs-mksnapshot
17
18 install-local: $(ALL)
19         install -d -o $(USER) -g $(GROUP) -m 755 \
20          $(DESTDIR)$(PREFIX)/sbin
21         install -p -o $(USER) -g $(GROUP) -m 755 btrfs-mksnapshot \
22          $(DESTDIR)$(PREFIX)/sbin/btrfs-mksnapshot
23         install -p -o $(USER) -g $(GROUP) -m 755 btrfs-mksnapshot-rootfs \
24          $(DESTDIR)$(PREFIX)/sbin/btrfs-mksnapshot-rootfs
25         test -w /etc/apt/apt.conf.d \
26          && make PREFIX= install-local-apt \
27          || make PREFIX=$(PREFIX) install-local-apt
28
29 install-local-apt:
30         install -d -o $(USER) -g $(GROUP) -m 755 \
31          $(DESTDIR)$(PREFIX)/etc/apt/apt.conf.d
32         install -p -o $(USER) -g $(GROUP) -m 644 06btrfs-mksnapshot \
33          $(DESTDIR)$(PREFIX)/etc/apt/apt.conf.d/06btrfs-mksnapshot
34
35 06btrfs-mksnapshot: 06btrfs-mksnapshot.tmpl
36         cat 06btrfs-mksnapshot.tmpl | sed -e 's@:PREFIX:@$(PREFIX)@g' \
37          >06btrfs-mksnapshot