source: pkgmngt/packInstall.sh.template@ bcae37d

ablfs-more legacy trunk
Last change on this file since bcae37d was 89bcb1b, checked in by Pierre Labastie <pierre@…>, 4 years ago

Allow scriptlet numbering to be on 4 digits in packInstall.sh*

  • Property mode set to 100644
File size: 2.0 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)
[89bcb1b]11local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3,4\}-//' |
[3ac3ae1]12 sed 's/^[0-9]\{2\}-//')
[7072e1f]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 ;;
[b9c3497]20 *) local VERSION=$(echo ${PCKGVRS} | sed 's/^.*[-_]\([0-9]\)/\1/' |
21 sed 's/_/./g');;
22# the last sed above is because some package managers do not want a '_'
23# in version.
[7072e1f]24esac
25local ARCHIVE_NAME=$(dirname ${PKGDIR})/${PACKAGE}_${VERSION}.deb
26case $(uname -m) in
27 x86_64) local ARCH=amd64 ;;
28 *) local ARCH=i386 ;;
29esac
30
31pushd $PKG_DEST
32rm -fv ./usr/share/info/dir # recommended since this directory is already there
33 # on the system
[b6f19e75]34# The next lines are specific to dpkg, but usually all package managers
[2e1c1c3]35# need some information on the version and the package.
[7072e1f]36mkdir DEBIAN
37cat > DEBIAN/control <<EOF
38Package: $PACKAGE
39Version: $VERSION
40Maintainer: Pierre Labastie <lnimbus@club-internet.fr>
41Description: $PACKAGE
42Architecture: $ARCH
43EOF
44# Building the binary package
45dpkg-deb -b . $ARCHIVE_NAME
46# Installing it on LFS
47dpkg -i $ARCHIVE_NAME
48# Storing the package (recommended).
49mv -v $ARCHIVE_NAME /var/lib/packages
50popd # Since the $PKG_DEST directory is destroyed
51 # immediately after the return of the function,
52 # getting back to $PKGDIR is important...
53}
Note: See TracBrowser for help on using the repository browser.