File tree 1 file changed +22
-4
lines changed
1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change 14
14
MAYBE_DISABLE_VERIFY =
15
15
endif
16
16
17
- install : dist-install-dir-$(CFG_BUILD ) | tmp/empty_dir
17
+ install :
18
+ ifeq (root user, $(USER ) $(patsubst % ,user,$(SUDO_USER ) ) )
19
+ # Build the dist as the original user
20
+ $(Q)sudo -u "$$SUDO_USER" $(MAKE) prepare_install
21
+ else
22
+ $(Q)$(MAKE) prepare_install
23
+ endif
18
24
$(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)" "$(MAYBE_DISABLE_VERIFY)"
19
- # Remove tmp files while we can because they may have been created under sudo
25
+ # Remove tmp files because it's a decent amount of disk space
20
26
$(Q)rm -R tmp/dist
21
27
22
- uninstall : dist-install-dir-$(CFG_BUILD ) | tmp/empty_dir
28
+ prepare_install : dist-install-dir-$(CFG_BUILD ) | tmp/empty_dir
29
+
30
+ uninstall :
31
+ ifeq (root user, $(USER ) $(patsubst % ,user,$(SUDO_USER ) ) )
32
+ # Build the dist as the original user
33
+ $(Q)sudo -u "$$SUDO_USER" $(MAKE) prepare_uninstall
34
+ else
35
+ $(Q)$(MAKE) prepare_uninstall
36
+ endif
23
37
$(Q)cd tmp/empty_dir && sh ../../tmp/dist/$(PKG_NAME)-$(CFG_BUILD)/install.sh --uninstall --prefix="$(DESTDIR)$(CFG_PREFIX)" --libdir="$(DESTDIR)$(CFG_LIBDIR)" --mandir="$(DESTDIR)$(CFG_MANDIR)"
24
- # Remove tmp files while we can because they may have been created under sudo
38
+ # Remove tmp files because it's a decent amount of disk space
25
39
$(Q)rm -R tmp/dist
26
40
41
+ prepare_uninstall : dist-install-dir-$(CFG_BUILD ) | tmp/empty_dir
42
+
43
+ .PHONY : install prepare_install uninstall prepare_uninstall
44
+
27
45
tmp/empty_dir :
28
46
mkdir -p $@
29
47
You can’t perform that action at this time.
0 commit comments