-
Notifications
You must be signed in to change notification settings - Fork 0
/
system.subr
632 lines (529 loc) · 16.5 KB
/
system.subr
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
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
if [ ! "$_CBSD_SYSTEM_SUBR" ]; then
_CBSD_SYSTEM_SUBR=1
###
# if is_mounted /tmp; then ...mounted..
# - check for dir is mountpoint
is_mounted()
{
local tst
[ ! -d "${1}" ] && return 1
tst=$( /bin/df -l ${1} | /usr/bin/tail +2 | /usr/bin/awk '{ print $6 }' )
[ "${tst}" = "${1}" ]
return $?
}
# if on_mounted /usr/src/base; then ...mounted..
# - check if dir mounted to other place
on_mounted()
{
[ ! -d "${1}" ] && return 1
mount |grep " on " | while read _device on _mountpt; do
[ "$_device" != "$1" ] || exit 2
done
[ $? -eq 2 ] && return 0
return 1
}
# check for populate base from current possibility and run copy-binlib
# $ver variable must be filled
get_base_from_current()
{
local _elf_ver
_elf_ver=$( ${miscdir}/elf_tables --freebsdver /bin/sh )
_jail_ver=${ver%%.*}
# get BASE_DIR
init_basedir
[ -z "${BASE_DIR}" ] && return 0
if [ "${_elf_ver}" = "${_jail_ver}" ]; then
_filelist="${distdir}/share/${platform}-filebases_${_elf_ver}.txt.xz"
${ECHO} "${MAGENTA}Trying to populate ${GREEN}${BASE_DIR}${MAGENTA} from current system.${NORMAL}"
${ECHO} "${MAGENTA}IDX for: ${GREEN}${_elf_ver}${MAGENTA}. Please wait: ${GREEN}this will take a while...${NORMAL}"
if [ ! -f "${_filelist}" ]; then
${ECHO} "${MAGENTA}Error: no index file: ${GREEN}${_filelist}${NORMAL}"
else
copy-binlib filelist=${_filelist} dstdir=${BASE_DIR} basedir=/
/usr/bin/truncate -s0 ${BASE_DIR}/etc/sysctl.conf ${BASE_DIR}/etc/fstab ${BASE_DIR}/etc/rc.conf ${BASE_DIR}/etc/rc.conf.local
fi
[ -d "${BASE_DIR}/rc.conf.d" ] && /bin/rm -f ${BASE_DIR}/etc/rc.conf.d
else
${ECHO} "${MAGENTA}Base version not equal (${GREEN}base: ${_elf_ver}, jail: ${_jail_ver}${MAGENTA}) with jail, populate base from current system impossible${NORMAL}"
fi
}
# check for populate kernel from current possibility and copy it
# $ver variable must be filled
get_kernel_from_current()
{
local _elf_ver
_elf_ver=$( ${miscdir}/elf_tables --freebsdver /bin/sh )
_jail_ver=${ver%%.*}
# get KERNEL_DIR
init_kerneldir
[ -z "${KERNEL_DIR}" ] && return 0
[ ! -d "${KERNEL_DIR}/boot" ] && /bin/mkdir -p ${KERNEL_DIR}/boot
# kernel already exist?
[ -x "${KERNEL_DIR}/boot/kernel/kernel" ] && return 0
if [ "${_elf_ver}" = "${_jail_ver}" ]; then
${ECHO} "${MAGENTA}Take kernel from current system for ${GREEN}${KERNEL_DIR}${MAGENTA}. Please wait: ${GREEN}this will take a while...${NORMAL}"
/bin/cp -a /boot/kernel ${KERNEL_DIR}/boot/
else
${ECHO} "${MAGENTA}Base version not equal (${GREEN}base: ${_elf_ver}, jail: ${_jail_ver}${MAGENTA}) with jail, populate kernel from current system impossible${NORMAL}"
fi
}
register_fetched_base()
{
#idx platform name arch ver stable elf date
baseelf=
baseelf=$( ${miscdir}/elf_tables --ver ${BASE_DIR}/bin/sh 2>/dev/null )
[ -z "${baseelf}" ] && baseelf="0"
[ -z "${TARGET_ARCH}" ] && TARGET_ARCH="${arch}"
#${ECHO} "${MAGENTA}Register base as: ${GREEN}p=$platform,a=$arch,t=$TARGET_ARCH,v=$ver,s=$stable${NORMAL}"
register_base arch=${arch} ver=${ver} target_arch=${TARGET_ARCH} stable=${stable} platform="${platform}"
}
# check for base dir existance
# if not exist - ask and try to fetch from repository
# exit when no base and repo failure
# $BASE_DIR - alternative (prefered) path to base dir
# or
# $arch and $ver (opt: $basename) must be set
get_base()
{
local _elf_ver
local _jail_ver
local _filelist
[ "${ver}" = "empty" ] && return 0
# fill $BASE_DIR
. ${buildconf}
init_basedir
[ -x "${BASE_DIR}/bin/sh" ] && return 0
# check status
base_status
[ $? -eq 3 ] && err 1 "${MAGENTA}Base is not ready, please wait: base status: ${GREEN}3${NORMAL}"
${ECHO} "${MAGENTA}No base dir in: ${GREEN}${BASE_DIR}${NORMAL}"
select_getbase
if [ ! -x "${BASE_DIR}/bin/sh" ]; then
err 1 "${MAGENTA}No base data on: ${GREEN}${BASE_DIR}${NORMAL}"
else
register_fetched_base
fi
}
# check for kernel dir existance
# if not exist - ask and try to fetch from repository
# exit when no kernel and repo failure
# $KERNEL_DIR - alternative (prefered) path to base dir
# or
# $arch and $ver (opt: $basename) must be set
get_kernel()
{
local _elf_ver
local _jail_ver
[ "${ver}" = "empty" ] && return 0
# fill $KERNEL_DIR
. ${buildconf}
init_kerneldir
# check for $KERNEL_DIR existance
if [ ! -x "${KERNEL_DIR}/boot/kernel/kernel" ]; then
getyesno "No ${arch}-${target_arch}-${ver} base. Try to fetch from remote repository ?"
if [ $? -eq 1 ]; then
get_kernel_from_current
else
repo action=get sources=kernel arch=${arch} ver=${ver} target_arch=${target_arch}
[ ! -x "${KERNEL_DIR}/boot/kernel/kernel" ] && get_kernel_from_current
fi
fi
[ ! -x "${KERNEL_DIR}/boot/kernel/kernel" ] && err 1 "${MAGENTA}No kernel data on: ${GREEN}${KERNEL_DIR}${NORMAL}"
}
# Mount base -b or default to destination dir $path
# -a arch
# -b base path
# -c /var/db/ports dbportspath
# -d distfiles path
# -k kernel path
# -n basename
# -o obj path
# -p ports path
# -s source path
# -t target (override path param)
# -v ver
# -x additional mount, fstab format record, eg: "linsys /compat/linux/sys linsysfs rw 0 0"
mountbase()
{
local basepath kernelpath sourcepath objpath portspath distfilespath distpackagepath dbportspath MNTCODE
local _base_mounted=0
# defaults
portspath="/usr/ports"
distfilespath="${tmpdir}/distfiles"
distpackagepath="${tmpdir}/usr/ports/packages"
xfstab="${ftmpdir}/mountbase.$$"
MNTCODE=0
while getopts "a:b:c:d:k:n:o:p:s:t:v:x:" opt; do
case "${opt}" in
a) arch="${OPTARG}" ;;
b) basepath="${OPTARG}" ;;
c) dbportspath="${OPTARG}" ;;
d) distfilespath="${OPTARG}" ;;
k) kernelpath="${OPTARG}" ;;
n) basename="${OPTARG}" ;;
o) objpath="${OPTARG}" ;;
p) portspath="${OPTARG}" ;;
s) sourcepath="${OPTARG}" ;;
t) path="${OPTARG}" ;;
v) ver="${OPTARG}" ;;
x) echo "${OPTARG}" >> "${xfstab}" ;;
esac
shift $(($OPTIND - 1))
done
#already mounted?
is_mounted ${path} && _base_mounted=1
if [ ${_base_mounted} -eq 0 ]; then
#test for zfs mounted & mount if not
case ${zfsfeat} in
1)
. ${zfstool}
[ ${baserw} -eq 1 ] && path=${data}
zfsmnt ${path}
[ $? -eq 2 ] && /sbin/zfs mount "${ZPOOL}"
;;
esac
if [ "${baserw}" = "0" ]; then
get_base
else
[ ! -f "${path}/bin/sh" ] && get_base
fi
[ ! -d "${path}" ] && /bin/mkdir -p ${path}
if [ "${baserw}" = "0" ]; then
#check for md-based base location (postfix -md)
if [ -f "${BASE_DIR}-md/bin/sh" ]; then
echo "Mount MD-based base location as base..."
${MOUNT_NULL_CMD} -oro "${BASE_DIR}-md" ${path}
MNTCODE=$?
else
${MOUNT_NULL_CMD} -oro ${BASE_DIR} ${path}
MNTCODE=$?
fi
fi
fi # is _base_mounted=0
if [ "${mount_kernel}" != "0" ]; then
# Other part
if [ -n "${kernelpath}" -a -d "${kernelpath}" ]; then
[ ! -d "${path}/boot/kernel" ] && mkdir -p ${path}/boot/kernel
${MOUNT_NULL_CMD} -oro ${kernelpath} ${path}/boot/kernel
fi
fi
if [ "${mount_source}" != "0" ]; then
if [ -n "${sourcepath}" -a -d "${sourcepath}" ]; then
[ ! -d "${path}/usr/src" ] && mkdir -p ${path}/usr/src
${MOUNT_NULL_CMD} -oro ${sourcepath} ${path}/usr/src
fi
fi
if [ "${mount_obj}" != "0" ]; then
if [ -n "${objpath}" -a -d "${objpath}" ]; then
[ ! -d "${path}/usr/obj" ] && mkdir -p ${path}/usr/obj
${MOUNT_NULL_CMD} -orw ${objpath} ${path}/usr/obj
fi
fi
if [ "${mount_ports}" != "0" ]; then
if [ -n "${portspath}" ]; then
[ ! -d "${portspath}" ] && mkdir -p ${portspath}
[ ! -d "${path}/usr/ports" ] && mkdir -p ${path}/usr/ports
${MOUNT_NULL_CMD} -oro ${portspath} ${path}/usr/ports
fi
if [ -n "${distfilespath}" ]; then
# we need for valid mount point on /usr/ports/distifles
[ ! -d /usr/ports/distfiles ] && /bin/mkdir -p /usr/ports/distfiles
[ ! -d /usr/ports/packages ] && /bin/mkdir -p /usr/ports/packages
[ ! -d "${distfilespath}" ] && /bin/mkdir -p ${distfilespath}
[ ! -d "${distpackagepath}" ] && /bin/mkdir -p ${distpackagepath}
[ ! -d "${path}/usr/ports/distfiles" ] && /bin/mkdir -p ${path}/usr/ports/distfiles
[ ! -d "${path}/usr/ports/packages" ] && /bin/mkdir -p ${path}/usr/ports/packages
${MOUNT_NULL_CMD} -orw ${distfilespath} ${path}/usr/ports/distfiles
${MOUNT_NULL_CMD} -orw ${distpackagepath} ${path}/usr/ports/packages
fi
fi
if [ -f "${xfstab}" ]; then
mountfstab jroot="${path}" fstab="${xfstab}" jname="${jname}"
/bin/rm -f "${xfstab}"
fi
return ${MNTCODE}
}
mount_jail_fstab()
{
local _res=$( /usr/local/bin/cbsd mountfstab jroot=${path} fstab=${mount_fstab} jname="${jname}" )
if [ $? -ne 0 ]; then
# force unmount it better then..
echo "Invalid fstab file: ${_res}"
_res=$( cbsd jcleanup jname=${jname} )
continue
fi
if [ -f "${mount_fstab}.local" ]; then
mountfstab jroot=${path} fstab=${mount_fstab}.local jname="${jname}"
# cleanup for local?
fi
}
unmountbase()
{
[ $baserw -eq 0 ] && umount -f ${path}
unmountfstab jroot=${path} fstab=${mount_fstab} > /dev/null 2>&1
jcleanup jname=${jname} > /dev/null 2>&1
}
# Unmount all in $path or $1
# if exist $2 - do not unmount root of $1
umount_cdirs()
{
local _unmount_root=1
[ -n "${1}" ] && path="$1"
[ -n "${2}" ] && _unmount_root=0
# when error before path, we do not have any mounts by scripts
[ -z "${path}" ] && return 0
MOUNT_LIST=$( /sbin/mount |/usr/bin/sort -r| /usr/bin/awk -F" on " '{print $2}' )
MPATH=""
for mount_point in $MOUNT_LIST; do
case $mount_point in
${path}/*)
[ -n "${mount_point}" ] && MPATH="${MPATH} $path${mount_point#$path}"
;;
esac
done
[ -n "${MPATH}" ] && umount -f ${MPATH}
#finaly unmount cdir
if [ ${_unmount_root} -eq 1 ]; then
is_mounted ${path} && /sbin/umount -f ${path}
fi
}
# populate $2 chroot dir from $1 base directory
# when baserw set to 0, just create default hier
populate_cdir()
{
local _dir _dst _i
[ -d "${1}" -a -d "${2}" ] || err 1 "No such base version on ${1}"
_dir=$1
_dst=$2
#JAILNODATA sample
#[ -z "${JAILNODATA}" -a "${baserw}" = "0" ] && JAILNODATA="${_dir}/.cshrc.*|\
#${_dir}/dev.*|\
#${_dir}/bin.*|\
#${_dir}/media.*|\
#${_dir}/rescue.*|\
#${_dir}/sys.*|\
#${_dir}/.profile.*|\
#${_dir}/boot.*|\
#${_dir}/lib.*|\
#${_dir}/mnt.*|\
#${_dir}/COPYRIGHT.*|\
#${_dir}/libexec.*|\
#${_dir}/proc.*|\
#${_dir}/sbin.*|\
#${_dir}/usr/bin.*|\
#${_dir}/usr/games.*|\
#${_dir}/usr/include.*|\
#${_dir}/usr/lib.*|\
#${_dir}/usr/lib32.*|\
#${_dir}/usr/libdata.*|\
#${_dir}/usr/libexec.*|\
#${_dir}/usr/local.*|\
#${_dir}/usr/sbin.*|\
#${_dir}/usr/share.*|"
JAILDATA="${_dir}/compat \
${_dir}/boot \
${_dir}/dev \
${_dir}/etc \
${_dir}/home \
${_dir}/root \
${_dir}/tmp \
${_dir}/usr \
${_dir}/var \
${_dir}/.cshrc \
${_dir}/.profile \
${_dir}/COPYRIGHT"
if [ "${baserw}" = "1" ]; then
cd ${_dir} && /bin/pax -p eme -rw . ${_dst}
else
if [ -n "${JAILNODATA}" ]; then
cd ${_dir} && /usr/bin/find -E ${_dir} \( -type f -or -type d -or -type l \) -and -not -regex \"$JAILNODATA\" -print |/usr/bin/sed s:${_dir}:./:g |/usr/bin/cpio -pdmu ${_dst}
elif [ -n "${JAILDATA}" ]; then
for _i in ${JAILDATA}; do
/bin/cp -a ${_i} ${_dst}
done
fi
fi
[ "${applytpl}" = "1" ] && /usr/bin/truncate -s0 ${_dst}/etc/motd
return 0
}
# populate or remove system files from jail data dir
# $1 - jail data dir
# $2 - mode: 1 - write (populate), 2 - readonly (remove)
switch_baserw()
{
[ ! -d "${1}" ] && return 0
get_base
# populate
if [ "${2}" = "1" ]; then
JAILNODATA="${_dir}/|\
${BASE_DIR}/dev.*|\
${BASE_DIR}/etc.*|\
${BASE_DIR}/sys.*|\
${BASE_DIR}/proc.*|\
${BASE_DIR}/root.*|"
${ECHO} "${MAGENTA}Populate jail data from: ${GREEN}${BASE_DIR}${NORMAL}"
[ ! -d "${BASE_DIR}" ] && return 0
cd ${BASE_DIR} && /usr/bin/find -E ${BASE_DIR} \( -type f -or -type d -or -type l \) -and -not -regex \"$JAILNODATA\" -print |/usr/bin/sed s:${BASE_DIR}:./:g |/usr/bin/cpio -pdmu ${1}
# todo: migrate to copy-binlib
# base_ver=${ver%%.*}
# local index_file
# index_file="${sharedir}/FreeBSD-filebases_${base_ver}.txt.xz"
# if [ ! -r "${index_file}" ]; then
# ${ECHO} "${MAGENTA}switch_baserw error: no such index file: ${GREEN}${index_file}${NORMAL}"
# return 1
# fi
# copy-binlib filelist=${index_file} dstdir=${1} basedir=${BASE_DIR} excludedir="/dev|/etc|/sys|/proc|/root"
[ ! -d "${1}/dev" ] && /bin/mkdir "${1}/dev"
#remove system fstab
[ -f "${jailfstabdir}/${jailfstabpref}${jname}" ] && /bin/rm -f "${jailfstabdir}/${jailfstabpref}${jname}"
elif [ "$2" = "2" ]; then
# switch to basero
# create system fstab
/bin/cat > ${mount_fstab} << EOF
# Please do not edit this file for additional fstabs
# Use ${jailfstabdir}/${jailfstabpref}local instead
${data}/etc /etc ${NULLFS} rw 0 0
${data}/root /root ${NULLFS} rw 0 0
${data}/tmp /tmp ${NULLFS} rw 0 0
${data}/usr/home /usr/home ${NULLFS} rw 0 0
${data}/usr/local /usr/local ${NULLFS} rw 0 0
${data}/usr/compat /usr/compat ${NULLFS} rw 0 0
${data}/var /var ${NULLFS} rw 0 0
#
EOF
#todo: remove file from data listed in base jail
REMOVEDIR="bin \
lib \
libexec \
rescue \
sbin \
usr/bin \
usr/games \
usr/include \
usr/lib \
usr/lib32 \
usr/libdata \
usr/libexec \
usr/sbin \
usr/share"
[ -z "${data}" ] && return 0
${ECHO} "${MAGENTA}Reduce jail data by switching from baserw -> basero: ${GREEN}${data}${NORMAL}"
for i in ${REMOVEDIR}; do
[ -d "${data}/${i}" ] && ${CHFLAGS_CMD} -R noschg ${data}/${i} && /bin/rm -rf ${data}/${i}
done
fi
# populate
}
# return getbase_source variable
select_getbase_source_by_list()
{
if [ "${inter}" = "0" -o "${INTER}" = "0" ]; then
# set default for non interactive action
getbase_source="repo"
return 0
fi
local _res _id i=1
local _elf_ver
_elf_ver=$( ${miscdir}/elf_tables --freebsdver /bin/sh )
_jail_ver=${ver%%.*}
local subject="Select base sources:"
local _method_list=
${ECHO} "${MAGENTA}${subject}${NORMAL}"
echo
${ECHO} "${BOLD}0 .. CANCEL${NORMAL}"
${ECHO} "${BOLD}${i} .. ${GREEN}repo${MAGENTA} (Fetch base from repository over Internet). ${GREEN}(default)${NORMAL}"
_method_list="${_method_list} repo"
i=$(( i + 1 ))
if [ "${_elf_ver}" = "${_jail_ver}" ]; then
local oarch=$( /usr/bin/uname -m )
if [ "${arch}" = "${oarch}" ]; then
${ECHO} "${BOLD}${i} .. ${GREEN}populate${MAGENTA} (Create base from your host's environment)${NORMAL}"
i=$(( i + 1 ))
_method_list="${_method_list} populate"
fi
else
${ECHO} "${MAGENTA}(Populating from current environment impossible due to jail version not equal base: hoster:${GREEN}${_elf_ver}${MAGENTA}, jail:${GREEN}:${_jail_ver}${MAGENTA})${NORMAL}"
fi
${ECHO} "${BOLD}${i} .. ${GREEN}extract${MAGENTA} (Specify path to base.txz and extract it)${NORMAL}"
i=$(( i + 1 ))
_method_list="${_method_list} extract"
${ECHO} "${BOLD}${i} .. ${GREEN}build${MAGENTA} (cbsd srcup + cbsd world. Checkout source and build it. Long method)${NORMAL}"
_method_list="${_method_list} build"
echo
printf "${BOLD}Enter id 0-${i} or method name:${NORMAL} "
set -e
read _id
set +e
[ "${_id}" = "0" ] && exit 0
if [ -z "${_id}" ]; then
# Empty input, use default
getbase_source="repo"
return 0
fi
getbase_source=
if ! is_number ${_id}; then
local _tmp _x=0
for _tmp in ${_method_list}; do
_x=$(( _x + 1 ))
[ ${_x} -eq ${_id} ] && getbase_source="${_tmp}" && break
[ ${_x} -gt ${i} ] && break
done
else
getbase_source="${_id}"
fi
[ -z "${getbase_source}" ] && return 1
return 0
}
select_getbase()
{
local _repeat=1
while [ ${_repeat} -ne 0 ]; do
select_getbase_source_by_list
[ $? -ne 0 ] && echo "No valid source"
[ "${inter}" = "0" -o "${INTER}" = "0" ] && _repeat=0
case "${getbase_source}" in
repo)
#echo "repo action=get sources=base arch=${arch} ver=${ver} target_arch=${target_arch}"
repo action=get sources=base arch=${arch} ver=${ver} target_arch=${target_arch}
;;
populate)
get_base_from_current
;;
extract)
${ECHO} "${MAGENTA}Please provide full path to base archive, (e.g. default: ${GREEN}/mnt/usr/freebsd-dist/base.txz${MAGENTA}):${NORMAL}"
local _path
read _path
[ -z "${_path}" ] && _path="/mnt/usr/freebsd-dist/base.txz"
if [ ! -r "${_path}" ]; then
${ECHO} "${MAGENTA}No such archive file: ${GREEN}${_path}${NORMAL}"
continue
fi
[ ! -d "${BASE_DIR}" ] && /bin/mkdir -p ${BASE_DIR}
cd ${BASE_DIR}
set -e
/usr/bin/tar vxfz ${_path}
set +e
;;
build)
local origver stable
origver=${ver%%.*}
if [ "${origver}" = "${ver}" ]; then
stable=1
else
stable=0
fi
srcup ver=${ver} stable=${stable} && world ver=${ver} arch=${arch} stable=${stable}
;;
*)
${ECHO} "${MAGENTA} select_getbase: unknown source: ${GREEN}${getbase_source}${NORMAL}"
;;
esac
if [ -x "${BASE_DIR}/bin/sh" ]; then
preparebase dst=${BASE_DIR}
_repeat=0
fi
done
return 0
}
###
fi