source: pkgmngt/packInstall.sh.pacman@ eec87db

ablfs-more legacy trunk
Last change on this file since eec87db 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
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 unzip*) local VERSION=$(echo $PCKGVRS | sed 's/^[^0-9]*\([0-9]\)\([0-9]\)/\1.\2/') ;;
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
35# We'll build as user builder. We need this directory to be owned by that user.
36chown -R builder ../$PACKAGE
37mv * ../$PACKAGE/src
38chown -R builder $PKG_DEST
39chmod -R o+r ../$PACKAGE
40
41cat > PKGBUILD <<EOF
42pkgname=( '$PACKAGE' )
43pkgver=$VERSION
44pkgrel=1
45pkgdesc=$PACKAGE
46arch=( '$ARCH' )
47
48package() {
49cp -a * \$pkgdir
50}
51EOF
52# Building the binary package
53su builder -c"PATH=$PATH; makepkg -c --skipinteg" || true
54# Installing it on LFS
55if ! pacman -U --noconfirm /var/lib/packages/$ARCHIVE_NAME; then
56 pacman -U --noconfirm --overwrite '*' /var/lib/packages/$ARCHIVE_NAME
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.