diff options
-rw-r--r-- | Makefile | 128 | ||||
-rwxr-xr-x | builddebianpackage | 103 | ||||
-rwxr-xr-x | initramfs/mkdxsinitrd | 2 | ||||
-rw-r--r-- | packaging/default_files/control | 7 |
4 files changed, 73 insertions, 167 deletions
@@ -7,7 +7,6 @@ # # (c) 2006, 2007 - OpenSLX GmbH -DESTDIR = / # enforce the use of bash (/bin/sh might be a link to incomplete shells) SHELL = /bin/bash @@ -24,15 +23,9 @@ endif ifeq ($(SLX_BASE_PATH),) SLX_BASE_PATH = /opt/openslx endif -ifeq ($(SLX_BIN_PATH),) - SLX_BIN_PATH = ${SLX_BASE_PATH}/bin -endif -ifeq ($(SLX_SHARE_PATH),) - SLX_SHARE_PATH = ${SLX_BASE_PATH}/share -endif -ifeq ($(SLX_VMWARE_PATH),) - SLX_VMWARE_PATH = ${SLX_BASE_PATH}/vmware -endif +SLX_BIN_PATH = ${SLX_BASE_PATH}/bin +SLX_SHARE_PATH = ${SLX_BASE_PATH}/share +SLX_VMWARE_PATH = ${SLX_BASE_PATH}/vmware ifeq ($(SLX_PRIVATE_PATH),) SLX_PRIVATE_PATH = /var/opt/openslx @@ -41,12 +34,8 @@ endif ifeq ($(SLX_PUBLIC_PATH),) SLX_PUBLIC_PATH = /srv/openslx endif -ifeq ($(SLX_EXPORT_PATH),) - SLX_EXPORT_PATH = ${SLX_PUBLIC_PATH}/export -endif -ifeq ($(SLX_TFTPBOOT_PATH),) - SLX_TFTPBOOT_PATH = ${SLX_PUBLIC_PATH}/tftpboot -endif +SLX_EXPORT_PATH = ${SLX_PUBLIC_PATH}/export +SLX_TFTPBOOT_PATH = ${SLX_PUBLIC_PATH}/tftpboot ifeq ($(SLX_TEMP_PATH),) SLX_TEMP_PATH = /tmp @@ -55,8 +44,6 @@ endif ifeq ($(SLX_INSTALL_LOG),) SLX_INSTALL_LOG = install.log endif -#When adding new directory variables above, consider to add them to the -#packaging tool for .deb packages too. tarball: @OPENSLX_VERSION_SVNREV=$$( svnversion); \ @@ -149,106 +136,94 @@ supported."; \ echo $${DEFAULT_DB_TYPE} >DEFAULT-DB-TYPE; \ fi; \ echo "Installing OpenSLX project files"; \ - mkdir -p $(DESTDIR)$(SLX_CONFIG_PATH) \ - -p $(DESTDIR)$(SLX_BASE_PATH)/lib \ - -p $(DESTDIR)$(SLX_BIN_PATH) \ - -p $(DESTDIR)$(SLX_SHARE_PATH)/templates \ - -p $(DESTDIR)$(SLX_SHARE_PATH)/initramfs \ - -p $(DESTDIR)$(SLX_SHARE_PATH)/busybox \ - -p $(DESTDIR)$(SLX_SHARE_PATH)/squashfs \ - -p $(DESTDIR)$(SLX_PRIVATE_PATH)/config/default/initramfs \ - -p $(DESTDIR)$(SLX_PRIVATE_PATH)/config/default/rootfs \ - -p $(DESTDIR)$(SLX_PRIVATE_PATH)/db \ - -p $(DESTDIR)$(SLX_PRIVATE_PATH)/stage1 \ - -p $(DESTDIR)$(SLX_PUBLIC_PATH) \ - -p $(DESTDIR)$(SLX_TFTPBOOT_PATH) \ - -p $(DESTDIR)$(SLX_SHARE_PATH)/themes; \ - for dir in $(USR_BIN_PATH); do \ - test -d $(DESTDIR)$${dir} || \ - mkdir -p $(DESTDIR)$${dir}; \ - done; + mkdir -p $(SLX_BUILD_PATH)$(SLX_CONFIG_PATH) \ + -p $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/lib \ + -p $(SLX_BUILD_PATH)$(SLX_BIN_PATH) \ + -p $(SLX_BUILD_PATH)$(SLX_SHARE_PATH)/templates \ + -p $(SLX_BUILD_PATH)$(SLX_SHARE_PATH)/initramfs \ + -p $(SLX_BUILD_PATH)$(SLX_SHARE_PATH)/busybox \ + -p $(SLX_BUILD_PATH)$(SLX_SHARE_PATH)/squashfs \ + -p $(SLX_BUILD_PATH)$(SLX_PRIVATE_PATH)/config/default/initramfs \ + -p $(SLX_BUILD_PATH)$(SLX_PRIVATE_PATH)/config/default/rootfs \ + -p $(SLX_BUILD_PATH)$(SLX_SHARE_PATH)/themes \ + -p $(SLX_BUILD_PATH)${USR_BIN_PATH}; @ # copy license - @cp COPYING $(DESTDIR)$(SLX_BASE_PATH)/; + @cp COPYING $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/; - @ # copy initramfs generator scripts (and inject SLX_CONFIG_PATH, SLX_SHARE_PATH on the way): - @cp ./initramfs/mkdxsinitrd $(DESTDIR)$(SLX_BIN_PATH)/; \ + @ # copy initramfs generator scripts (and inject SLX_CONFIG_PATH, SLX_BASE_PATH on the way): + @cp ./initramfs/mkdxsinitrd $(SLX_BUILD_PATH)$(SLX_BIN_PATH)/; \ sed -e "s,@@@SLX_CONFIG_PATH@@@,$(SLX_CONFIG_PATH)," \ - -e "s,@@@SLX_SHARE_PATH@@@,$(SLX_SHARE_PATH)," \ - -i $(DESTDIR)$(SLX_BIN_PATH)/mkdxsinitrd; + -e "s,@@@SLX_BASE_PATH@@@,$(SLX_BASE_PATH)," \ + -i $(SLX_BUILD_PATH)$(SLX_BIN_PATH)/mkdxsinitrd; @ # copy all PERL-scripts and their required modules: - @cp bin/slx* $(DESTDIR)$(SLX_BIN_PATH)/; \ - cp config-db/slx* $(DESTDIR)$(SLX_BIN_PATH)/; \ - cp installer/slx* $(DESTDIR)$(SLX_BIN_PATH)/; \ + @cp bin/slx* $(SLX_BUILD_PATH)$(SLX_BIN_PATH)/; \ + cp config-db/slx* $(SLX_BUILD_PATH)$(SLX_BIN_PATH)/; \ + cp installer/slx* $(SLX_BUILD_PATH)$(SLX_BIN_PATH)/; \ tar --exclude=.svn -cp -C lib OpenSLX \ - | tar -xp -C $(DESTDIR)$(SLX_BASE_PATH)/lib; \ + | tar -xp -C $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/lib; \ tar --exclude=.svn --exclude *.example \ -cp -C lib distro-info \ - | tar -xp -C $(DESTDIR)$(SLX_SHARE_PATH); \ + | tar -xp -C $(SLX_BUILD_PATH)$(SLX_SHARE_PATH); \ tar --exclude=.svn --exclude prereqfiles --exclude trusted-package-keys/* \ -cp -C lib distro-info \ - | tar -xp -C $(DESTDIR)$(SLX_CONFIG_PATH); \ + | tar -xp -C $(SLX_BUILD_PATH)$(SLX_CONFIG_PATH); \ tar --exclude=.svn -cp -C config-db OpenSLX \ - | tar -xp -C $(DESTDIR)$(SLX_BASE_PATH)/lib; \ + | tar -xp -C $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/lib; \ tar --exclude=.svn -cp -C installer OpenSLX \ - | tar -xp -C $(DESTDIR)$(SLX_BASE_PATH)/lib; \ + | tar -xp -C $(SLX_BUILD_PATH)$(SLX_BASE_PATH)/lib; \ @ # link all binaries & scripts into user-path: - @ln -sf $(SLX_BIN_PATH)/slx* $(DESTDIR)$(USR_BIN_PATH)/; \ - ln -sf $(SLX_BIN_PATH)/mkdxsinitrd $(DESTDIR)$(USR_BIN_PATH)/; \ + @ln -sf $(SLX_BIN_PATH)/slx* $(SLX_BUILD_PATH)$(USR_BIN_PATH)/; \ + ln -sf $(SLX_BIN_PATH)/mkdxsinitrd $(SLX_BUILD_PATH)$(USR_BIN_PATH)/; \ @ # copy shareable data: @cd initramfs/initrd-stuff; tar --exclude=.svn -cp * | \ - tar -xp -C $(DESTDIR)$(SLX_SHARE_PATH)/initramfs; cd ../..; \ + tar -xp -C $(SLX_BUILD_PATH)$(SLX_SHARE_PATH)/initramfs; cd ../..; \ tar --exclude=.svn -cp -C initramfs distro-specs | \ - tar -xp -C $(DESTDIR)$(SLX_SHARE_PATH); \ + tar -xp -C $(SLX_BUILD_PATH)$(SLX_SHARE_PATH); \ cp -p config-db/PXE-template.example \ - $(DESTDIR)$(SLX_CONFIG_PATH)/; \ + $(SLX_BUILD_PATH)$(SLX_CONFIG_PATH)/; \ cp -a installer/default_files/machine-setup.default \ - $(DESTDIR)$(SLX_SHARE_PATH)/templates/; \ + $(SLX_BUILD_PATH)$(SLX_SHARE_PATH)/templates/; \ cp -a installer/default_files/hwdata/{pcitable.local,Cards.local} \ - $(DESTDIR)$(SLX_SHARE_PATH)/templates/; \ + $(SLX_BUILD_PATH)$(SLX_SHARE_PATH)/templates/; \ tar --exclude=.svn -cp -C installer/default_files tftpboot | \ - tar -xp -C $(DESTDIR)$(SLX_SHARE_PATH); \ + tar -xp -C $(SLX_BUILD_PATH)$(SLX_SHARE_PATH); \ cd theming; tar --exclude=.svn -cp * | \ - tar -xp -C $(DESTDIR)$(SLX_SHARE_PATH)/themes; cd ..; \ + tar -xp -C $(SLX_BUILD_PATH)$(SLX_SHARE_PATH)/themes; cd ..; \ cp -pP tools/busybox{,.links,.x86_64,.i586} \ - $(DESTDIR)$(SLX_SHARE_PATH)/busybox/; \ - cp -p tools/mksquashfs $(DESTDIR)$(SLX_SHARE_PATH)/squashfs/; \ + $(SLX_BUILD_PATH)$(SLX_SHARE_PATH)/busybox/; \ + cp -p tools/mksquashfs $(SLX_BUILD_PATH)$(SLX_SHARE_PATH)/squashfs/; \ @ # create pre-/postinit scripts for us in initramfs: @echo -e "#!/bin/sh\n#\n# This script allows the local admin to \ extend the\n# capabilities at the beginning of the initramfs (stage3). \ The toolset is rather\n# restricted and you have to keep in mind that \ stage4 rootfs has the\n# prefix '/mnt'." \ - > $(DESTDIR)$(SLX_PRIVATE_PATH)/config/default/initramfs/preinit.local; \ + > $(SLX_BUILD_PATH)$(SLX_PRIVATE_PATH)/config/default/initramfs/preinit.local; \ echo -e "#!/bin/sh\n#\n# This script allows the local admin to \ extend the\n# capabilities at the end of the initramfs (stage3). The \ toolset is rather\n# restricted and you have to keep in mind that stage4 \ rootfs has the\n# prefix '/mnt'. But you might use some special slx \ functions via\n# inclusion: '. /etc/functions' ..." \ - > $(DESTDIR)$(SLX_PRIVATE_PATH)/config/default/initramfs/postinit.local; \ - chmod u+x $(DESTDIR)$(SLX_PRIVATE_PATH)/config/default/initramfs/*init.local; \ + > $(SLX_BUILD_PATH)$(SLX_PRIVATE_PATH)/config/default/initramfs/postinit.local; \ + chmod u+x $(SLX_BUILD_PATH)$(SLX_PRIVATE_PATH)/config/default/initramfs/*init.local; \ @ # create complete default settings and empty local settings file: @echo -e "# default setup for OpenSLX-installation\ \nSLX_BASE_PATH=${SLX_BASE_PATH}\ -\nSLX_BIN_PATH=${SLX_BIN_PATH}\ \nSLX_CONFIG_PATH=${SLX_CONFIG_PATH}\ -\nSLX_EXPORT_PATH=${SLX_EXPORT_PATH}\ \nSLX_PRIVATE_PATH=${SLX_PRIVATE_PATH}\ \nSLX_PUBLIC_PATH=${SLX_PUBLIC_PATH}\ -\nSLX_SHARE_PATH=${SLX_SHARE_PATH}\ -\nSLX_TEMP_PATH=${SLX_TEMP_PATH}\ -\nSLX_TFTPBOOT_PATH=${SLX_TFTPBOOT_PATH}\ -\nSLX_VMWARE_PATH=${SLX_VMWARE_PATH}\n" \ - > $(DESTDIR)$(SLX_SHARE_PATH)/settings.default; \ - test -e $(DESTDIR)$(SLX_CONFIG_PATH)/settings || \ +\nSLX_TEMP_PATH=${SLX_TEMP_PATH}\n" \ + > $(SLX_BUILD_PATH)$(SLX_SHARE_PATH)/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_SHARE_PATH)/settings.default and the docs to learn\ \n# about the available options.\n" \ - > $(DESTDIR)$(SLX_CONFIG_PATH)/settings; \ + > $(SLX_BUILD_PATH)$(SLX_CONFIG_PATH)/settings; \ @ # create slxversion script: @if test -e REVISION; then \ @@ -261,9 +236,9 @@ functions via\n# inclusion: '. /etc/functions' ..." \ OPENSLX_SVN_SNAPSHOT="1"; \ . ./VERSIONS; \ echo -e "#! /bin/sh\n\necho $${OPENSLX_VERSION_STRING}" \ - > $(DESTDIR)${SLX_BIN_PATH}/slxversion; \ - chmod a+x $(DESTDIR)${SLX_BIN_PATH}/slxversion; \ - ln -sf $(SLX_BIN_PATH)/slxversion $(DESTDIR)$(USR_BIN_PATH)/; \ + > $(SLX_BUILD_PATH)${SLX_BIN_PATH}/slxversion; \ + chmod a+x $(SLX_BUILD_PATH)${SLX_BIN_PATH}/slxversion; \ + ln -sf $(SLX_BIN_PATH)/slxversion $(SLX_BUILD_PATH)$(USR_BIN_PATH)/; \ @ # set default db-type: @DEFAULT_DB_TYPE=$$(cat DEFAULT-DB-TYPE); \ @@ -282,9 +257,10 @@ vmware_install: uninstall: @echo "Uninstalling openslx.org project files but keeping configs \ and stage1" - @echo "files in $(SLX_PRIVATE_PATH) (please remove manually)" + @echo "files in $(SLX_CONFIG_PATH) (please remove manually)" @rm -rf $(SLX_BASE_PATH) @rm -rf $(SLX_PUBLIC_PATH) + @echo "files in $(SLX_PRIVATE_PATH) (please remove manually)" @rm -f $(USR_BIN_PATH)/slx* @rm -f $(USR_BIN_PATH)/mkdxsinitrd diff --git a/builddebianpackage b/builddebianpackage index bf7696c6..355d4832 100755 --- a/builddebianpackage +++ b/builddebianpackage @@ -3,114 +3,43 @@ # This script transforms the openslx project files to debians # binary package format .deb -DEBUG=0 -# This function makes the directory of this script to the present working directory -# It is called within precheck() -# Does also work when called by symbolic links (even for nested links). -goto_script_dir() -{ - [ $DEBUG -ge 2 ] && echo "Aufgerufen wurde $0, checking if it is a link" - calleddetails=`ls -l $0` # get the file flags (e.g. lrwxrwxrwx) - [ $DEBUG -ge 2 ] && echo $calleddetails - - calleddir=${0%/*} # Strip the filename from path - [ $DEBUG -ge 2 ] && echo "Wechsele ins Verzeichnis des aufgerufenen scripts/links ($calleddir)" - cd $calleddir - - while index=`expr index "$calleddetails" "l"`; - [ $index -eq 1 ]; do - - [ $DEBUG -ge 2 ] && echo "It is a link" - target=`echo $calleddetails | awk '{print $NF}'` - [ $DEBUG -ge 2 ] && echo "The target of the link is: $target" - hasslash=`expr index "$target" "/"` - if [ $hasslash -ne 0 ]; then - targetpath=${target%/*} # extract the pathname - [ $DEBUG -ge 2 ] && echo "Following link to $targetpath" - cd $targetpath - else - [ $DEBUG -ge 2 ] && echo "It is in the same directory as the link" - fi - targetfile=`basename $target` - [ $DEBUG -ge 2 ] && echo "The target file of the link is: $targetfile" - calleddetails=`ls -l $targetfile` # get the file flags (e.g. lrwxrwxrwx) - [ $DEBUG -ge 2 ] && echo $calleddetails - done - [ $DEBUG -ge 2 ] && pwd - -} dpkg_deb=`which dpkg-deb` if [ -z "$dpkg_deb" ];then echo "You need the program dpkg-deb (contained in package dpkg) to build a debian package" exit fi -goto_script_dir +# change into folder the this script lives in: +cd $(dirname $(readlink -f $0)) if [ ! -e ./Makefile ]; then echo "There is no makefile in this programs directory (`pwd`)." echo "Please run this script only embedded in the context of an openslx installation" exit fi -# Manipulate the Path, make installs to, by placing it into a temporary directory -mkdir -p /tmp/ld$$ -export USR_BIN_PATH="/tmp/ld$$/usr/bin" -export SLX_CONFIG_PATH="/tmp/ld$$/etc/opt/openslx" -export SLX_BASE_PATH="/tmp/ld$$/opt/openslx" -export SLX_BIN_PATH="${SLX_BASE_PATH}/bin" -export SLX_SHARE_PATH="${SLX_BASE_PATH}/share" -export SLX_VMWARE_PATH="${SLX_BASE_PATH}/vmware" -export SLX_PRIVATE_PATH="/tmp/ld$$/var/opt/openslx" -export SLX_PUBLIC_PATH="/tmp/ld$$/srv/openslx" -export SLX_EXPORT_PATH="${SLX_PUBLIC_PATH}/export" -export SLX_TFTPBOOT_PATH="${SLX_PUBLIC_PATH}/tftpboot" -export SLX_TEMP_PATH="/tmp/ld$$/tmp" -export SLX_INSTALL_LOG="packaging.log" -mkdir -p $USR_BIN_PATH -mkdir -p $SLX_CONFIG_PATH -mkdir -p $SLX_BASE_PATH -mkdir -p $SLX_BIN_PATH -mkdir -p $SLX_SHARE_PATH -mkdir -p $SLX_VMWARE_PATH -mkdir -p $SLX_PRIVATE_PATH -mkdir -p $SLX_PUBLIC_PATH -mkdir -p $SLX_EXPORT_PATH -mkdir -p $SLX_TFTPBOOT_PATH -mkdir -p $SLX_TEMP_PATH -#Now "make install" installs the slx software to /tmp/ld$$ +export SLX_BUILD_PATH=/tmp/slx$$ +mkdir -p $SLX_BUILD_PATH +# "make install" will install the slx software into $SLX_BUILD_PATH if make install; then #Create Temporary working directory - mkdir -p /tmp/ld$$/DEBIAN - mkdir -p /tmp/ld$$/usr/share/man/man1 - cp packaging/default_files/control /tmp/ld$$/DEBIAN/ - cp packaging/default_files/prerm /tmp/ld$$/DEBIAN/ - cp packaging/default_files/postinst /tmp/ld$$/DEBIAN/ - cp packaging/default_files/*.1 /tmp/ld$$/usr/share/man/man1/ - gzip -9 /tmp/ld$$/usr/share/man/man1/* + mkdir -p $SLX_BUILD_PATH/DEBIAN + mkdir -p $SLX_BUILD_PATH/usr/share/man/man1 + cp packaging/default_files/control $SLX_BUILD_PATH/DEBIAN/ + cp packaging/default_files/prerm $SLX_BUILD_PATH/DEBIAN/ + cp packaging/default_files/postinst $SLX_BUILD_PATH/DEBIAN/ + cp packaging/default_files/*.1 $SLX_BUILD_PATH/usr/share/man/man1/ + gzip -9 $SLX_BUILD_PATH/usr/share/man/man1/* #Set permissions - find /tmp/ld$$ -type d|xargs chmod 755 - #Correct symbolic links - #1. find: print all symbolic links in our installation - #2. ls: print the long listing format for the links - #3. awk: extract the link position and link target and print them concatenated with a separator in between - #4. sed: remove the path prefix of our temporary installation for the link target (but not for the link position) - for link in `find /tmp/ld$$ -type l |xargs ls -l| awk '{print $8"_SEPARATOR_"$10}'|sed "s#_SEPARATOR_/tmp/ld$$#_SEPARATOR_#"`; do - # For every link set the corresponding target with stripped prefix - ln -sf ${link#*_SEPARATOR_} ${link%_SEPARATOR_*} - done; - #Correct location references in mkdxsinitrd: - for file in `grep -l --recursive /tmp/ld$$ /tmp/ld$$/* 2>/dev/null`; do - sed -i 's#/tmp/ld[0-9]*##' $file - done; + find $SLX_BUILD_PATH -type d|xargs chmod 755 #Create the package - dpkg-deb --build /tmp/ld$$ > /dev/null + dpkg-deb --build $SLX_BUILD_PATH > /dev/null . ./VERSIONS - mv /tmp/ld$$.deb ./openslx_$OPENSLX_VERSION_STRING.deb + mv $SLX_BUILD_PATH.deb ./openslx_$OPENSLX_VERSION_STRING.deb echo "Written './openslx_$OPENSLX_VERSION_STRING.deb':" ls -lh ./openslx_$OPENSLX_VERSION_STRING.deb fi #Clean up -rm -rf /tmp/ld$$ +#rm -rf $SLX_BUILD_PATH diff --git a/initramfs/mkdxsinitrd b/initramfs/mkdxsinitrd index 157acb0f..6d73bd1b 100755 --- a/initramfs/mkdxsinitrd +++ b/initramfs/mkdxsinitrd @@ -53,7 +53,7 @@ D_XFONTPATH="<set in ~/distro-config/distro file>" D_DEFAULTCOUNTRY="<set in ~/distro-config/distro file>" # read in the global settings SLX_CONFIG_PATH=@@@SLX_CONFIG_PATH@@@ -SLX_SHARE_PATH=@@@SLX_SHARE_PATH@@@ +SLX_SHARE_PATH=@@@SLX_BASE_PATH@@@/share [ -f $SLX_SHARE_PATH/settings.default ] && \ . $SLX_SHARE_PATH/settings.default [ -f $SLX_CONFIG_PATH/settings ] && \ diff --git a/packaging/default_files/control b/packaging/default_files/control index 43ddb6ad..f4a8cec6 100644 --- a/packaging/default_files/control +++ b/packaging/default_files/control @@ -3,8 +3,9 @@ Version: 4-1 Section: base Priority: optional Architecture: all -Depends: bash (>= 3.0), coreutils (>= 5.2.1), sed (>= 4.1.4), mawk (>= 1.3.3), findutils (>= 4.2.22) +Depends: bash (>= 3.0), coreutils (>= 5.2.1), sed (>= 4.1.4), mawk (>= 1.3.3), + findutils (>= 4.2.22), perl (>= 5.8) Maintainer: Felix Endres <felix-ld4@256bit.org> -Description: Diskless Linux Server Setup +Description: Stateles Linux Extensions Server Setup This project provides a convenient way to setup a server for stateless - (possibly diskless) fat clients. + (possibly diskless) clients. |