From 57d7c73d6e32c24f3141329f61627bcdc644ceb4 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Wed, 14 Sep 2022 07:08:45 +0200 Subject: [PATCH] Install into /usr/local/ by default /usr is package manager territory, and not even writable on OSTree based systems such as Fedora CoreOS or RHEL Edge. This has been common and good practice in autotools for decades. You can still override this with `make install PREFIX=...`. Use that in the RPM spec file. --- Makefile | 9 +++++---- README.md | 2 +- packaging/cockpit-starter-kit.spec.in | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 581873c..240f1d6 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ export TEST_OS TARFILE=$(RPM_NAME)-$(VERSION).tar.xz NODE_CACHE=$(RPM_NAME)-node-$(VERSION).tar.xz SPEC=$(RPM_NAME).spec +PREFIX ?= /usr/local APPSTREAMFILE=org.cockpit-project.$(PACKAGE_NAME).metainfo.xml VM_IMAGE=$(CURDIR)/test/images/$(TEST_OS) # stamp file to check for node_modules/ @@ -91,12 +92,12 @@ clean: rm -f po/LINGUAS install: $(WEBPACK_TEST) po/LINGUAS - mkdir -p $(DESTDIR)/usr/share/cockpit/$(PACKAGE_NAME) - cp -r dist/* $(DESTDIR)/usr/share/cockpit/$(PACKAGE_NAME) - mkdir -p $(DESTDIR)/usr/share/metainfo/ + mkdir -p $(DESTDIR)$(PREFIX)/share/cockpit/$(PACKAGE_NAME) + cp -r dist/* $(DESTDIR)$(PREFIX)/share/cockpit/$(PACKAGE_NAME) + mkdir -p $(DESTDIR)$(PREFIX)/share/metainfo/ msgfmt --xml -d po \ --template $(APPSTREAMFILE) \ - -o $(DESTDIR)/usr/share/metainfo/$(APPSTREAMFILE) + -o $(DESTDIR)$(PREFIX)/share/metainfo/$(APPSTREAMFILE) # this requires a built source tree and avoids having to install anything system-wide devel-install: $(WEBPACK_TEST) diff --git a/README.md b/README.md index a0524bb..536fbe7 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ make # Installing -`make install` compiles and installs the package in `/usr/share/cockpit/`. The +`make install` compiles and installs the package in `/usr/local/share/cockpit/`. The convenience targets `srpm` and `rpm` build the source and binary rpms, respectively. Both of these make use of the `dist` target, which is used to generate the distribution tarball. In `production` mode, source files are diff --git a/packaging/cockpit-starter-kit.spec.in b/packaging/cockpit-starter-kit.spec.in index fafc3c1..ad5539f 100644 --- a/packaging/cockpit-starter-kit.spec.in +++ b/packaging/cockpit-starter-kit.spec.in @@ -36,7 +36,7 @@ rm -rf dist ESLINT=0 NODE_ENV=production make %install -%make_install +%make_install PREFIX=/usr # drop source maps, they are large and just for debugging find %{buildroot}%{_datadir}/cockpit/ -name '*.map' | xargs --no-run-if-empty rm --verbose