Skip to content

Commit

Permalink
rework make realinstall and uninstall (#3435)
Browse files Browse the repository at this point in the history
- remove -c, the manpage says it is ignored
 - $(DESTDIR)/$(bindir)/. -> $(DESTDIR)$(bindir) and so on
 - install contrib by file glob (*.py, *.sh)
 - split long lines
  • Loading branch information
rusty-snake authored Jun 4, 2020
1 parent 378d0e6 commit dae3933
Showing 1 changed file with 50 additions and 54 deletions.
104 changes: 50 additions & 54 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -93,73 +93,69 @@ distclean: clean

realinstall:
# firejail executable
install -m 0755 -d $(DESTDIR)/$(bindir)
install -c -m 0755 src/firejail/firejail $(DESTDIR)/$(bindir)/.
install -m 0755 -d $(DESTDIR)$(bindir)
install -m 0755 src/firejail/firejail $(DESTDIR)$(bindir)
ifeq ($(HAVE_SUID),yes)
chmod u+s $(DESTDIR)/$(bindir)/firejail
chmod u+s $(DESTDIR)$(bindir)/firejail
endif
# firemon executable
install -c -m 0755 src/firemon/firemon $(DESTDIR)/$(bindir)/.
install -m 0755 src/firemon/firemon $(DESTDIR)$(bindir)
# firecfg executable
install -c -m 0755 src/firecfg/firecfg $(DESTDIR)/$(bindir)/.
install -m 0755 src/firecfg/firecfg $(DESTDIR)$(bindir)
# libraries and plugins
install -m 0755 -d $(DESTDIR)/$(libdir)/firejail
install -m 0644 -t $(DESTDIR)/$(libdir)/firejail $(MYLIBS) $(SECCOMP_FILTERS) src/firecfg/firecfg.config
install -m 0755 -t $(DESTDIR)/$(libdir)/firejail $(SBOX_APPS)
install -m 0755 -d $(DESTDIR)$(libdir)/firejail
install -m 0644 -t $(DESTDIR)$(libdir)/firejail $(MYLIBS) $(SECCOMP_FILTERS) src/firecfg/firecfg.config
install -m 0755 -t $(DESTDIR)$(libdir)/firejail $(SBOX_APPS)
ifeq ($(HAVE_CONTRIB_INSTALL),yes)
install -c -m 0755 contrib/fix_private-bin.py $(DESTDIR)/$(libdir)/firejail/.
install -c -m 0755 contrib/fjclip.py $(DESTDIR)/$(libdir)/firejail/.
install -c -m 0755 contrib/fjdisplay.py $(DESTDIR)/$(libdir)/firejail/.
install -c -m 0755 contrib/fjresize.py $(DESTDIR)/$(libdir)/firejail/.
install -c -m 0755 contrib/fj-mkdeb.py $(DESTDIR)/$(libdir)/firejail/.
install -c -m 0755 contrib/gdb-firejail.sh $(DESTDIR)/$(libdir)/firejail/.
install -c -m 0755 contrib/jail_prober.py $(DESTDIR)/$(libdir)/firejail/.
install -c -m 0755 contrib/sort.py $(DESTDIR)/$(libdir)/firejail/.
install -c -m 0755 contrib/syscalls.sh $(DESTDIR)/$(libdir)/firejail/.
install -c -m 0755 contrib/update_deb.sh $(DESTDIR)/$(libdir)/firejail/.
install -m 0755 -d $(DESTDIR)/$(datarootdir)/vim/vimfiles/ftdetect/.
install -m 0755 -d $(DESTDIR)/$(datarootdir)/vim/vimfiles/syntax/.
install -c -m 0644 contrib/vim/ftdetect/firejail.vim $(DESTDIR)/$(datarootdir)/vim/vimfiles/ftdetect/.
install -c -m 0644 contrib/vim/syntax/firejail.vim $(DESTDIR)/$(datarootdir)/vim/vimfiles/syntax/.
install -m 0755 -t $(DESTDIR)$(libdir)/firejail contrib/*.py contrib/*.sh
# vim syntax
install -m 0755 -d $(DESTDIR)$(datarootdir)/vim/vimfiles/ftdetect
install -m 0755 -d $(DESTDIR)$(datarootdir)/vim/vimfiles/syntax
install -m 0644 contrib/vim/ftdetect/firejail.vim $(DESTDIR)$(datarootdir)/vim/vimfiles/ftdetect
install -m 0644 contrib/vim/syntax/firejail.vim $(DESTDIR)$(datarootdir)/vim/vimfiles/syntax
endif
# documents
install -m 0755 -d $(DESTDIR)/$(DOCDIR)
install -c -m 0644 COPYING $(DESTDIR)/$(DOCDIR)/.
install -c -m 0644 README $(DESTDIR)/$(DOCDIR)/.
install -c -m 0644 RELNOTES $(DESTDIR)/$(DOCDIR)/.
install -c -m 0644 etc/templates/* $(DESTDIR)/$(DOCDIR)/.
# etc files
install -m 0755 -d $(DESTDIR)$(DOCDIR)
install -m 0644 -t $(DESTDIR)$(DOCDIR) COPYING README RELNOTES etc/templates/*
ifeq ($(BUSYBOX_WORKAROUND),yes)
./mketc.sh
endif
install -m 0755 -d $(DESTDIR)/$(sysconfdir)/firejail
install -m 0644 -t $(DESTDIR)/$(sysconfdir)/firejail etc/profile-a-l/*.profile etc/profile-m-z/*.profile etc/inc/*.inc etc/net/*.net etc/firejail.config
sh -c "if [ ! -f $(DESTDIR)/$(sysconfdir)/firejail/login.users ]; then install -c -m 0644 etc/login.users $(DESTDIR)/$(sysconfdir)/firejail/.; fi;"
install -m 0755 -d $(DESTDIR)$(sysconfdir)/firejail
install -m 0644 -t $(DESTDIR)$(sysconfdir)/firejail etc/profile-a-l/*.profile etc/profile-m-z/*.profile etc/inc/*.inc etc/net/*.net etc/firejail.config
if [ ! -f $(DESTDIR)$(sysconfdir)/firejail/login.users ]; then \
install -m 0644 etc/login.users $(DESTDIR)$(sysconfdir)/firejail \
fi
ifeq ($(HAVE_APPARMOR),-DHAVE_APPARMOR)
# install apparmor profile
sh -c "if [ ! -d $(DESTDIR)/$(sysconfdir)/apparmor.d ]; then install -d -m 755 $(DESTDIR)/$(sysconfdir)/apparmor.d; fi;"
install -c -m 0644 etc/apparmor/firejail-default $(DESTDIR)/$(sysconfdir)/apparmor.d/.
sh -c "if [ ! -d $(DESTDIR)/$(sysconfdir)/apparmor.d/local ]; then install -d -m 755 $(DESTDIR)/$(sysconfdir)/apparmor.d/local; fi;"
if [ ! -d $(DESTDIR)$(sysconfdir)/apparmor.d ]; then \
install -m 0755 -d $(DESTDIR)$(sysconfdir)/apparmor.d \
fi
install -m 0644 etc/apparmor/firejail-default $(DESTDIR)$(sysconfdir)/apparmor.d
if [ ! -d $(DESTDIR)$(sysconfdir)/apparmor.d/local ]; then \
install -m 0755 -d $(DESTDIR)$(sysconfdir)/apparmor.d/local \
fi
# install apparmor profile customization file
sh -c "if [ ! -f $(DESTDIR)/$(sysconfdir)/apparmor.d/local/firejail-local ]; then install -c -m 0644 etc/apparmor/firejail-local $(DESTDIR)/$(sysconfdir)/apparmor.d/local/.; fi;"
if [ ! -f $(DESTDIR)$(sysconfdir)/apparmor.d/local/firejail-local ]; then \
install -m 0644 etc/apparmor/firejail-local $(DESTDIR)$(sysconfdir)/apparmor.d/local \
fi
endif
# man pages
install -m 0755 -d $(DESTDIR)/$(mandir)/man1
install -m 0755 -d $(DESTDIR)/$(mandir)/man5
install -m 0755 -d $(DESTDIR)$(mandir)/man1 $(DESTDIR)$(mandir)/man5
for man in $(MANPAGES); do \
rm -f $$man.gz; \
gzip -9n $$man; \
case "$$man" in \
*.1) install -c -m 0644 $$man.gz $(DESTDIR)/$(mandir)/man1/; ;; \
*.5) install -c -m 0644 $$man.gz $(DESTDIR)/$(mandir)/man5/; ;; \
*.1) install -m 0644 $$man.gz $(DESTDIR)$(mandir)/man1/; ;; \
*.5) install -m 0644 $$man.gz $(DESTDIR)$(mandir)/man5/; ;; \
esac; \
done
rm -f $(MANPAGES) $(MANPAGES:%=%.gz)
# bash completion
install -m 0755 -d $(DESTDIR)/$(datarootdir)/bash-completion/completions
install -c -m 0644 src/bash_completion/firejail.bash_completion $(DESTDIR)/$(datarootdir)/bash-completion/completions/firejail
install -c -m 0644 src/bash_completion/firemon.bash_completion $(DESTDIR)/$(datarootdir)/bash-completion/completions/firemon
install -c -m 0644 src/bash_completion/firecfg.bash_completion $(DESTDIR)/$(datarootdir)/bash-completion/completions/firecfg
install -m 0755 -d $(DESTDIR)$(datarootdir)/bash-completion/completions
install -m 0644 -t $(DESTDIR)$(datarootdir)/bash-completions \
src/bash_completion/firejail.bash_completion \
src/bash_completion/firemon.bash_completion \
src/bash_completion/firecfg.bash_completion

install: all
$(MAKE) realinstall
Expand All @@ -169,19 +165,19 @@ install-strip: all
$(MAKE) realinstall

uninstall:
rm -f $(DESTDIR)/$(bindir)/firejail
rm -f $(DESTDIR)/$(bindir)/firemon
rm -f $(DESTDIR)/$(bindir)/firecfg
rm -fr $(DESTDIR)/$(libdir)/firejail
rm -fr $(DESTDIR)/$(datarootdir)/doc/firejail
rm -f $(DESTDIR)$(bindir)/firejail
rm -f $(DESTDIR)$(bindir)/firemon
rm -f $(DESTDIR)$(bindir)/firecfg
rm -fr $(DESTDIR)$(libdir)/firejail
rm -fr $(DESTDIR)$(datarootdir)/doc/firejail
for man in $(MANPAGES); do \
rm -f $(DESTDIR)/$(mandir)/man5/$$man*; \
rm -f $(DESTDIR)/$(mandir)/man1/$$man*; \
rm -f $(DESTDIR)$(mandir)/man5/$$man*; \
rm -f $(DESTDIR)$(mandir)/man1/$$man*; \
done
rm -f $(DESTDIR)/$(datarootdir)/bash-completion/completions/firejail
rm -f $(DESTDIR)/$(datarootdir)/bash-completion/completions/firemon
rm -f $(DESTDIR)/$(datarootdir)/bash-completion/completions/firecfg
@echo "If you want to install a different version of firejail, you might also need to run 'rm -fr $(DESTDIR)/$(sysconfdir)/firejail', see #2038."
rm -f $(DESTDIR)$(datarootdir)/bash-completion/completions/firejail
rm -f $(DESTDIR)$(datarootdir)/bash-completion/completions/firemon
rm -f $(DESTDIR)$(datarootdir)/bash-completion/completions/firecfg
@echo "If you want to install a different version of firejail, you might also need to run 'rm -fr $(DESTDIR)$(sysconfdir)/firejail', see #2038."

DISTFILES = "src etc m4 platform contrib configure configure.ac Makefile.in install.sh mkman.sh mketc.sh mkdeb.sh.in COPYING README RELNOTES"
DISTFILES_TEST = "test/apps test/apps-x11 test/apps-x11-xorg test/root test/fcopy test/environment test/profiles test/utils test/compile test/filters test/network test/arguments test/fs test/sysutils test/chroot"
Expand Down

0 comments on commit dae3933

Please sign in to comment.