source: pkgmngt/packInstall.sh.pacman@ 645ec47

ablfs-more trunk
Last change on this file since 645ec47 was 55e82d2, checked in by Pierre Labastie <pierre.labastie@…>, 2 years ago

Various updates for pacman PM

  • update versions and instructions in packageManager.xml.pacman. Also remove the pages for old books.
  • Fix packInstall.sh.pacman, so that restarting after a failure is possible
  • Change LFS/lfs.xsl so that destdir install use symlinks for /lib, /sbin, and /bin. Remove also absolete commands for old books
  • fix gcc script in book parser
  • Property mode set to 100644
File size: 2.2 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
[55e82d2]33# to /sources/$PACKAGE/src. Also, in case there was a failure before, clean
34# /sources/$PACKAGE
35rm -rf /sources/$PACKAGE
36mkdir -p /sources/$PACKAGE/src
37
[3484658]38# We'll build as user builder. We need this directory to be owned by that user.
[55e82d2]39chown -R builder /sources/$PACKAGE
40mv * /sources/$PACKAGE/src
[3484658]41chown -R builder $PKG_DEST
[55e82d2]42chmod -R o+r /sources/$PACKAGE
[bd00951]43
44cat > PKGBUILD <<EOF
45pkgname=( '$PACKAGE' )
46pkgver=$VERSION
47pkgrel=1
48pkgdesc=$PACKAGE
49arch=( '$ARCH' )
50
51package() {
[3ac3ae1]52cp -a * \$pkgdir
[bd00951]53}
54EOF
55# Building the binary package
[3484658]56su builder -c"PATH=$PATH; makepkg -c --skipinteg" || true
[bd00951]57# Installing it on LFS
[3ac3ae1]58if ! pacman -U --noconfirm /var/lib/packages/$ARCHIVE_NAME; then
59 pacman -U --noconfirm --overwrite '*' /var/lib/packages/$ARCHIVE_NAME
[bd00951]60fi
61popd # Since the $PKG_DEST directory is destroyed
62 # immediately after the return of the function,
63 # getting back to $PKGDIR is important...
64}
Note: See TracBrowser for help on using the repository browser.