source: pkgmngt/packInstall.sh.pacman@ 72e9e68

ablfs-more legacy trunk
Last change on this file since 72e9e68 was bd00951, checked in by Pierre Labastie <pierre@…>, 10 years ago

Add pacman as package manager.

  • Property mode set to 100644
File size: 2.0 KB
RevLine 
[bd00951]1# $Id$
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/' |
21 sed 's/_/./g');;
22# the last sed above is because some package managers do not want a '_'
23# in version.
24esac
25case $(uname -m) in
26 x86_64) local ARCH=x86_64 ;;
27 *) local ARCH=i686 ;;
28esac
29local ARCHIVE_NAME=${PACKAGE}-${VERSION}-1-${ARCH}.pkg.tar.gz
30
31pushd $PKG_DEST
32rm -fv ./usr/share/info/dir # recommended since this directory is already there
33 # on the system
34# Right now, we have the files in the current directory. They should be moved
35# to /sources/$PACKAGE/src.
36mkdir -p ../$PACKAGE/src
37mv * ../$PACKAGE/src
38
39cat > PKGBUILD <<EOF
40pkgname=( '$PACKAGE' )
41pkgver=$VERSION
42pkgrel=1
43pkgdesc=$PACKAGE
44arch=( '$ARCH' )
45
46package() {
47mv * \$pkgdir
48}
49EOF
50# Building the binary package
51makepkg --asroot -c --skipinteg
52# Installing it on LFS
53if ! pacman -U --noconfirm $ARCHIVE_NAME; then
54 pacman -U --noconfirm --force $ARCHIVE_NAME
55fi
56popd # Since the $PKG_DEST directory is destroyed
57 # immediately after the return of the function,
58 # getting back to $PKGDIR is important...
59}
Note: See TracBrowser for help on using the repository browser.