source: pkgmngt/packInstall.sh.template@ f3a500d

ablfs
Last change on this file since f3a500d was 4c6f54f, checked in by Pierre Labastie <pierre@…>, 13 years ago

Fix svn properties on some files

  • Property mode set to 100644
File size: 1.9 KB
RevLine 
[4c6f54f]1# $Id$
[7072e1f]2# function for packing and installing a tree. We only have access
3# to variables PKGDIR and PKG_DEST
4# Other variables can be passed on the command line, or in the environment
5
6packInstall() {
7
8# A proposed implementation for versions and package names.
9local PCKGVRS=$(basename $PKGDIR)
10local TGTPKG=$(basename $PKG_DEST)
11local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3\}-//' |
12 sed 's/^[0-9]\{1\}-//')
13# version is only accessible from PKGDIR name. Since the format of the
14# name is not normalized, several hacks are necessary...
15case $PCKGVRS in
16 expect*|tcl*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*//') ;;
17 vim*|unzip*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]\)\([0-9]\)/\1.\2/') ;;
18 tidy*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]*\)/\1cvs/') ;;
19 docbook-xml) local VERSION=4.5 ;;
20 *) local VERSION=$(echo ${PCKGVRS} | sed 's/^.*[-_]\([0-9]\)/\1/');;
21esac
22local ARCHIVE_NAME=$(dirname ${PKGDIR})/${PACKAGE}_${VERSION}.deb
23case $(uname -m) in
24 x86_64) local ARCH=amd64 ;;
25 *) local ARCH=i386 ;;
26esac
27
28pushd $PKG_DEST
29rm -fv ./usr/share/info/dir # recommended since this directory is already there
30 # on the system
31# The next lines are specific to dpkg, but usually all pacakge managers
32# need some information on the version and the package.
33mkdir DEBIAN
34cat > DEBIAN/control <<EOF
35Package: $PACKAGE
36Version: $VERSION
37Maintainer: Pierre Labastie <lnimbus@club-internet.fr>
38Description: $PACKAGE
39Architecture: $ARCH
40EOF
41# Building the binary package
42dpkg-deb -b . $ARCHIVE_NAME
43# Installing it on LFS
44dpkg -i $ARCHIVE_NAME
45# Storing the package (recommended).
46mv -v $ARCHIVE_NAME /var/lib/packages
47popd # Since the $PKG_DEST directory is destroyed
48 # immediately after the return of the function,
49 # getting back to $PKGDIR is important...
50}
Note: See TracBrowser for help on using the repository browser.