1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
|
diff -Nur run.orig/cachepacs run/cachepacs
--- run.orig/cachepacs 1970-01-01 00:00:00.000000000 +0000
+++ run/cachepacs 2008-08-29 02:34:57.000000000 +0000
@@ -0,0 +1,139 @@
+#! /bin/bash
+#
+# cachepacs - install pkgs to cache dir, but don't isntall
+#
+# Author: James Meyer (based on inpacs)
+
+
+# Working directory:
+TMPDIR=/tmp/inpacs$$
+# File containing (filtered) list of base packages + added packages
+basepacks=${TMPDIR}/basepacks
+
+APP="$( basename $0 )"
+
+exitfunc () {
+ # Remove temporary files
+ rm -rf ${TMPDIR}
+ exit $1
+}
+
+# Default pacman db path (this is a statement, not a configuration, so
+# do not change it!)
+DBPATH="/var/lib/pacman"
+
+# Default package cache, on the target
+TARGETCACHE="${CACHE}"
+# A host or remote package cache:
+HOSTCACHE=""
+# Absolute /path/to/file containing list of packages for 2nd install phase:
+ADDEDPACKS=""
+# Source file for base package list:
+BASEPACKSFILE=""
+# Source file for list of vetoed base packages:
+VETOFILE=""
+# Source directory for pacman database directories:
+DBDIR=""
+# pacman executable:
+PACMANX="pacman -f"
+# pacman configuration file
+PACMANK="/etc/pacman.conf"
+
+checkfile ()
+{
+ f=$( readlink -m $1 )
+ if ! [ -f "${f}" ]; then
+ echo "ERROR: File doesn't exist: ${f}"
+ exitfunc
+ fi
+}
+
+checkdir ()
+{
+ f=$( readlink -m $1 )
+ if ! [ -d "${f}" ]; then
+ echo "ERROR: Directory doesn't exist: ${f}"
+ exitfunc
+ fi
+}
+
+
+while getopts ":k:a:c:b:x:y:P:" Option
+do
+ case ${Option} in
+ k ) checkfile ${OPTARG}
+ PACMANK=${f} ;;
+ a ) checkfile ${OPTARG}
+ CACHEPACKSFILE=${f} ;;
+ y ) checkdir ${OPTARG}
+ DBDIR=${f} ;;
+ P ) checkfile ${OPTARG}
+ PACMANX=${f} ;;
+ #* ) usage ;;
+ esac
+done
+shift $((${OPTIND} - 1))
+INSTLDIR="$1"
+
+
+# grep the cachedir out of the installed pacman.conf
+PCCACHE=`grep CacheDir $INSTLDIR/etc/pacman.conf|cut -d= -f2|cut -d\/ -f2-`
+CACHEDIR=${INSTLDIR}/$PCCACHE
+
+echo "INSTLDIR=${INSTLDIR}"
+echo "PACMANK=${PACMANK}"
+echo "CACHEDIR=${CACHEDIR}"
+echo "DBDIR=${DBDIR}"
+echo "PACMANX=${PACMANX}"
+echo
+
+
+# test if the script is started by root user. If not, exit
+if [ $UID -ne 0 ]; then
+ echo "Only root can run ${APP}"; exitfunc 1
+fi
+
+echo "//"
+echo "// downloading packages to ${CACHEDIR}"
+
+PACMAN="${PACMANX} --config ${PACMANK} --noconfirm"
+
+rm -rf ${TMPDIR}
+mkdir -p ${TMPDIR}
+
+# Helper function for installing a list of packages
+doInstall() {
+ mkdir -p ${INSTLDIR}/sys
+ mkdir -p ${INSTLDIR}/proc
+ mount --bind /sys ${INSTLDIR}/sys
+ mount --bind /proc ${INSTLDIR}/proc
+ ${PACMAN} -r ${INSTLDIR} -Sw $1
+ RET=$?
+ umount ${INSTLDIR}/proc
+ umount ${INSTLDIR}/sys
+ if [ ${RET} -ne 0 ]; then
+ echo "//"
+ echo "// Package $1 FAILED."
+ echo "//"
+ return 1
+ fi
+}
+
+
+PACMAN="${PACMAN} --cachedir $CACHEDIR"
+
+########## GET LIST OF CACHE PACKAGES
+echo "//"
+echo "// ** Getting cache package list ..."
+if [ -n "${CACHEPACKSFILE}" ]; then
+ echo "// from: ${CACHEPACKSFILE}"
+ CACHEPKGS=$( cat ${CACHEPACKSFILE} | grep -v "#" )
+else
+ echo " no cache package file found"
+ exit 0
+fi
+
+
+doInstall "${CACHEPKGS}"
+if [ $? -ne 0 ]; then exitfunc 1; fi
+exitfunc
diff -Nur run.orig/inpacs run/inpacs
--- run.orig/inpacs 2008-08-10 10:51:15.000000000 +0000
+++ run/inpacs 2008-08-29 02:29:31.000000000 +0000
@@ -116,7 +116,7 @@
# Source directory for pacman database directories:
DBDIR=""
# pacman executable:
-PACMANX="pacman"
+PACMANX="pacman -f"
# pacman configuration file
PACMANK="/etc/pacman.conf"
diff -Nur run.orig/jams.larch.patch run/jams.larch.patch
--- run.orig/jams.larch.patch 1970-01-01 00:00:00.000000000 +0000
+++ run/jams.larch.patch 2008-08-29 02:34:34.000000000 +0000
@@ -0,0 +1,110 @@
+Only in run/: cachepacs
+diff -wU4 run.orig/inpacs run/inpacs
+--- run.orig/inpacs 2008-08-10 10:51:15.000000000 +0000
++++ run/inpacs 2008-08-29 02:29:31.000000000 +0000
+@@ -115,9 +115,9 @@
+ VETOFILE=""
+ # Source directory for pacman database directories:
+ DBDIR=""
+ # pacman executable:
+-PACMANX="pacman"
++PACMANX="pacman -f"
+ # pacman configuration file
+ PACMANK="/etc/pacman.conf"
+
+ checkfile ()
+diff -wU4 run.orig/mklarch run/mklarch
+--- run.orig/mklarch 2008-08-10 10:51:15.000000000 +0000
++++ run/mklarch 2008-08-29 02:29:45.000000000 +0000
+@@ -22,9 +22,8 @@
+ #
+ #----------------------------------------------------------------------------
+ # 2008.06.22
+
+-
+ # directory to use for building the CD - the installation root
+ # It must have LOTS of space, ~ 4GB for a 700MB CD
+ INSTLDIR=/home/larchroot
+
+@@ -162,8 +161,9 @@
+ fi
+
+ for fd in $( ls -A ${INSTLDIR} ); do
+ rm -rf ${INSTLDIR}/${fd}
++#lookforme
+ done
+ mkdir -p ${LARCHBUILD}
+
+ ############### Call 'inpacs' to do the installation
+@@ -186,9 +186,8 @@
+ exit 1
+ fi
+ fi
+ INPACSO="${INPACSO} -k pacman.conf"
+-
+ # If necessary add the larch repository to pacman.conf
+ if ! grep '^[larch5]' pacman.conf &>/dev/null; then
+ if [ -d larchrepo ]; then
+ larch5path="file://$( readlink -f larchrepo )"
+@@ -198,14 +197,15 @@
+ sysarch="i686"
+ fi
+ larch5path="${larch5path}/${sysarch}"
+ fi
+- sed "/\[testing\]/ i \
+-[larch5]\n\
+-Server = ${larch5path}\n\
+-#larch5---\n" -i pacman.conf
++ #sed "/\[testing\]/ i \
++ echo "[larch5] " >> pacman.conf
++ echo "Server = ${larch5path}" >> pacman.conf
+ fi
+
++
++
+ if ! which pacman &>/dev/null; then
+ if ! [ -x ${startdir}/pacman ]; then
+ echo "ERROR: Couldn't find pacman executable"
+ exit 1
+@@ -217,17 +217,21 @@
+ if [ $? -ne 0 ]; then exit 1; fi
+
+ # Use build version of pacman.conf in live system, without [larch5] repository.
+ # This can be overwritten by a pacman.conf in the profile's overlay.
++
+ rm -f ${INSTLDIR}/etc/pacman.conf
+-if [ -f pacman.conf.0 ]; then
++if [ -f ${PROFILE}/pacman.conf ]; then
+ # This file should be used in preference to pacman.conf - it is created by
+ # larch-setup on non-Arch systems before commenting out the 'Include' lines.
+- cp pacman.conf.0 ${INSTLDIR}/etc/pacman.conf
++ cp ${PROFILE}/pacman.conf ${INSTLDIR}/etc/pacman.conf
+ else
+ sed '/^\[larch5\]/,/^ *$/ d' <pacman.conf >${INSTLDIR}/etc/pacman.conf
+ fi
+
++cachepacs -a ${PROFILE}/cache_packs $INPACSO -d ${INSTLDIR}
++
++
+ # Generate glibc locales
+ if [ -f ${PROFILE}/locale.gen ]; then
+ echo
+ echo "********** Generating locales **********"
+@@ -247,8 +251,17 @@
+ fi
+
+ echo "// ${APP} finished installation of Arch system"
+ echo "//"
++
++#run script to post-process the new installation
++if [ -f ${PROFILE}/post-process.sh ]
++then
++ ${PROFILE}/post-process.sh ${INSTLDIR} ${PROFILE}
++ echo ${PROFILE}/post-process.sh ${INSTLDIR} ${PROFILE}
++fi
++
++
+ if [ -z "${NOLIVE}" ]; then
+ # Get live CD build functions
+ . ${LARCHDATA}/buildlive
+ mklive
diff -Nur run.orig/mklarch run/mklarch
--- run.orig/mklarch 2008-08-10 10:51:15.000000000 +0000
+++ run/mklarch 2008-08-29 02:29:45.000000000 +0000
@@ -23,7 +23,6 @@
#----------------------------------------------------------------------------
# 2008.06.22
-
# directory to use for building the CD - the installation root
# It must have LOTS of space, ~ 4GB for a 700MB CD
INSTLDIR=/home/larchroot
@@ -163,6 +162,7 @@
for fd in $( ls -A ${INSTLDIR} ); do
rm -rf ${INSTLDIR}/${fd}
+#lookforme
done
mkdir -p ${LARCHBUILD}
@@ -187,7 +187,6 @@
fi
fi
INPACSO="${INPACSO} -k pacman.conf"
-
# If necessary add the larch repository to pacman.conf
if ! grep '^[larch5]' pacman.conf &>/dev/null; then
if [ -d larchrepo ]; then
@@ -199,12 +198,13 @@
fi
larch5path="${larch5path}/${sysarch}"
fi
- sed "/\[testing\]/ i \
-[larch5]\n\
-Server = ${larch5path}\n\
-#larch5---\n" -i pacman.conf
+ #sed "/\[testing\]/ i \
+ echo "[larch5] " >> pacman.conf
+ echo "Server = ${larch5path}" >> pacman.conf
fi
+
+
if ! which pacman &>/dev/null; then
if ! [ -x ${startdir}/pacman ]; then
echo "ERROR: Couldn't find pacman executable"
@@ -218,15 +218,19 @@
# Use build version of pacman.conf in live system, without [larch5] repository.
# This can be overwritten by a pacman.conf in the profile's overlay.
+
rm -f ${INSTLDIR}/etc/pacman.conf
-if [ -f pacman.conf.0 ]; then
+if [ -f ${PROFILE}/pacman.conf ]; then
# This file should be used in preference to pacman.conf - it is created by
# larch-setup on non-Arch systems before commenting out the 'Include' lines.
- cp pacman.conf.0 ${INSTLDIR}/etc/pacman.conf
+ cp ${PROFILE}/pacman.conf ${INSTLDIR}/etc/pacman.conf
else
sed '/^\[larch5\]/,/^ *$/ d' <pacman.conf >${INSTLDIR}/etc/pacman.conf
fi
+cachepacs -a ${PROFILE}/cache_packs $INPACSO -d ${INSTLDIR}
+
+
# Generate glibc locales
if [ -f ${PROFILE}/locale.gen ]; then
echo
@@ -248,6 +252,15 @@
echo "// ${APP} finished installation of Arch system"
echo "//"
+
+#run script to post-process the new installation
+if [ -f ${PROFILE}/post-process.sh ]
+then
+ ${PROFILE}/post-process.sh ${INSTLDIR} ${PROFILE}
+ echo ${PROFILE}/post-process.sh ${INSTLDIR} ${PROFILE}
+fi
+
+
if [ -z "${NOLIVE}" ]; then
# Get live CD build functions
. ${LARCHDATA}/buildlive
|