Site hosted by Angelfire.com: Build your free website today!

pkgtools.build

pkgtools-10.0-lfs-1.patch

Here is the build script:

#!/bin/sh
#
# Using Slackware pkgtools 10.0 with LFS 6.0:
#
# jgrosshart@gmail.com
#
# NOTE: The only thing you need to edit in this script is the
# ARCH variable on line 93. Adjust it accordingly to whatever
# personal/global CFLAGS you might have defined.
#
# I decided to write this hint in script fashion. If your interested
# in using pkgtools, you're probably already familiar with Slackware
# scripts. If you don't want to simpily 'sh' this script, extrapolating
# the necessary commands is easy enough.
#
# I got pkgtools up and running after 'Chapter 6.8 Populating /dev'.
# I wanted every single package on my system to be documented under
# the pkgtool list. It's probably worth mentioning right now that
# after I removed the /tools directory, pkgtools broke on me. The
# tar-1.13 binary will not work. The dialogrc file also isn't read from
# the get-go. I've had someone else mention that this happened to them
# as well. The only thing I can think of, is to install pkgtools after
# '6.12 Re-adjusting the Toolchain'. If you can come up with a diffinitive
# solution, please let me know and I'll update this hint. As it stands now,
# at the end of the LFS book, after you have removed the /tools directory,
# you'll have to re-build pkgtools. That will fix everything and pkgtools
# will work as expected.

# So, for all of Chapter 6, I used the command of
# "make install DESTDIR=/tmp/package", "cd /tmp/package",
# "makepkg packagename.tgz" and finally, an "installpkg packagename.tgz"
# for every package. Very time consuming but well worth the effort. :-)
# You'll also want to strip the libs/binaries and compress the man pages
# before you make the package. Thats covered later in this hint/script.
#
# VERY few packages won't conform to the DESTDIR switch but can be dealt
# with one way or another. eg - "make install prefix=/tmp/packagename",
# or edit the makefile. As a last resort, for the 2 or 3 packages that flat
# out refuse to install elsewhere, do a pre-run with
# "./configure --prefix=/tmp; make; make install". Look in /tmp
# and see what files it installed. Then do a "make clean" and install
# normally. Then hand move everything to a build directory. You can also
# just 'cat' directly out of the source tree. Make sure everything gets
# placed where it should be with the proper permissions. It may sound like
# a pain, but there are only 2-3 packages at most that do this for the
# entire LFS book. There is also the option of 'checkinstall' but I tend
# not to trust packages made by this program because of past expierences.

# First, you have to download all of the following items into $CWD.
# $CWD is the Current Working Directory, or the directory that this
# script will reside in. As per the books instructions, We'll have $CWD as
# /sources/pkgtool. So, make the directory /sources/pkgtool and download
# all of the below into it, including this script.

# ftp://ftp.slackware.com/pub/slackware/slackware-10.0/source/a/pkgtools/
#
# explodepkg.8
# installpkg.8
# makepkg.8
# pkgtool.8
# removepkg.8
# upgradepkg.8
# xwmconfig.1
# slack-desc
# _pkgtools.tar.gz
# dialog-0.9b-20031207.tar.gz
# dialog.textbox.noarrows.diff.gz

# ftp://ftp.slackware.com/pub/slackware/slackware-10.0/source/a/tar/
#
# tar-1.13.tar.gz
# bzip2-tar.diff.gz

# ftp://ftp.mktemp.org/pub/mktemp/
#
# mktemp-1.5.tar.gz

# http://www.angelfire.com/linux/madpenguin1/pkgtools.htm
#
# pkgtools-10.0-lfs-1.patch

#########################
# Lets start the script #
#########################

# Theres no need to re-invent the wheel. Most of this stuff
# is taken from the Slackware build script for pkgtools.

# User defined variables:
# leave $PKG alone if your using the patch
CWD=`pwd`
ARCH=i686
BUILD=1
VERSION=10.0
TMP=/tmp/pkgtools-build
SAVE=/sources/Xorg-pkgtools-stuff
PKG=/tmp/pkgtools-package
DIALOG=0.9b-20031207
TAR=1.13
MKTEMP=1.5

rm -rf $TMP
rm -rf $PKG
mkdir -p $TMP
mkdir -p $PKG

cd $PKG
tar xzvf $CWD/_pkgtools.tar.gz
# I hate doc's. Nothing but clutter...
rm -rf usr/doc
# Don't need em'
rm -rf etc/*
rm -rf usr/{bin,lib}
rm -rf sbin/makebootdisk

# I also like to remove the X related things and make
# them a part of my Xorg package. So as to not make
# this anymore confusing, we'll just leave them here.
#mkdir -p $SAVE/var/log/setup
#mkdir -p $SAVE/usr/X11R6/bin
#mkdir -p $SAVE/usr/X11R6/man/man1
#cp -a var/log/setup/setup.xwmconfig $SAVE/var/log/setup
#cp -a usr/X11R6/bin/* $SAVE/usr/X11R6/bin
#cat $CWD/xwmconfig.1 | gzip -9 > $SAVE/usr/X11R6/man/man1/xwmconfig.1.gz
#rm -rf usr/X11R6
#rm -rf var/log/setup/*
#mkdir -p var/log/setup/tmp

# If you decide to remove the X stuff by uncommenting
# the above commands, comment the following 8 lines:
mkdir -p $PKG/usr/X11R6/man/man1
cat $CWD/xwmconfig.1 | gzip -9 > $PKG/usr/X11R6/man/man1/xwmconfig.1.gz
( cd var/log/setup
rm -f setup.70.install-kernel
rm -f setup.80.make-bootdisk
rm -f setup.90.modem-device
rm -f setup.services
)

# Some sed commands to fix our doinst.sh
sed -i '1,8d' install/doinst.sh
sed -i 's@/usr/share@../share@g' install/doinst.sh

# Move our package description into place:
cat $CWD/slack-desc > $PKG/install/slack-desc

# I'm not very proficent with sed commands and found
# it easier to make a patch that makes all the
# desired changes to the pkgtools scripts...
#
# Technically speaking, no changes are required at
# all to our pkgtool scripts, but I think we should
# make some cosmetic changes since it's going to be
# used on LFS and not Slackware. So, the patch is
# optional. If you do decide to use this patch, you
# have to change the 'slack-desc' files to 'desc'
# before you build each package.
#
# If your not using the patch, comment the next 2 lines:
patch -Np1 -i $CWD/pkgtools-10.0-lfs-1.patch
mv $PKG/install/slack-desc $PKG/install/desc

# Get the pkgtool man pages in place:
cp $CWD/*.8 $PKG/usr/man/man8
gzip -9 $PKG/usr/man/man8/*

# Lets build Dialog:
cd $TMP
tar xzvf $CWD/dialog-$DIALOG.tar.gz
cd dialog-$DIALOG
find . -perm 444 -exec chmod 644 {} \;
chown -R root.root .
zcat $CWD/dialog.textbox.noarrows.diff.gz | patch -p1
./configure \
--prefix=/usr \
--enable-nls
make
strip --strip-unneeded dialog
cat dialog > $PKG/bin/dialog
cat dialog.1 | gzip -9 > $PKG/usr/man/man1/dialog.1.gz
cd po
make
make install DESTDIR=$PKG
# The dialogrc file is what defines the color set for pkgtools.
# If your interested, try out some different sample files
# other than the Slackware one...
cd ../samples
cat slackware.rc > $PKG/etc/dialogrc

# Apparently, tar-1.14 can't handle symlinks very well with pkgtools.
# We need to build and install just the binary from tar-1.13 for use
# with pkgtools. pkgtool and all associated scripts are hard coded to
# look for a file called "tar-1.13". This will keep it isolated and
# thus will only be used by pkgtool.

cd $TMP
tar xzvf $CWD/tar-$TAR.tar.gz
cd tar-$TAR
zcat $CWD/bzip2-tar.diff.gz | patch -p1 --verbose
chown -R root.root .
./configure \
--prefix=/usr \
--bindir=/bin \
--disable-nls
make
strip --strip-unneeded src/tar
cat src/tar > $PKG/bin/tar-1.13
chmod 755 $PKG/bin/tar-1.13

# We need mktemp now if we are going to be building binaries with
# makepkg. This will be a temporary mktemp seeing as how we are
# building it again in just a little bit, so we won't build it "proper".
# Lets move it to the tail-end of our $PATH, so once we do install
# mktemp in Chapter 6.17, this one will no longer be used.
#
# Also, if/when you rebuild pkgtools after removing the /tools directory,
# this section of the script will do nothing other than waste a few seconds.

cd $TMP
tar xjvf $CWD/mktemp-$MKTEMP.tar.bz2
cd mktemp-$MKTEMP
./configure --prefix=/usr
make
cat mktemp > /tools/bin/mktemp

# Now, lets make our pkgtool binary package 'by hand' since we don't
# have pkgtools installed yet. Make sure you've adjusted the ARCH
# variable on line 93.

cd $PKG
tar cvf pkgtools-$VERSION-$ARCH-$BUILD.tar *
gzip -9 pkgtools-$VERSION-$ARCH-$BUILD.tar
mv pkgtools-$VERSION-$ARCH-$BUILD.tar.gz /tmp/pkgtools-$VERSION-$ARCH-$BUILD.tgz
cd /
tar -xzvf /tmp/pkgtools-$VERSION-$ARCH-$BUILD.tgz
rm -rf /install
installpkg /tmp/pkgtools-$VERSION-$ARCH-$BUILD.tgz

cat << EOF > /tmp/strip
#!/bin/sh
#
# This script is used for the final stage of
# preparing the binary package, right before
# a "makepkg" is issued. Don't put this in your
# PATH as there is another file called 'strip'.
# You can rename it to something unique and then
# place it into your PATH.
#
# This removes the debugging symbols from the libs
# and completely strips the binaries. It also uses
# a static build directory. So, you'll have to use
# DESTDIR=/tmp/package for each package. Taken from
# Chapter 6.60 and slightly modifed. I haven't
# actually used this script tho... :-)
##################################################

# Strip the binaries
/tools/bin/find /tmp/package/{,usr/}{bin,sbin} -type f -exec /tools/bin/strip --strip-unneeded '{}' ';'

# Strip the libraries
/tools/bin/find /tmp/package/{,usr/}{lib} -type f -exec /tools/bin/strip --strip-debug '{}' ';'

# Now compress the man pages
/tools/bin/gzip -f -9 /tmp/package/usr/man/man?/*

# For the shadow package, use this line along with the above
#/tools/bin/gzip -f -9 /tmp/build/usr/man/*?/*?/*
EOF

echo
echo "PKGTOOLS IS NOW INSTALLED."
echo
echo "The binary is located in /tmp if you want to save it."
echo
echo "I've also placed a sample script for stripping binaries"
echo "and compressing man pages into /tmp."
echo

# We untared it first in our / Directory to get the files in place
# so it would work. Then we installed it through pkgtools so it
# would be cataloged and also to execute the install script to create
# it's symlinks.

And here is the patch:

Submitted By: Jon Grosshart (jgrosshart@gmail.com)
Date: 2005-03-11
Initial Package Version: 10.0
Upstream Status: Not submitted - Hack
Origin: Jon Grosshart
Description: Makes changes to Slackware's pkgtools that are mostly
cosmetic in nature. Also makes pkgtool use the file
'desc' instead of 'slack-desc'. This patch is designed
to be used in conjunction with submitted hint.

--- pkgtools-package.orig/sbin/installpkg 2004-05-29 20:20:34.000000000 -0400
+++ pkgtools-package/sbin/installpkg 2005-01-02 19:59:59.000000000 -0500
@@ -284,10 +284,10 @@
if [ "$DESCRIPTION" = "/dev/null" ]; then
mkdir -p $TMP/scan$$
( cd $TMP/scan$$ ; $TAR xzf - install ) < $package 2> /dev/null
- if grep "^$packagebase:" "$TMP/scan$$/install/slack-desc" 1> /dev/null 2> /dev/null ; then
- DESCRIPTION="$TMP/scan$$/install/slack-desc"
- elif grep "^$shortname:" "$TMP/scan$$/install/slack-desc" 1> /dev/null 2> /dev/null ; then
- DESCRIPTION="$TMP/scan$$/install/slack-desc"
+ if grep "^$packagebase:" "$TMP/scan$$/install/desc" 1> /dev/null 2> /dev/null ; then
+ DESCRIPTION="$TMP/scan$$/install/desc"
+ elif grep "^$shortname:" "$TMP/scan$$/install/desc" 1> /dev/null 2> /dev/null ; then
+ DESCRIPTION="$TMP/scan$$/install/desc"
fi
fi

@@ -318,7 +318,7 @@
if [ "$shortname" != "$packagebase" ]; then
cat $DESCRIPTION | grep "^$shortname:" | cut -f 2- -d : | cut -b2- 1>> $TMP/tmpmsg$$ 2> /dev/null
fi
- # Adjust the length here. This allows a slack-desc to be any size up to 13 lines instead of fixed at 11.
+ # Adjust the length here. This allows a desc to be any size up to 13 lines instead of fixed at 11.
LENGTH=`cat $TMP/tmpmsg$$ | wc -l`
while [ $LENGTH -lt 12 ]; do
echo >> $TMP/tmpmsg$$
@@ -443,8 +443,8 @@
cp $ROOT/install/doinst.sh $ADM_DIR/scripts/$shortname
chmod 755 $ADM_DIR/scripts/$shortname
fi
- # /install/doinst.sh and /install/slack-* are reserved locations for the package system.
- ( cd $ROOT/install ; rm -f doinst.sh slack-* 1> /dev/null 2>&1 )
+ # /install/doinst.sh and /install/desc are reserved locations for the package system.
+ ( cd $ROOT/install ; rm -f doinst.sh desc 1> /dev/null 2>&1 )
rmdir $ROOT/install 1> /dev/null 2>&1
fi
# If we used a scan directory, get rid of it:
--- pkgtools-package.orig/sbin/explodepkg 2003-03-05 02:38:39.000000000 -0500
+++ pkgtools-package/sbin/explodepkg 2004-12-15 18:13:47.000000000 -0500
@@ -21,8 +21,8 @@
cat << EOF
Usage: explodepkg package_name [package_name2, ...]

-Explodes a Slackware compatible software package (or any tar+gzip archive) in
-the current directory. Equivalent to (for each package listed):
+Explodes a pkgtool software package in the current
+directory. Equivalent to (for each package listed):

( umask 000 ; tar xzvf package_name )

--- pkgtools-package.orig/sbin/makepkg 2004-05-29 20:19:46.000000000 -0400
+++ pkgtools-package/sbin/makepkg 2005-01-19 15:01:05.000000000 -0500
@@ -62,11 +62,12 @@

Usage: makepkg package_name.tgz

-Makes a Slackware compatible "*.tgz" package containing the contents of the
-current and all subdirectories. If symbolic links exist, they will be removed
-and an installation script will be made to recreate them later. This script
-will be called "install/doinst.sh". You may add any of your own ash-compatible
-shell scripts to this file and rebuild the package if you wish.
+Makes a "*.tgz" package containing the contents of the current and
+subsequent directories. If symbolic links exist, they will be
+removed and an installation script will be made to recreate them
+later. This script will be called "install/doinst.sh". You may
+add any of your own ash-compatible shell scripts to this file and
+rebuild the package if you wish.

options: -l, --linkadd y|n (moves symlinks into doinst.sh: recommended)
-p, --prepend (prepend rather than append symlinks to an existing
@@ -116,7 +117,7 @@
done

echo
-echo "Slackware package maker, version 2.1."
+echo "Pkgtool package maker (from Slackware), version 2.1"
PACKAGE_NAME=$1
TARGET_NAME="`dirname $PACKAGE_NAME`"
PACKAGE_NAME="`basename $PACKAGE_NAME`"
--- pkgtools-package.orig/sbin/pkgtool 2004-06-06 17:35:23.000000000 -0400
+++ pkgtools-package/sbin/pkgtool 2005-02-01 14:15:21.000000000 -0500
@@ -144,15 +144,14 @@
CMD_START="true"
rm -f $TMP/SeT*
while [ 0 ]; do
- dialog --title "Slackware Package Tool (pkgtool version 10.0)" \
---menu "\nWelcome to the Slackware package tool.\n\
+ dialog --title "Package Tool" \
+--menu "\nWelcome to Package Tool.\n\
\nWhich option would you like?\n" 17 75 7 \
"Current" "Install packages from the current directory" \
"Other" "Install packages from some other directory" \
-"Floppy" "Install packages from floppy disks" \
"Remove" "Remove packages that are currently installed" \
"View" "View the list of files contained in a package" \
-"Setup" "Choose Slackware installation scripts to run again" \
+"Setup" "Configure packages that are currently installed" \
"Exit" "Exit Pkgtool" 2> $TMP/reply
if [ ! $? = 0 ]; then
rm -f $TMP/reply
@@ -166,9 +165,9 @@
exit
fi
if [ "$REPLY" = "Setup" ]; then
- echo 'dialog --title "SELECT SYSTEM SETUP SCRIPTS" --item-help --checklist \
- "Please use the spacebar to select the setup scripts to run. Hit enter when you \
-are done selecting to run the scripts." 17 70 9 \' > $TMP/setupscr
+ echo 'dialog --title "SELECT SCRIPTS TO RUN" --item-help --checklist \
+ "Please use the spacebar to select the items below. If nothing is \
+listed, there are currently no configurable packages on the system." 17 70 9 \' > $TMP/setupscr
for script in $ADM_DIR/setup/setup.* ; do
BLURB=`grep '#BLURB' $script | cut -b8-`
if [ "$BLURB" = "" ]; then
--- pkgtools-package.orig/sbin/upgradepkg 2004-05-29 20:22:41.000000000 -0400
+++ pkgtools-package/sbin/upgradepkg 2004-12-15 18:39:59.000000000 -0500
@@ -35,7 +35,7 @@
Usage: upgradepkg newpackage [newpackage2 ... ]
upgradepkg oldpackage%newpackage [oldpackage2%newpackage2 ... ]

-Upgradepkg upgrades a Slackware .tgz package from an older version to a
+Upgradepkg upgrades a Package Tool package from an older version to a
newer one. It does this by INSTALLING the new package onto the system, and
then REMOVING any files from the old package that aren't in the new package.
If the old and new packages have the same name, a single argument is all that
--- pkgtools-package.orig/install/slack-desc 2005-03-11 08:48:14.191637920 -0500
+++ pkgtools-package/install/slack-desc 2005-03-11 08:52:02.318957296 -0500
@@ -6,14 +6,14 @@
# leave one space after the ':'.

|-----handy-ruler------------------------------------------------------|
-pkgtools: pkgtools (The Slackware package maintenance system)
+pkgtools: pkgtools (package maintenance)
pkgtools:
-pkgtools: This package contains utilities for handling Slackware packages.
+pkgtools: This package contains utilities for handling pkgtool packages.
pkgtools: Included are the command line utilities 'installpkg', 'removepkg',
pkgtools: 'makepkg', 'explodepkg', and 'upgradepkg' that install, remove,
-pkgtools: build, examine, and upgrade software packages. Also included are
+pkgtools: build, examine, and upgrade software packages. Also included is
pkgtools: 'pkgtool', a menu based program for installing packages, removing
-pkgtools: packages, or viewing the packages that are installed on the system,
-pkgtools: documentation (man pages), and a few other system admin scripts.
+pkgtools: packages, or viewing the packages that are installed on the system.
pkgtools:
+pkgtools: This is Slackware's pkgtool with a few modifications.
pkgtools: