Add '/var/lib/colord/.cache' to Bastard prune_prefixes
[pkgusr] / README
1 -*- mode:text; eval:(footnote-balloons) -*-
2 Time-stamp: <Saturday Mar  8, 2014 17:30:08 steve>
3
4 Introduction:
5 ============
6
7 Here are the tools I use for package management on bastard.  It is
8 based _very_ heavily on the LFS hint:
9
10   "More control and package management using package users (v1.4)"
11
12 Which I have included in this repo (see LFS-pkgusr-hint.txt) and is
13 considered essential reading.
14
15 The main differences (enhancements?) these tools have over the
16 original LFS hint are:
17
18          o A set of convenience shell functions for pkg users, and a
19            pseudo "master installer"[1]
20
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
23            set. 
24
25          o Better build script and .project templates
26
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.
31
32          o Better uninstall script.
33
34          o Most of the "wrapper" scripts have been updated or
35            rewritten.
36
37          o Includes a `which' script.
38
39          o Includes a `/bin/mail' script.
40
41          o Includes a `lesspipe.sh' script (unashamedly stolen from
42            Pat Volkerding and Slackware.  Thanks, Pat!)
43
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
47            it to suit you.
48
49          o Includes an elisp library that implements much of the
50            convenience shell functions. [2]
51
52          o Allow pkgusr to run ldconfig as root safely via a wrapper
53            script and sudo.
54
55            Matt uses a setuid C wrapper that calls execve(2) to do
56            this.  Which, IMO, is not the right way to go.  
57            
58
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.
65
66 Pre-Installation:
67 ================
68
69   1.  Install bison, flex, nano, and less (in that order) into your
70       /tools dir.  Bison, and flex are needed to build binutils in the
71       chroot.  And nano and less make life for the package user so
72       much easier.
73
74       As of LFS SVN-20140303, they still do not install bison and
75       flex in chapter 5.  I think it might be because they install
76       the binutils from gnu (eww), whereas I install the _proper_
77       optimised for Linux binutils from kernel.org which requires
78       bison/flex.  It is also odd that in chapter 6 when they do
79       install these 2 packages, they do them in the wrong order
80       (bison should be done before flex).
81
82   2.  At the point in the book where it has you mount the devpts
83       filesystem, it neglects to mention that you have to specify a
84       mode and gid:
85            mount -vt devpts devpts ${LFS}/dev/pts -o gid=5,mode=620
86
87       Update:  I think LFS has this now, but check anyway.
88
89   3.  Install sudo into your /tools dir.  Sudo is used to let pkgusrs
90       run ldconfig as root, thereby bypassing the annoyance of getting
91       errors about /etc/ld.so.cache not being able to be updated.
92
93       I don't have a LFS build chain anymore so I am not 100% certain
94       if this is possible, but I cannot think of any reasons why it
95       shouldn't be.  Let me know if you have an issue with this step.
96
97   4.  When creating the initial /etc/group file, I don't use the LFS
98       book suggestions.  I have my own set groups that I've been using
99       since 1995, and old habits are so hard to break. :-)
100
101       Anyhoo, here's my initial group file...
102
103 cat>/etc/group<<EOF
104 root:x:0:
105 bin:x:1:
106 daemon:x:2:
107 sys:x:3:
108 adm:x:4:
109 tty:x:5:
110 disk:x:6:
111 lp:x:7:
112 mem:x:8:
113 kmem:x:9:
114 wheel:x:10:
115 floppy:x:11:
116 mail:x:12:
117 news:x:13:
118 uucp:x:14:
119 man:x:15:
120 dialout:x:16:
121 audio:x:17:
122 video:x:18:
123 cdrom:x:19:
124 games:x:20:
125 utmp:x:22:
126 usb:x:23:
127 tape:x:26:
128 nobody:x:98:
129 nogroup:x:99:
130 users:x:1000:
131 EOF
132
133 Installation:
134 ============
135
136 Step 1... Go read that LFS hint.  You'll probably want to read it
137 through a couple of times.
138
139 Step 2... Don't follow the instructions in the LFS hint for how to set
140 things up and where to dump the scripts etc.  Instead see the next
141 section, "Pkgusr Specific Installation".
142
143 Pkgusr Specific Installation
144 ============================
145
146 In the hint it tells you how where and when to put the helper scripts and
147 stuff, which is great, but I have not included the "more-control-scripts"
148 tarball in this repo.  I've rewritten/tweaked most of the scripts and
149 split them out into their respective directories so that I can easily
150 modify and track them.  Because of that you may get a little lost in
151 aligning what the hint says to the files you have in this repo.
152
153 When
154 ----
155 Right _BEFORE_ installing linux libc headers at start of Chap 6 in the
156 LFS book.
157
158 Where
159 -----
160 From _OUTSIDE_ the chroot environment
161
162 Who
163 ---
164 Do this as root
165
166 How
167 ---
168 Copy'n'Paste Fun!
169
170 PKGUSR=/path/to/your/pkgusr/repo/working/dir &&  ## Yeah, edit this bit!
171 cp -va ${PKGUSR}/etc/pkgusr ${LFS}/etc &&
172 chown -vR 0:0 ${LFS}/etc/pkgusr &&
173 install -v -m711 -o0 -g0 -d ${LFS}/etc/sudoers.d &&
174 install -v -m440 -o0 -g0 ${PKGUSR}/etc/sudoers.d/99-pkgusr \
175     ${LFS}/etc/sudoers.d &&
176 install -v -m644 ${PKGUSR}/installdir.lst ${LFS}/root &&
177 install -v -m755 ${PKGUSR}/bin/{which,mail} ${LFS}/bin &&
178 install -v -m755 ${PKGUSR}/usr/bin/* ${LFS}/bin &&
179 install -v -m750 -o0 -g9999 -d ${LFS}/usr/lib/pkgusr &&
180 install -v -m550 -o0 -g9999 ${PKGUSR}/usr/lib/pkgusr/* \
181     ${LFS}/usr/lib/pkgusr &&
182 install -v -m755 ${PKGUSR}/usr/sbin/{add_package_user,install_package} \
183     ${LFS}/usr/sbin &&
184 install -v -m755 ${PKGUSR}/usr/sbin/{group,user}add ${LFS}/tools/bin &&
185 unset PKGUSR
186
187 From this point on you need to re-enter the chroot environment.  So
188 these next (and final) steps are done _INSIDE_ the chroot (as root).
189
190 Create the install group:
191 ------------------------
192
193 groupadd -g 9999 install
194
195
196 Set up the install directories:
197 ------------------------------
198 (you did peruse and edit this list getting rid of things you know for
199 sure you won't need, didn't you?)
200
201 while read dir; do
202     if [ ! -d ${dir} ]; then
203         install -v -m1775 -o0 -g9999 -d ${dir}
204     fi
205 done < /root/installdir.lst
206
207 One last symlink:
208 ----------------
209
210   ln -sv /tools/lib/libncurses.so.5 /usr/lib/libncursesw.so.5
211
212 (don't forget you'll have to remove that before you install ncurses
213 later)
214
215 Alright, where are we up to now?  Well, in the LFS hint you are up to:
216
217   7.2 Walkthrough: Installing linux-libc-headers
218
219 And in the LFS book, you are up to:
220
221   6.7. Linux-3.13.5 API Headers
222
223 So have fun building the rest of your LFS system!
224
225
226 Footnotes: 
227 [1]  The "master installer" is just someone who can change their
228      identity to a pkg user.  It _could_ be root, though I don't
229      recommend it.  I use a ssh->root->su->pkgusr from my personal A/C
230      which is a single "step" (I'm not stopping in a root shell).
231
232 [2]  pkgusr.el is probably fairly SXEmacs-centric, but should work
233      with perhaps minor changes on XEmacs or even GNU/Emacs.
234