source: pkgmngt/packInstall.sh.pacman@ bbabe74

ablfs-more legacy trunk
Last change on this file since bbabe74 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.1 KB
RevLine 
[bd00951]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)
[3ac3ae1]10local PACKAGE=$(echo ${TGTPKG} | sed 's/^[0-9]\{3,4\}-//' |
11 sed 's/^[0-9]\{2\}-//')
[bd00951]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]*//') ;;
[9593197]16 unzip*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]\)\([0-9]\)/\1.\2/') ;;
[bd00951]17 docbook-xml) local VERSION=4.5 ;;
18 *) local VERSION=$(echo ${PCKGVRS} | sed 's/^.*[-_]\([0-9]\)/\1/' |
19 sed 's/_/./g');;
20# the last sed above is because some package managers do not want a '_'
21# in version.
22esac
23case $(uname -m) in
24 x86_64) local ARCH=x86_64 ;;
25 *) local ARCH=i686 ;;
26esac
27local ARCHIVE_NAME=${PACKAGE}-${VERSION}-1-${ARCH}.pkg.tar.gz
28
29pushd $PKG_DEST
30rm -fv ./usr/share/info/dir # recommended since this directory is already there
31 # on the system
32# Right now, we have the files in the current directory. They should be moved
33# to /sources/$PACKAGE/src.
34mkdir -p ../$PACKAGE/src
[3484658]35# We'll build as user builder. We need this directory to be owned by that user.
36chown -R builder ../$PACKAGE
[bd00951]37mv * ../$PACKAGE/src
[3484658]38chown -R builder $PKG_DEST
[3ac3ae1]39chmod -R o+r ../$PACKAGE
[bd00951]40
41cat > PKGBUILD <<EOF
42pkgname=( '$PACKAGE' )
43pkgver=$VERSION
44pkgrel=1
45pkgdesc=$PACKAGE
46arch=( '$ARCH' )
47
48package() {
[3ac3ae1]49cp -a * \$pkgdir
[bd00951]50}
51EOF
52# Building the binary package
[3484658]53su builder -c"PATH=$PATH; makepkg -c --skipinteg" || true
[bd00951]54# Installing it on LFS
[3ac3ae1]55if ! pacman -U --noconfirm /var/lib/packages/$ARCHIVE_NAME; then
56 pacman -U --noconfirm --overwrite '*' /var/lib/packages/$ARCHIVE_NAME
[bd00951]57fi
58popd # Since the $PKG_DEST directory is destroyed
59 # immediately after the return of the function,
60 # getting back to $PKGDIR is important...
61}
Note: See TracBrowser for help on using the repository browser.