diff options
author | Sebastian Schmelzer | 2010-09-14 18:25:02 +0200 |
---|---|---|
committer | Sebastian Schmelzer | 2010-09-14 18:25:02 +0200 |
commit | 43060a928b8da46cba6d9c9f46c83aa1f65f81a9 (patch) | |
tree | bb06b9ab12cb9347ce663ed8b6c36305a18ca36e /Makefile | |
parent | Merge branch 'master' of git+ssh://git.openslx.org/openslx/core (diff) | |
download | core-43060a928b8da46cba6d9c9f46c83aa1f65f81a9.tar.gz core-43060a928b8da46cba6d9c9f46c83aa1f65f81a9.tar.xz core-43060a928b8da46cba6d9c9f46c83aa1f65f81a9.zip |
makefile uses new installer now
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 304 |
1 files changed, 23 insertions, 281 deletions
@@ -10,296 +10,38 @@ # enforce the use of bash (/bin/sh might be a link to incomplete shells) SHELL = /bin/bash +INSTALLER = ./tools/installer -# the following defaults should be filled via 'configure' -# and each of them can be overriden by setting the environment variable -# in the shell that executes this Makefile -ifeq ($(USR_BIN_PATH),) - USR_BIN_PATH = /usr/bin -endif +# the following defaults can be overwritten by exporting the new value before +# running make +# USR_BIN_PATH = /usr/bin +# SLX_CONFIG_PATH = /etc/opt/openslx +# SLX_BASE_PATH = /opt/openslx +# SLX_PRIVATE_PATH = /var/opt/openslx +# SLX_PUBLIC_PATH = /srv/openslx +# SLX_TEMP_PATH = /tmp +# SLX_INSTALL_LOG = install.log -ifeq ($(SLX_CONFIG_PATH),) - SLX_CONFIG_PATH = /etc/opt/openslx -endif -ifeq ($(SLX_BASE_PATH),) - SLX_BASE_PATH = /opt/openslx -endif -ifeq ($(SLX_PRIVATE_PATH),) - SLX_PRIVATE_PATH = /var/opt/openslx -endif -ifeq ($(SLX_PUBLIC_PATH),) - SLX_PUBLIC_PATH = /srv/openslx -endif -ifeq ($(SLX_TEMP_PATH),) - SLX_TEMP_PATH = /tmp -endif - -ifeq ($(SLX_INSTALL_LOG),) - SLX_INSTALL_LOG = install.log -endif +all: + @echo "Nothing to build.. Just run make install!" tarball: - @OPENSLX_VERSION_SVNREV=$$( svnversion .); \ - if test "$${OPENSLX_SVN_SNAPSHOT}" = "0"; then \ - unset OPENSLX_SVN_SNAPSHOT; \ - echo "OPENSLX_SVN_SNAPSHOT=\"0\"" \ - >REVISION; \ - else \ - OPENSLX_SVN_SNAPSHOT="1"; \ - rm -f REVISION; \ - fi; \ - . ./VERSIONS; \ - echo "OPENSLX_VERSION_SVNREV=\"$${OPENSLX_VERSION_SVNREV}\"" \ - >>REVISION; \ - echo "Creating OpenSLX $${OPENSLX_VERSION_STRING} tar ball "; \ - svn_repo_name=$$( pwd); \ - svn_repo_name="$${svn_repo_name##*/}"; \ - if ! test -d "../openslx-$${OPENSLX_VERSION_STRING}"; then \ - cd .. >/dev/null; \ - mkdir "openslx-$${OPENSLX_VERSION_STRING}"; \ - mount --bind "$${svn_repo_name}" "openslx-$${OPENSLX_VERSION_STRING}"; \ - cd - >/dev/null; \ - OPENSLX_SOURCEDIR_BINDMOUNT_CREATED="yes"; \ - fi; \ - echo -e "$(SLX_CONFIG_PATH)\n\ -$(SLX_BASE_PATH)\n\ -$(SLX_PRIVATE_PATH)\n\ -$(SLX_PUBLIC_PATH)\n\ -$(USR_BIN_PATH)/*" \ - >packaging/rpm/openslx-filelist; \ - cd .. >/dev/null; \ - tar cfhj \ - "$${svn_repo_name}/openslx-$${OPENSLX_VERSION_STRING}.tar.bz2" \ - --exclude-from="$${svn_repo_name}/Make.exclude_from_tar" \ - "openslx-$${OPENSLX_VERSION_STRING}/"; \ - test "$${OPENSLX_SOURCEDIR_BINDMOUNT_CREATED}" = "yes" && \ - umount "openslx-$${OPENSLX_VERSION_STRING}" && \ - rm -rf "openslx-$${OPENSLX_VERSION_STRING}"; \ - cd - >/dev/null; \ - rm REVISION packaging/rpm/openslx-filelist - -release-tarball: - @export OPENSLX_SVN_SNAPSHOT=0; \ - make tarball - -dep-check: - @if test "${TRACE_INSTALLATION}" = "1"; then set -x; fi; \ - echo "Checking installation requirements..."; \ - echo $$(date) >${SLX_INSTALL_LOG}; \ - if ! perl -e '$$x=2' 2>>${SLX_INSTALL_LOG} ; then \ - echo " Perl is required, please install it."; \ - exit 1; \ - fi; - - @ # many of the following modules are part of core perl, but we check - @ # for them just to be sure... - @for m in Carp Clone Config::General Data::Dumper Cwd DBI Digest::MD5 \ - Digest::SHA1 Encode Exporter Fcntl File::Basename File::Find \ - File::Glob File::Path FindBin Getopt::Long HTTP::Request::Common \ - JSON LWP::UserAgent List::Util MIME::Base64 Pod::Usage \ - POSIX Scalar::Util Socket Storable Sys::Hostname Term::ReadLine \ - Switch URI; do \ - if ! perl -e "use $$m" 2>>${SLX_INSTALL_LOG} ; then \ - echo " The perl module '$$m' is required, please install it."; \ - exit 1; \ - fi; \ - done; - - @ # specific database modules are optional, but we tell the user if - @ # support for a database is missing: - @DEFAULT_DB_TYPE=""; \ - if test -e ${SLX_CONFIG_PATH}/settings; then \ - sed ${SLX_CONFIG_PATH}/settings \ - -e "s,=,=\"," -e "s,$$,\"," \ - > /tmp/slxsettings; \ - echo "Reading local settings..."; \ - . /tmp/slxsettings; \ - rm /tmp/slxsettings; \ - fi; \ - for m in $${SLX_DB_TYPE} SQLite mysql; do \ - if ! perl -Ilib -Iconfig-db -e "use OpenSLX::MetaDB::$$m" 2>>${SLX_INSTALL_LOG} ; then \ - echo -e " 'DBD::$$m' not found (or too old), so $$m-databases will not be \ -supported."; \ - else \ - if test "$${DEFAULT_DB_TYPE}X" = "X"; then \ - DEFAULT_DB_TYPE=$$m; \ - echo " db-type => $$m"; \ - fi; \ - fi; \ - done; \ - if test "$${DEFAULT_DB_TYPE}X" = "X"; then \ - echo " None of the DB-modules is available! Please install one of them."; \ - exit 1; \ - else \ - echo $${DEFAULT_DB_TYPE} >DEFAULT-DB-TYPE; \ - fi; \ - if ! which rsync >/dev/null 2>&1; then \ - echo " rsync is required, please install it."; \ - exit 1; \ - fi; - - -plain-install: - @if test "${TRACE_INSTALLATION}" = "1"; then set -x; fi; \ - echo "Installing OpenSLX project files"; \ - mkdir -p $(SLX_BUILD_PATH)$(SLX_CONFIG_PATH)/boot-env/syslinux/themes \ - -p $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/lib \ - -p $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/bin \ - -p $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/share/boot-env \ - -p $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/share/initramfs \ - -p $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/share/squashfs \ - -p $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/share/templates \ - -p $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/share/ramfstools \ - -p $(SLX_BUILD_PATH)${USR_BIN_PATH}; - - @ # copy license - @cp COPYING $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/; - - @ # copy all PERL-scripts and their required modules: - @cp bin/slx* $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/bin/; \ - cp config-db/slx* $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/bin/; \ - cp installer/slx* $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/bin/; \ - cp os-plugins/slx* $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/bin/; \ - cp tools/uclibc-wrapper $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/bin/; \ - tar --exclude=.svn -cp -C lib OpenSLX \ - | tar -xp -C $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/lib; \ - tar --exclude=.svn -cp -C boot-env OpenSLX \ - | tar -xp -C $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/lib; \ - tar --exclude=.svn -cp -C config-db OpenSLX \ - | tar -xp -C $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/lib; \ - tar --exclude=.svn -cp -C installer OpenSLX \ - | tar -xp -C $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/lib; \ - tar --exclude=.svn -cp -C os-plugins OpenSLX \ - | tar -xp -C $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/lib; \ - tar --exclude=.svn -cp -C os-plugins plugins \ - | tar -xp -C $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/lib; \ + @$(INSTALLER) build-tarball + +rpm: + @$(INSTALLER) build-rpm - @ # copy distro-info (some parts into /opt, others into /etc): - @tar --exclude=.svn --exclude=*.example \ - -cp -C lib distro-info \ - | tar -xp -C $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/share; \ - tar --exclude=.svn --exclude=prereqfiles --exclude=trusted-package-keys/* \ - --exclude=*.default --exclude=mirrors \ - -cp -C lib distro-info \ - | tar -xp -C $(SLX_BUILD_PATH)$(SLX_CONFIG_PATH); \ +deb: + @$(INSTALLER) build-deb - @ # link all binaries & scripts into user-path: - @ln -sf $(SLX_BASE_PATH)/bin/slx* $(SLX_BUILD_PATH)$(USR_BIN_PATH)/; \ - - @ # copy shareable data: - @tar --exclude=.svn -cp -C initramfs stage3-stuff/ | \ - tar -xp --strip-components 1 \ - -C $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/share/initramfs; \ - tar --exclude=.svn -cp -C initramfs tools | \ - tar -xp --strip-components 1 \ - -C $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/share/ramfstools; \ - tar --exclude=.svn -cp -C initramfs distro-specs | \ - tar -xp -C $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/share; \ - tar --exclude=.svn -cp -C initramfs uclib-rootfs | \ - tar -xp -C $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/share; \ - tar --exclude=.svn --exclude *.example --exclude OpenSLX -cp boot-env | \ - tar -xp -C $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/share/; \ - cp -p boot-env/syslinux/pxemenu-*.example boot-env/syslinux/README.pxe \ - $(SLX_BUILD_PATH)$(SLX_CONFIG_PATH)/boot-env/syslinux/; \ - cp -p tools/mksquashfs $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/share/squashfs/mksquashfs_3_2; \ - cp -p initramfs/eglibc-packages/mksquashfs/usr/bin/mksquashfs_3_3 \ - $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/share/squashfs/; \ - cp -p initramfs/eglibc-packages/mksquashfs/usr/bin/mksquashfs_4 \ - $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/share/squashfs/; \ - tar --exclude=.svn -cp -C initramfs tpm | \ - tar -xp -C $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/share; \ - - @ # link the library loader for the uclibc (to use the uclibc busybox) - @ ln -sf ${SLX_BASE_PATH}/share/uclib-rootfs/lib/ld-uClibc.so.0 \ - /lib/ld-uClibc.so.0 - -postinstall: - @ # create default config folder hierarchy: - @perl -Ilib -e 'use OpenSLX::ConfigFolder; createConfigFolderForDefaultSystem();' - - @ # create complete default settings and empty local settings file: - @echo -e "# default setup for OpenSLX-installation\ -\n\ -\n# paths that are fixed at packaging/installation time:\ -\nSLX_BASE_PATH=${SLX_BASE_PATH}\ -\nSLX_CONFIG_PATH=${SLX_CONFIG_PATH}\ -\n\ -\n# paths which can be adjusted after installation:\ -\nSLX_PRIVATE_PATH=${SLX_PRIVATE_PATH}\ -\nSLX_PUBLIC_PATH=${SLX_PUBLIC_PATH}\ -\nSLX_TEMP_PATH=${SLX_TEMP_PATH}\n" \ - > $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/share/settings.default; \ - test -e $(SLX_BUILD_PATH)$(SLX_CONFIG_PATH)/settings || \ - echo -e "# Local setup for OpenSLX (overrides default settings).\ -\n#\n# Please look at $(SLX_BASE_PATH)/share/settings.default and the docs to learn\ -\n# about the available options.\n" \ - > $(SLX_BUILD_PATH)$(SLX_CONFIG_PATH)/settings; \ - - @ # create slxversion script: - @if test -e REVISION; then \ - . REVISION; \ - else \ - OPENSLX_VERSION_SVNREV=$$(svnversion .); \ - fi; \ - test "$${OPENSLX_SVN_SNAPSHOT}" = "0" && \ - unset OPENSLX_SVN_SNAPSHOT || \ - OPENSLX_SVN_SNAPSHOT="1"; \ - . ./VERSIONS; \ - echo -e "#! /bin/sh\n\necho $${OPENSLX_VERSION_STRING}" \ - > $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/bin/slxversion; \ - chmod a+x $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/bin/slxversion; \ - ln -sf $(SLX_BASE_PATH)/bin/slxversion $(SLX_BUILD_PATH)$(USR_BIN_PATH)/; \ - - @ # set default db-type: - @DEFAULT_DB_TYPE=$$(cat DEFAULT-DB-TYPE); \ - rm DEFAULT-DB-TYPE; \ - echo -n ' '; slxsettings set db-type="$${DEFAULT_DB_TYPE}"; - -install: check-upgrade dep-check plain-install postinstall - -prepare_upgrade: - @rm -rf $(SLX_BASE_PATH) - @rm -f $(USR_BIN_PATH)/slx* +install: + @$(INSTALLER) install uninstall: - @echo "Uninstalling openslx.org project files but keeping configs \ -and stage1" - @rm -rf $(SLX_BASE_PATH) - @echo "keeping files in $(SLX_CONFIG_PATH)" - @echo "keeping files in $(SLX_PRIVATE_PATH)" - @rm -rf $(SLX_PUBLIC_PATH) - @rm -f $(USR_BIN_PATH)/slx* - @rm -f /lib/ld-uClibc.so.0 + @$(INSTALLER) uninstall mrproper: - @echo "Wiping all!" - @rm -rf $(SLX_BASE_PATH) - @rm -rf $(SLX_CONFIG_PATH) - @rm -rf $(SLX_PRIVATE_PATH) - @rm -rf $(SLX_PUBLIC_PATH) - @rm -f $(USR_BIN_PATH)/slx* - -check-upgrade: - @ # find out if there is an older version installed and, if so, clean that - @INSTALLED_VERSION=$$(slxversion 2>/dev/null); \ - if ! test -z "$${INSTALLED_VERSION}"; then \ - if test -e REVISION; then \ - . REVISION; \ - else \ - OPENSLX_VERSION_SVNREV=$$(svnversion .); \ - fi; \ - test "$${OPENSLX_SVN_SNAPSHOT}" = "0" && \ - unset OPENSLX_SVN_SNAPSHOT || \ - OPENSLX_SVN_SNAPSHOT="1"; \ - . ./VERSIONS; \ - if test $${INSTALLED_VERSION} != $${OPENSLX_VERSION_STRING}; then \ - echo "preparing upgrade from version ($${INSTALLED_VERSION})"; \ - make prepare_upgrade; \ - fi; \ - fi + @$(INSTALLER) mrproper clean: - @echo "Cleanup OpenSLX source directory " - @for file in $(SLX_INSTALL_LOG) openslx-*.tar.bz2; do \ - rm -f $${file}; \ - done + @$(INSTALLER) clean |