From c5846f39e8c0edf8d5b555fa969c8633e6d0380e Mon Sep 17 00:00:00 2001 From: Felix Endres Date: Wed, 26 Apr 2006 20:12:12 +0000 Subject: Automated packaging to tar.gz with installer and deinstaller git-svn-id: http://svn.openslx.org/svn/openslx/ld4@199 95ad53e4-c205-0410-b2fa-d234c58c8868 --- packaging/default_files/deinstall.sh | 7 ++++ packaging/default_files/install.sh | 14 +++++++ packaging/default_files/prerm | 2 +- packaging/dxs2deb | 2 +- packaging/dxs2tgz | 75 ++++++++++++++++++++++++++++++++++++ 5 files changed, 98 insertions(+), 2 deletions(-) create mode 100755 packaging/default_files/deinstall.sh create mode 100755 packaging/default_files/install.sh create mode 100755 packaging/dxs2tgz (limited to 'packaging') diff --git a/packaging/default_files/deinstall.sh b/packaging/default_files/deinstall.sh new file mode 100755 index 00000000..6de275ac --- /dev/null +++ b/packaging/default_files/deinstall.sh @@ -0,0 +1,7 @@ +#!/bin/sh +# Deinstall dxs +rm -vrf /usr/share/dxs +rm -vf /usr/sbin/mkdxsinitrd +rm -vf /usr/sbin/ld4-inst +rm -vf /usr/share/man/man1/mkdxsinitrd.1.gz +echo "Done." diff --git a/packaging/default_files/install.sh b/packaging/default_files/install.sh new file mode 100755 index 00000000..cb090fa7 --- /dev/null +++ b/packaging/default_files/install.sh @@ -0,0 +1,14 @@ +#!/bin/sh +if [ "$EUID" -ne 0 ]; then + echo "You need to start this installer as user root" + exit +fi + +cp -Rv dxs /usr/share/ +cp -v man/* /usr/share/man/man1/ +#Create links to provide the scripts to the user +pushd /usr/sbin > /dev/null +ln -vs ../share/dxs/installer/ld4-inst +ln -vs ../share/dxs/initrd/mkdxsinitrd +popd > /dev/null +echo "Done." diff --git a/packaging/default_files/prerm b/packaging/default_files/prerm index cdc4a8d4..6798eb5f 100755 --- a/packaging/default_files/prerm +++ b/packaging/default_files/prerm @@ -1,7 +1,7 @@ #!/bin/sh set -e # -if [ \( "$1" = "upgrade" -o "$1" = "remove" \) -a -L /usr/doc/dxs]; then +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 index 79b80c3d..39a27288 100755 --- a/packaging/dxs2deb +++ b/packaging/dxs2deb @@ -82,5 +82,5 @@ popd > /dev/null popd > /dev/null popd > /dev/null mv /tmp/ld$$.deb ./dxs.deb -#rm -rf /tmp/ld$$ +rm -rf /tmp/ld$$ echo "Written './dxs.deb'" diff --git a/packaging/dxs2tgz b/packaging/dxs2tgz new file mode 100755 index 00000000..1f55246c --- /dev/null +++ b/packaging/dxs2tgz @@ -0,0 +1,75 @@ +#!/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$$/dxs +mkdir -p /tmp/ld$$/man/ +cp default_files/*.1.gz /tmp/ld$$/man/ +cp default_files/*install.sh /tmp/ld$$/ + +#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$$/dxs/tmp.tar +#extract it +pushd /tmp/ld$$/dxs > /dev/null +tar xf tmp.tar +rm tmp.tar + +#Create the package +pushd /tmp/ld$$/ > /dev/null +find -type f |xargs tar rf dxs.tar +gzip dxs.tar +popd > /dev/null + +#And bring the package back to the dir of this script +popd > /dev/null +popd > /dev/null +mv /tmp/ld$$/dxs.tar.gz ./dxs.tgz +rm -rf /tmp/ld$$ +echo "Written './dxs.tgz'" -- cgit v1.2.3-55-g7522