Skip to content

Commit

Permalink
Install into /usr/local/ by default
Browse files Browse the repository at this point in the history
/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 packaging.

Cherry-picked from cockpit-project/starter-kit@57d7c73d6e32
  • Loading branch information
martinpitt committed May 31, 2023
1 parent e62b08f commit bb3cae3
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down Expand Up @@ -100,12 +101,12 @@ clean:
rm -f po/LINGUAS

install: $(DIST_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: $(DIST_TEST)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ make

# Installing

`sudo make install` installs the package in `/usr/share/cockpit/`. This depends
`sudo make install` installs the package in `/usr/local/share/cockpit/`. This depends
on the `dist` target, which generates the distribution tarball.

You can also run `make rpm` to build RPMs for local installation.
Expand Down
2 changes: 1 addition & 1 deletion packaging/arch/PKGBUILD.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ sha256sums=('SKIP')

package() {
cd $pkgname
make DESTDIR="$pkgdir" install
make DESTDIR="$pkgdir" install PREFIX=/usr
}
2 changes: 1 addition & 1 deletion packaging/cockpit-machines.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ If "virt-install" is installed, you can also create new virtual machines.
# Nothing to build

%install
%make_install
%make_install PREFIX=/usr
appstream-util validate-relax --nonet %{buildroot}/%{_datadir}/metainfo/*

%files
Expand Down
3 changes: 3 additions & 0 deletions packaging/debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ override_dh_auto_clean:

override_dh_auto_test:
# don't call `make check`, these are integration tests

override_dh_auto_install:
make install DESTDIR=debian/cockpit-machines PREFIX=/usr

0 comments on commit bb3cae3

Please sign in to comment.