diff options
author | Felix Endres | 2006-04-26 18:48:28 +0200 |
---|---|---|
committer | Felix Endres | 2006-04-26 18:48:28 +0200 |
commit | 0bc40f516178b20dbfefc574e47f2b2d85d68e20 (patch) | |
tree | e1d14441e250668b9ba5216055fcb3c39a5b34b7 /packaging | |
parent | Both scripts can now be called by nested symlinks (diff) | |
download | core-0bc40f516178b20dbfefc574e47f2b2d85d68e20.tar.gz core-0bc40f516178b20dbfefc574e47f2b2d85d68e20.tar.xz core-0bc40f516178b20dbfefc574e47f2b2d85d68e20.zip |
Script and Data for automatic creation of a .deb package for Debian based systems
git-svn-id: http://svn.openslx.org/svn/openslx/ld4@196 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'packaging')
-rw-r--r-- | packaging/default_files/control | 10 | ||||
-rw-r--r-- | packaging/default_files/mkdxsinitrd.1.gz | bin | 0 -> 1108 bytes | |||
-rwxr-xr-x | packaging/default_files/postinst | 9 | ||||
-rwxr-xr-x | packaging/default_files/prerm | 7 | ||||
-rwxr-xr-x | packaging/dxs2deb | 86 |
5 files changed, 112 insertions, 0 deletions
diff --git a/packaging/default_files/control b/packaging/default_files/control new file mode 100644 index 00000000..05b3082d --- /dev/null +++ b/packaging/default_files/control @@ -0,0 +1,10 @@ +Package: dxs +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) +Maintainer: Felix Endres <felix-ld4@256bit.org> +Description: Diskless Linux Server Setup + This project provides a convenient way to setup a server for diskless + clients. diff --git a/packaging/default_files/mkdxsinitrd.1.gz b/packaging/default_files/mkdxsinitrd.1.gz Binary files differnew file mode 100644 index 00000000..e88181e5 --- /dev/null +++ b/packaging/default_files/mkdxsinitrd.1.gz diff --git a/packaging/default_files/postinst b/packaging/default_files/postinst new file mode 100755 index 00000000..daa52770 --- /dev/null +++ b/packaging/default_files/postinst @@ -0,0 +1,9 @@ +#!/bin/sh +set -e +# +if [ "$1" = "configure" ]; then + if [ -d /usr/doc -a ! -e /usr/doc/dxs -a -d /usr/share/doc/dxs ]; then + ln -sf ../share/doc/dxs /usr/doc/dxs + fi +fi +# diff --git a/packaging/default_files/prerm b/packaging/default_files/prerm new file mode 100755 index 00000000..cdc4a8d4 --- /dev/null +++ b/packaging/default_files/prerm @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +# +if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/dxs]; then + rm -f /usr/doc/dxs +fi +# diff --git a/packaging/dxs2deb b/packaging/dxs2deb new file mode 100755 index 00000000..79b80c3d --- /dev/null +++ b/packaging/dxs2deb @@ -0,0 +1,86 @@ +#!/bin/sh +# +# This script transforms the dxs 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 +#Create Temporary working directory +mkdir -p /tmp/ld$$/usr/share/dxs +mkdir -p /tmp/ld$$/usr/sbin +mkdir -p /tmp/ld$$/usr/share/man/man1 +mkdir -p /tmp/ld$$/usr/share/doc/dxs +mkdir -p /tmp/ld$$/DEBIAN +cp default_files/control /tmp/ld$$/DEBIAN/ +cp default_files/prerm /tmp/ld$$/DEBIAN/ +cp default_files/postinst /tmp/ld$$/DEBIAN/ +cp default_files/mkdxsinitrd.1.gz /tmp/ld$$/usr/share/man/man1/ + +#Goto project root +pushd .. > /dev/null +#copy all relevant file to a tar archive (can't use xargs with cp) +find -type f| grep -v /\.svn | grep -v \#.*\# | grep ^\./in | grep -v ~$ | xargs tar rf /tmp/ld$$/usr/share/dxs/tmp.tar +#extract it +pushd /tmp/ld$$/usr/share/dxs > /dev/null +tar xf tmp.tar +rm tmp.tar + +#Create links to provide the scripts to the user +pushd /tmp/ld$$/usr/sbin > /dev/null +ln -s ../share/dxs/installer/ld4-inst +ln -s ../share/dxs/initrd/mkdxsinitrd + + +#Set permissions +find /tmp/ld$$ -type d|xargs chmod 755 + +#Create the package +dpkg-deb --build /tmp/ld$$ > /dev/null +#And bring the package back to the dir of this script +popd > /dev/null +popd > /dev/null +popd > /dev/null +mv /tmp/ld$$.deb ./dxs.deb +#rm -rf /tmp/ld$$ +echo "Written './dxs.deb'" |