| 1 |
# baselayout Makefile
|
| 2 |
# Copyright 2006-2011 Gentoo Foundation
|
| 3 |
# Distributed under the terms of the GNU General Public License v2
|
| 4 |
#
|
| 5 |
# We've moved the installation logic from Gentoo ebuild into a generic
|
| 6 |
# Makefile so that the ebuild is much smaller and more simple.
|
| 7 |
# It also has the added bonus of being easier to install on systems
|
| 8 |
# without an ebuild style package manager.
|
| 9 |
|
| 10 |
PV = $(shell cat .pv)
|
| 11 |
PKG = baselayout-$(PV)
|
| 12 |
|
| 13 |
DESTDIR =
|
| 14 |
|
| 15 |
INSTALL_DIR = install -m 0755 -d
|
| 16 |
INSTALL_EXE = install -m 0755
|
| 17 |
INSTALL_FILE = install -m 0644
|
| 18 |
INSTALL_SECURE = install -m 0600
|
| 19 |
|
| 20 |
ifeq ($(OS),)
|
| 21 |
OS=$(shell uname -s)
|
| 22 |
ifneq ($(OS),Linux)
|
| 23 |
OS=BSD
|
| 24 |
endif
|
| 25 |
endif
|
| 26 |
|
| 27 |
KEEP_DIRS-Linux += \
|
| 28 |
/dev \
|
| 29 |
/run \
|
| 30 |
/sys \
|
| 31 |
/usr/src
|
| 32 |
KEEP_DIRS = $(KEEP_DIRS-$(OS)) \
|
| 33 |
/boot \
|
| 34 |
/etc/profile.d \
|
| 35 |
/home \
|
| 36 |
/media \
|
| 37 |
/mnt \
|
| 38 |
/proc \
|
| 39 |
/opt \
|
| 40 |
/root \
|
| 41 |
/usr/local/bin \
|
| 42 |
/usr/local/sbin \
|
| 43 |
/var/cache \
|
| 44 |
/var/empty \
|
| 45 |
/var/lib \
|
| 46 |
/var/lock \
|
| 47 |
/var/log \
|
| 48 |
/var/run \
|
| 49 |
/var/spool
|
| 50 |
|
| 51 |
all:
|
| 52 |
|
| 53 |
clean:
|
| 54 |
|
| 55 |
install:
|
| 56 |
$(INSTALL_DIR) $(DESTDIR)/etc
|
| 57 |
cp -pPR etc/* etc.$(OS)/* $(DESTDIR)/etc/
|
| 58 |
$(INSTALL_DIR) $(DESTDIR)/usr/share/baselayout
|
| 59 |
cp -pPR share.$(OS)/* $(DESTDIR)/usr/share/baselayout/
|
| 60 |
|
| 61 |
layout:
|
| 62 |
# Create base filesytem layout
|
| 63 |
for x in $(KEEP_DIRS) ; do \
|
| 64 |
test -e $(DESTDIR)$$x/.keep && continue ; \
|
| 65 |
$(INSTALL_DIR) $(DESTDIR)$$x || exit $$? ; \
|
| 66 |
touch $(DESTDIR)$$x/.keep || echo "ignoring touch failure; mounted fs?" ; \
|
| 67 |
done
|
| 68 |
# Special dirs
|
| 69 |
install -m 0700 -d $(DESTDIR)/root
|
| 70 |
touch $(DESTDIR)/root/.keep
|
| 71 |
install -m 1777 -d $(DESTDIR)/var/tmp
|
| 72 |
touch $(DESTDIR)/var/tmp/.keep
|
| 73 |
install -m 1777 -d $(DESTDIR)/tmp
|
| 74 |
touch $(DESTDIR)/tmp/.keep
|
| 75 |
-chgrp uucp $(DESTDIR)/var/lock
|
| 76 |
install -m 0775 -d $(DESTDIR)/var/lock
|
| 77 |
# FHS compatibility symlinks stuff
|
| 78 |
ln -snf /var/tmp $(DESTDIR)/usr/tmp
|
| 79 |
|
| 80 |
diststatus:
|
| 81 |
@if [ -z "$(PV)" ] ; then \
|
| 82 |
printf '\nrun: make dist PV=...\n\n'; \
|
| 83 |
exit 1; \
|
| 84 |
fi
|
| 85 |
if test -d .svn ; then \
|
| 86 |
svnfiles=`svn status 2>&1 | egrep -v '^(U|P)'` ; \
|
| 87 |
if test "x$$svnfiles" != "x" ; then \
|
| 88 |
echo "Refusing to package tarball until svn is in sync:" ; \
|
| 89 |
echo "$$svnfiles" ; \
|
| 90 |
echo "make distforce to force packaging" ; \
|
| 91 |
exit 1 ; \
|
| 92 |
fi \
|
| 93 |
fi
|
| 94 |
|
| 95 |
distlive:
|
| 96 |
rm -rf /tmp/$(PKG)
|
| 97 |
cp -r . /tmp/$(PKG)
|
| 98 |
tar jcf /tmp/$(PKG).tar.bz2 -C /tmp $(PKG) --exclude=.svn
|
| 99 |
rm -rf /tmp/$(PKG)
|
| 100 |
ls -l /tmp/$(PKG).tar.bz2
|
| 101 |
|
| 102 |
distsvn:
|
| 103 |
rm -rf $(PKG)
|
| 104 |
svn export -q . $(PKG)
|
| 105 |
echo $(PV) > $(PKG)/.pv
|
| 106 |
svn log . > $(PKG)/ChangeLog.svn
|
| 107 |
tar jcf $(PKG).tar.bz2 $(PKG)
|
| 108 |
rm -rf $(PKG)
|
| 109 |
ls -l $(PKG).tar.bz2
|
| 110 |
|
| 111 |
dist: diststatus distsvn
|
| 112 |
|
| 113 |
.PHONY: all clean install layout dist distforce diststatus
|
| 114 |
|
| 115 |
# vim: set ts=4 :
|