source: pkgmngt/packInstall.sh.template

trunk
Last change on this file was fd4a798, checked in by Pierre Labastie <pierre.labastie@…>, 3 years ago

Remove $Id$ comments, they are useless with git

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