1 -*- mode:text; eval:(footnote-balloons) -*-
2 Time-stamp: <Saturday Mar 8, 2014 17:30:08 steve>
7 Here are the tools I use for package management on bastard. It is
8 based _very_ heavily on the LFS hint:
10 "More control and package management using package users (v1.4)"
12 Which I have included in this repo (see LFS-pkgusr-hint.txt) and is
13 considered essential reading.
15 The main differences (enhancements?) these tools have over the
16 original LFS hint are:
18 o A set of convenience shell functions for pkg users, and a
19 pseudo "master installer"[1]
21 o Make it easy to give individual settings to each pkg user.
22 For example, some pkg users may need ssh/gnupg or $DISPLAY
25 o Better build script and .project templates
27 As of v1.4 of the hint, Matt uses a central build script
28 and each pkgusr has a "build.conf"... an interesting idea
29 and I may switch to that method one day, but for now I use
30 a build script for each pkgusr.
32 o Better uninstall script.
34 o Most of the "wrapper" scripts have been updated or
37 o Includes a `which' script.
39 o Includes a `/bin/mail' script.
41 o Includes a `lesspipe.sh' script (unashamedly stolen from
42 Pat Volkerding and Slackware. Thanks, Pat!)
44 o A more complete list of "install" directories.
45 Everyone's needs and tastes are different so not everything
46 I have in my list of install directories you'll want. Edit
49 o Includes an elisp library that implements much of the
50 convenience shell functions. [2]
52 o Allow pkgusr to run ldconfig as root safely via a wrapper
55 Matt uses a setuid C wrapper that calls execve(2) to do
56 this. Which, IMO, is not the right way to go.
59 You should understand that not everything here can be used straight away.
60 The /bin/mail script, for example, needs Zsh, and Sendmail installed
61 (could probably be rewritten to use bash with very little effort); the
62 ldconfig wrapper needs sudo; if you want to set yourself up as a "master
63 installer", OpenSSL and OpenSSH are needed; and pkgusr.el needs SXEmacs
64 (or XEmacs/Emacs) obviously.
69 As of 2021-02-06 I have switched over to following the current FHS
70 policy that states /bin /sbin /lib /lib64 should all be symlinks into
71 /usr. This conflicts with a lot of the {B,}LFS build/install
72 instructions that have you move libraries and other binaries into /lib
73 /bin /sbin etc. You pretty much just gotta ignore that shit and embrace
74 2021... we have cookies!
79 1. Install bison, flex, nano, and less (in that order) into your
80 /tools dir. Bison, and flex are needed to build binutils in the
81 chroot. And nano and less make life for the package user so
84 As of LFS SVN-20140303, they still do not install bison and
85 flex in chapter 5. I think it might be because they install
86 the binutils from gnu (eww), whereas I install the _proper_
87 optimised for Linux binutils from kernel.org which requires
88 bison/flex. It is also odd that in chapter 6 when they do
89 install these 2 packages, they do them in the wrong order
90 (bison should be done before flex).
92 2. At the point in the book where it has you mount the devpts
93 filesystem, it neglects to mention that you have to specify a
95 mount -vt devpts devpts ${LFS}/dev/pts -o gid=5,mode=620
97 Update: I think LFS has this now, but check anyway.
99 3. Install sudo into your /tools dir. Sudo is used to let pkgusrs
100 run ldconfig as root, thereby bypassing the annoyance of getting
101 errors about /etc/ld.so.cache not being able to be updated.
103 I don't have a LFS build chain anymore so I am not 100% certain
104 if this is possible, but I cannot think of any reasons why it
105 shouldn't be. Let me know if you have an issue with this step.
107 4. When creating the initial /etc/group file, I don't use the LFS
108 book suggestions. I have my own set groups that I've been using
109 since 1995, and old habits are so hard to break. :-)
111 Anyhoo, here's my initial group file...
146 Step 1... Go read that LFS hint. You'll probably want to read it
147 through a couple of times.
149 Step 2... Don't follow the instructions in the LFS hint for how to set
150 things up and where to dump the scripts etc. Instead see the next
151 section, "Pkgusr Specific Installation".
153 Pkgusr Specific Installation
154 ============================
156 In the hint it tells you how where and when to put the helper scripts and
157 stuff, which is great, but I have not included the "more-control-scripts"
158 tarball in this repo. I've rewritten/tweaked most of the scripts and
159 split them out into their respective directories so that I can easily
160 modify and track them. Because of that you may get a little lost in
161 aligning what the hint says to the files you have in this repo.
165 Right _BEFORE_ installing linux libc headers at start of Chap 6 in the
170 From _OUTSIDE_ the chroot environment
180 PKGUSR=/path/to/your/pkgusr/repo/working/dir && ## Yeah, edit this bit!
181 cp -va ${PKGUSR}/etc/pkgusr ${LFS}/etc &&
182 chown -vR 0:0 ${LFS}/etc/pkgusr &&
183 install -vm711 -o0 -g0 -d ${LFS}/etc/sudoers.d &&
184 install -vm440 -o0 -g0 ${PKGUSR}/etc/sudoers.d/99-pkgusr \
185 ${LFS}/etc/sudoers.d &&
186 install -vm644 ${PKGUSR}/installdir.lst ${LFS}/root &&
187 install -vm755 ${PKGUSR}/bin/{which,mail} ${LFS}/usr/bin &&
188 install -vm755 ${PKGUSR}/usr/bin/* ${LFS}/usr/bin &&
189 install -vm750 -o0 -g9999 -d ${LFS}/usr/lib/pkgusr &&
190 install -vm550 -o0 -g9999 ${PKGUSR}/usr/lib/pkgusr/* \
191 ${LFS}/usr/lib/pkgusr &&
192 install -vm755 ${PKGUSR}/usr/sbin/{add_package_user,install_package} \
194 install -vm755 ${PKGUSR}/usr/sbin/{group,user}add ${LFS}/tools/bin &&
197 From this point on you need to re-enter the chroot environment. So
198 these next (and final) steps are done _INSIDE_ the chroot (as root).
200 Create the install group:
201 ------------------------
203 groupadd -g 9999 install
206 Set up the install directories:
207 ------------------------------
208 (you did peruse and edit this list getting rid of things you know for
209 sure you won't need, didn't you?)
212 if [ ! -d ${dir} ]; then
213 install -v -m1775 -o0 -g9999 -d ${dir}
215 done < /root/installdir.lst
220 ln -sv /tools/lib/libncurses.so.5 /usr/lib/libncursesw.so.5
222 (don't forget you'll have to remove that before you install ncurses
225 Alright, where are we up to now? Well, in the LFS hint you are up to:
227 7.2 Walkthrough: Installing linux-libc-headers
229 And in the LFS book, you are up to:
231 6.7. Linux-3.13.5 API Headers
233 So have fun building the rest of your LFS system!
237 [1] The "master installer" is just someone who can change their
238 identity to a pkg user. It _could_ be root, though I don't
239 recommend it. I use a ssh->root->su->pkgusr from my personal A/C
240 which is a single "step" (I'm not stopping in a root shell).
242 [2] pkgusr.el is probably fairly SXEmacs-centric, but should work
243 with perhaps minor changes on XEmacs or even GNU/Emacs.