-*- mode:text; eval:(footnote-balloons) -*-
-Time-stamp: <Wednesday Dec 1, 2010 01:19:17 steve>
+Time-stamp: <Saturday Mar 8, 2014 17:30:08 steve>
Introduction:
============
Here are the tools I use for package management on bastard. It is
based _very_ heavily on the LFS hint:
- "More control and package management using package users (v1.2)"
+ "More control and package management using package users (v1.4)"
Which I have included in this repo (see LFS-pkgusr-hint.txt) and is
considered essential reading.
o Better build script and .project templates
+ As of v1.4 of the hint, Matt uses a central build script
+ and each pkgusr has a "build.conf"... an interesting idea
+ and I may switch to that method one day, but for now I use
+ a build script for each pkgusr.
+
o Better uninstall script.
+ o Most of the "wrapper" scripts have been updated or
+ rewritten.
+
o Includes a `which' script.
o Includes a `/bin/mail' script.
Pat Volkerding and Slackware. Thanks, Pat!)
o A more complete list of "install" directories.
+ Everyone's needs and tastes are different so not everything
+ I have in my list of install directories you'll want. Edit
+ it to suit you.
o Includes an elisp library that implements much of the
- convenience shell functions.[2]
+ convenience shell functions. [2]
+
+ o Allow pkgusr to run ldconfig as root safely via a wrapper
+ script and sudo.
-You should understand that not everything here can be used straight
-away. The /bin/mail script, for example, needs Zsh, and Sendmail
-installed (could probably be rewritten to use bash with very little
-effort); if you want to set yourself up as a "master installer",
-OpenSSL and OpenSSH are needed; and pkgusr.el needs SXEmacs (or
-XEmacs/Emacs) obviously.
+ Matt uses a setuid C wrapper that calls execve(2) to do
+ this. Which, IMO, is not the right way to go.
+
+
+You should understand that not everything here can be used straight away.
+The /bin/mail script, for example, needs Zsh, and Sendmail installed
+(could probably be rewritten to use bash with very little effort); the
+ldconfig wrapper needs sudo; if you want to set yourself up as a "master
+installer", OpenSSL and OpenSSH are needed; and pkgusr.el needs SXEmacs
+(or XEmacs/Emacs) obviously.
Pre-Installation:
================
-The current version of the LFS book (Version SVN-20100919) is a little
-screwed up in one or two places, so BEFORE you move onto the chroot
-part of the deal you need to do a couple extra things:
1. Install bison, flex, nano, and less (in that order) into your
/tools dir. Bison, and flex are needed to build binutils in the
chroot. And nano and less make life for the package user so
much easier.
+ As of LFS SVN-20140303, they still do not install bison and
+ flex in chapter 5. I think it might be because they install
+ the binutils from gnu (eww), whereas I install the _proper_
+ optimised for Linux binutils from kernel.org which requires
+ bison/flex. It is also odd that in chapter 6 when they do
+ install these 2 packages, they do them in the wrong order
+ (bison should be done before flex).
+
2. At the point in the book where it has you mount the devpts
filesystem, it neglects to mention that you have to specify a
mode and gid:
mount -vt devpts devpts ${LFS}/dev/pts -o gid=5,mode=620
- 3. When creating the initial /etc/group file, I don't use the LFS
+ Update: I think LFS has this now, but check anyway.
+
+ 3. Install sudo into your /tools dir. Sudo is used to let pkgusrs
+ run ldconfig as root, thereby bypassing the annoyance of getting
+ errors about /etc/ld.so.cache not being able to be updated.
+
+ I don't have a LFS build chain anymore so I am not 100% certain
+ if this is possible, but I cannot think of any reasons why it
+ shouldn't be. Let me know if you have an issue with this step.
+
+ 4. When creating the initial /etc/group file, I don't use the LFS
book suggestions. I have my own set groups that I've been using
since 1995, and old habits are so hard to break. :-)
- IMPORTANT: Please note that my tty group has GID 5 and that
- group in the LFS book has GID 4... make sure you use the right
- gid= option when mounting your devpts.
-
Anyhoo, here's my initial group file...
cat>/etc/group<<EOF
Pkgusr Specific Installation
============================
-In the hint it tells you how where and when to put the helper scripts
-and stuff, which is great, but I have not included the
-"more-control-scripts" tarball in this repo. I've split them out into
-their respective directories so that I can easily modify and track
-them. Because of that you may get a little lost in aligning what the
-hint says to the files you have in this repo.
+In the hint it tells you how where and when to put the helper scripts and
+stuff, which is great, but I have not included the "more-control-scripts"
+tarball in this repo. I've rewritten/tweaked most of the scripts and
+split them out into their respective directories so that I can easily
+modify and track them. Because of that you may get a little lost in
+aligning what the hint says to the files you have in this repo.
When
----
---
Copy'n'Paste Fun!
-PKGUSR=/path/to/your/pkgusr/working/dir
-cp -v ${PKGUSR}/installdir.lst ${LFS}/root &&
-cp -v ${PKGUSR}/bin/{which,mail} ${LFS}/bin &&
+PKGUSR=/path/to/your/pkgusr/repo/working/dir && ## Yeah, edit this bit!
cp -va ${PKGUSR}/etc/pkgusr ${LFS}/etc &&
-cp -v ${PKGUSR}/usr/bin/* ${LFS}/bin &&
-cp -va ${PKGUSR}/usr/lib/pkgusr ${LFS}/usr/lib &&
-cp -v ${PKGUSR}/usr/sbin/{add_package_user,install_package} \
- ${LFS}/usr/sbin &&
-cp -v ${PKGUSR}/usr/sbin/{group,user}add ${LFS}/tools/bin &&
chown -vR 0:0 ${LFS}/etc/pkgusr &&
-chown -vR 0:0 ${LFS}/usr/lib/pkgusr
+install -v -m711 -o0 -g0 -d ${LFS}/etc/sudoers.d &&
+install -v -m440 -o0 -g0 ${PKGUSR}/etc/sudoers.d/99-pkgusr \
+ ${LFS}/etc/sudoers.d &&
+install -v -m644 ${PKGUSR}/installdir.lst ${LFS}/root &&
+install -v -m755 ${PKGUSR}/bin/{which,mail} ${LFS}/bin &&
+install -v -m755 ${PKGUSR}/usr/bin/* ${LFS}/bin &&
+install -v -m750 -o0 -g9999 -d ${LFS}/usr/lib/pkgusr &&
+install -v -m550 -o0 -g9999 ${PKGUSR}/usr/lib/pkgusr/* \
+ ${LFS}/usr/lib/pkgusr &&
+install -v -m755 ${PKGUSR}/usr/sbin/{add_package_user,install_package} \
+ ${LFS}/usr/sbin &&
+install -v -m755 ${PKGUSR}/usr/sbin/{group,user}add ${LFS}/tools/bin &&
unset PKGUSR
From this point on you need to re-enter the chroot environment. So
Set up the install directories:
------------------------------
+(you did peruse and edit this list getting rid of things you know for
+sure you won't need, didn't you?)
while read dir; do
if [ ! -d ${dir} ]; then
- mkdir -vp ${dir}
+ install -v -m1775 -o0 -g9999 -d ${dir}
fi
- chown -v 0:9999 ${dir}
- chmod -v 1775 ${dir}
done < /root/installdir.lst
One last symlink:
And in the LFS book, you are up to:
- 6.7. Linux-2.6.35.4 API Headers
+ 6.7. Linux-3.13.5 API Headers
So have fun building the rest of your LFS system!