forked from tribblix/ips2svr4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrepo2svr4.sh
More file actions
executable file
·809 lines (775 loc) · 17.1 KB
/
repo2svr4.sh
File metadata and controls
executable file
·809 lines (775 loc) · 17.1 KB
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
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
#!/bin/ksh
#
# convert an ips package to svr4, from an on-disk repo
#
#
# high level strategy:
#
# 1. create a new temporary directory
# 2. parse manifests to build an svr4 proto area
# 3. create the svr4 package
#
# conversion strategy:
#
# 1. construct arch variant list
# 2. create a new directory for each architecture (or common if no arch)
# 3. Copy all relevant files into target directory hierarchy, using
# manifest to map pathnames and build the prototype file as we go
# 4. create a pkginfo file from manifest or manifest.legacy (if it exists)
# 5. Create install/depend from depend actions in the manifest,
# ignoring incorporations
# 7. run pkgmk
#
#
# weaknesses of the current implementation
# 1. no attempt at architecture variants
# 2. fixed paths
# 3. need to fully handle set actions
# 4. need to fully handle driver actions
# 5. handle reboot-needed
# 6. Need to handle global/ngz
#
#
# Global variables
#
PKGDIR=/usr/bin
#PKGDIR=/var/tmp/nbuild/sprate-0.09/bin
PKGMK="${PKGDIR}/pkgmk"
PKGTRANS="${PKGDIR}/pkgtrans"
PNAME=/home/ptribble/Tribblix/pkg_name.sh
#
# global flags
#
# contains a legacy action
HAS_LEGACY=false
# contains any content
HAS_CONTENT=false
# is marked as renamed or obsolete
IS_GARBAGE=false
usage() {
echo "Usage: $0 input_pkg output_pkg"
exit 1
}
bail_out() {
rm -fr $BDIR $DSTDIR/tmp/${OUTPKG}
exit 0
}
#
# initialize driver handling by creating the postinstall and postremove
# scripts
#
init_driver() {
mkdir -p ${BDIR}/install
if [ ! -f ${BDIR}/install/postinstall ]; then
cat > ${BDIR}/install/postinstall <<EOF
#!/sbin/sh
#
# Automatically generated driver install script
#
CMD=/usr/sbin/add_drv
if [ "\${BASEDIR}" = "/" ]; then
BFLAGS=""
else
BFLAGS="-b \${BASEDIR}"
fi
EOF
cat > ${BDIR}/install/postremove <<EOF
#!/sbin/sh
#
# Automatically generated driver remove script
#
CMD=/usr/sbin/rem_drv
if [ "\${BASEDIR}" = "/" ]; then
BFLAGS=""
else
BFLAGS="-b \${BASEDIR}"
fi
EOF
chmod a+x ${BDIR}/install/postremove ${BDIR}/install/postinstall
echo "i postinstall=./install/postinstall" >> ${BDIR}/prototype
echo "i postremove=./install/postremove" >> ${BDIR}/prototype
fi
}
#
# class action scripts
#
init_preserve() {
mkdir -p ${BDIR}/install
if [ ! -f ${BDIR}/install/i.preserve ]; then
cat > ${BDIR}/install/i.preserve <<EOF
#!/bin/sh
#
# bone-headed class-action script for preserve
#
while read src dest
do
if [ ! -f $dest ] ; then
cp $src $dest
fi
done
exit 0
EOF
echo "i i.preserve=./install/i.preserve" >> ${BDIR}/prototype
fi
}
#
# initialise dependency handling
#
init_depend() {
mkdir -p ${BDIR}/install
if [ ! -f ${BDIR}/install/depend ]; then
cat > ${BDIR}/install/depend <<EOF
# The following dependencies are automatically generated
# from the IPS manifest for this package, with automatic
# generation of SVR4 package names.
#
# No version information is preserved
#
EOF
echo "i depend=./install/depend" >> ${BDIR}/prototype
fi
}
#
# if there are services that should be restarted, add them to the postinstall
# script
#
handle_restarts() {
if [ -f ${BDIR}/restart_fmri_list ]; then
mkdir -p ${BDIR}/install
if [ ! -f ${BDIR}/install/postinstall ]; then
cat > ${BDIR}/install/postinstall <<EOF
#!/sbin/sh
#
# Automatically generated service restart script
#
EOF
cat > ${BDIR}/install/postremove <<EOF
#!/sbin/sh
#
# Automatically generated service restart script
#
EOF
chmod a+x ${BDIR}/install/postremove ${BDIR}/install/postinstall
echo "i postinstall=./install/postinstall" >> ${BDIR}/prototype
echo "i postremove=./install/postremove" >> ${BDIR}/prototype
fi
#
# this check is so we only actually restart if the install is to the
# current system. If we're installing to an alternate image, then the
# restarts will happen automatically when it boots
#
# FIXME should the restart be -s
#
cat >> ${BDIR}/install/postinstall <<EOF
if [ "\${BASEDIR}" = "/" ]; then
EOF
cat >> ${BDIR}/install/postremove <<EOF
if [ "\${BASEDIR}" = "/" ]; then
EOF
/usr/bin/cat ${BDIR}/restart_fmri_list | /usr/bin/sort | /usr/bin/uniq | /usr/bin/awk '{print "/usr/sbin/svcadm restart "$1}' >> ${BDIR}/install/postinstall
/usr/bin/cat ${BDIR}/restart_fmri_list | /usr/bin/sort | /usr/bin/uniq | /usr/bin/awk '{print "/usr/sbin/svcadm restart "$1}' >> ${BDIR}/install/postremove
echo "fi" >> ${BDIR}/install/postinstall
echo "fi" >> ${BDIR}/install/postremove
#
# some of the packages have broken dependencies, so we exit cleanly to
# stop errors from missing services messing up pkgadd or pkgrm
#
echo "exit 0" >> ${BDIR}/install/postinstall
echo "exit 0" >> ${BDIR}/install/postremove
/usr/bin/rm ${BDIR}/restart_fmri_list
fi
}
#
# parse a driver line in the manifest
# should have name, maybe alias and perms
# FIXME policy privilege
# FIXME aliases perms etc should be emitted with single quotes
#
handle_driver() {
HAS_CONTENT=true
init_driver
CMD_FRAG='${CMD} ${BFLAGS}'
UCMD_FRAG='/usr/sbin/update_drv ${BFLAGS}'
DNAME=""
PERMS=""
CLONEPERMS=""
ALIASES=""
CLASS=""
for frag in "$@"
do
key=${frag%%=*}
nval=${frag#*=}
value=${nval%%=*}
case $key in
name)
DNAME="$value"
;;
perms)
if [ "x${PERMS}" = "x" ]; then
PERMS="-m '$value'"
else
PERMS="${PERMS},""'$value'"
fi
;;
alias)
if [ "x${ALIASES}" = "x" ]; then
ALIASES="-i '"'"'$value'"'
else
ALIASES="${ALIASES} "'"'$value'"'
fi
;;
class)
CLASS="-c $value"
;;
*zone*)
printf ""
;;
clone_perms)
CLONEPERMS="'$value'"
;;
*)
echo unhandled driver action $frag
;;
esac
done
#
# ddi_pseudo confuses the parser, override where it breaks
#
if [ "x${INPKG}" = "xdriver%2Fx11%2Fxsvc" ]; then
DNAME="xsvc"
fi
if [ "x${INPKG}" = "xdriver%2Fstorage%2Fcpqary3" ]; then
DNAME="cpqary3"
fi
if [ "x${INPKG}" = "xdriver%2Fcrypto%2Ftpm" ]; then
DNAME="tpm"
PERMS="-m '* 0600 root sys'"
fi
if [ "x${ALIASES}" != "x" ]; then
ALIASES="${ALIASES}'"
fi
if [ "x${DNAME}" != "x" ]; then
echo "${CMD_FRAG} ${PERMS} ${ALIASES} ${CLASS} $DNAME" >> ${BDIR}/install/postinstall
echo "${CMD_FRAG} $DNAME" >> ${BDIR}/install/postremove
fi
if [ "x${CLONEPERMS}" != "x" ]; then
echo "${UCMD_FRAG} -a -m ${CLONEPERMS} clone" >> ${BDIR}/install/postinstall
fi
}
#
# parse a directory line in the manifest
# should have group, owner, mode, and path
#
handle_dir() {
HAS_CONTENT=true
for frag in $*
do
key=${frag%%=*}
nval=${frag#*=}
value=${nval%%=*}
case $key in
*zone*)
# FIXME zone handling
printf ""
;;
path)
dirpath=$value
;;
mode)
mode=$value
;;
owner)
owner=$value
;;
group)
group=$value
;;
facet*)
printf ""
;;
*)
echo "unhandled dir attributes $frag"
;;
esac
done
mkdir -p -m $mode ${BDIR}/${dirpath}
echo "d none ${dirpath} ${mode} ${owner} ${group}" >> ${BDIR}/prototype
}
#
# parse a link line in the manifest
# should have path and target
# skip reboot-needed; handle it with the target file
#
handle_link() {
HAS_CONTENT=true
for frag in $*
do
key=${frag%%=*}
nval=${frag#*=}
value=${nval%%=*}
case $key in
*zone*|reboot-needed)
# FIXME zone handling
printf ""
;;
path)
dirpath=$value
;;
target)
target=$value
;;
*)
echo "unhandled link attribute $frag"
;;
esac
done
echo "s none ${dirpath}=${target}" >> ${BDIR}/prototype
}
#
# parse a hardlink line in the manifest
# should have path and target
#
handle_hardlink() {
HAS_CONTENT=true
for frag in $*
do
key=${frag%%=*}
nval=${frag#*=}
value=${nval%%=*}
case $key in
*zone*)
# FIXME zone handling
printf ""
;;
path)
dirpath=$value
;;
target)
target=$value
;;
*)
echo "unhandled hardlink attribute $frag"
;;
esac
done
case ${target} in
*~*)
echo "WARNING: skipping link to $target"
;;
*)
echo "l none ${dirpath}=${target}" >> ${BDIR}/prototype
;;
esac
}
#
# parse a file line in the manifest
# should have group, owner, mode, and path like a directory
# plus some metadata
# ignore the pkg.size and pkg.csize attributes we don't use them anyway
# ignore chash and elfhash, as we don't use them either
#
# cp -p retains the timestamp; this allows repeated invocations of this
# script to generate identical packages, but if the timestamp is set in
# the manifest we explicitly touch the file to that date
#
handle_file() {
HAS_CONTENT=true
FTYPE="f"
FCLASS="none"
TSTAMP=""
echo $* | read fhash line
fh=`echo $fhash| cut -c1-2`
# file in the repo is ${REPODIR}/file/${fh}/${fhash}
for frag in $line
do
key=${frag%%=*}
nval=${frag#*=}
value=${nval%%=*}
case $key in
pkg.size*|pkg.csize*|reboot-needed|*zone*|elfarch|elfbits|chash|elfhash|original_name)
# FIXME reboot, zone handling
# FIXME should check on elfarch
# FIXME could filter on elfbits to make a 32-bit distro
printf ""
;;
path)
filepath=$value
;;
mode)
mode=$value
;;
owner)
owner=$value
;;
group)
group=$value
;;
timestamp)
# timestamp=19700101T000000Z
# touch argument is of the form [[CC]YY]MMDDhhmm[.SS]
TSTAMP=`echo $value | /usr/bin/awk -FT '{printf("%s%.4s",$1,$2)}'`
;;
facet*)
printf ""
;;
restart_fmri)
touch ${BDIR}/restart_fmri_list
echo $value >>${BDIR}/restart_fmri_list
;;
preserve)
FTYPE="e"
#FCLASS="preserve"
#init_preserve
;;
*)
echo "unhandled file attribute $frag"
;;
esac
done
dpath=`dirname $filepath`
if [ ! -d ${BDIR}/${dpath} ]; then
mkdir -p ${BDIR}/${dpath}
fi
if [ -f ${BDIR}/${filepath} ]; then
echo "DBG: parsing $hash $line"
echo "WARN: path $filepath already exists in $dpath"
fi
/usr/bin/cp -p ${REPODIR}/file/${fh}/${fhash} ${BDIR}/${filepath}.gz
/usr/bin/gunzip ${BDIR}/${filepath}.gz
/usr/bin/chmod $mode ${BDIR}/${filepath}
if [ "xx${TSTAMP}" != "xx" ]; then
/bin/touch -t ${TSTAMP} ${BDIR}/${filepath}
fi
case ${filepath} in
*~*)
echo "WARNING: skipping file path $filepath"
;;
*)
echo "${FTYPE} ${FCLASS} ${filepath}=${filepath} ${mode} ${owner} ${group}" >> ${BDIR}/prototype
;;
esac
}
#
# parse a legacy line in the manifest
#
# This doesn't always work, as the legacy action maps to the SVR4 emulation
# layer. So there could be multiple legacy actions, in the case of merged
# packages, or none at all.
#
# none at all is bad, as that causes an incomplete pkginfo file which causes
# package generation to fail
#
handle_legacy() {
HAS_LEGACY=true
for frag in "$*"
do
eval "$frag"
done
NAME="$name"
VERSION="$version"
ARCH="$arch"
CATEGORY="$category"
VENDOR="$vendor"
BASEDIR="/"
PKG="$OUTPKG"
DESC="$desc"
# FIXME why null?
# the problem appears to be if a legacy line includes a facet
if [ "x$VERSION" = "x" ]; then
VERSION="1.0"
fi
# PSTAMP automatically generated by pkgmk
# CLASSES automatically set by pkgmk
echo "PKG=\"${PKG}\"" >> ${BDIR}/pkginfo
echo "NAME=\"${NAME}\"" >> ${BDIR}/pkginfo
echo "ARCH=\"${ARCH}\"" >> ${BDIR}/pkginfo
echo "VERSION=\"${VERSION}\"" >> ${BDIR}/pkginfo
echo "CATEGORY=\"${CATEGORY}\"" >> ${BDIR}/pkginfo
echo "VENDOR=\"${VENDOR}\"" >> ${BDIR}/pkginfo
echo "BASEDIR=\"${BASEDIR}\"" >> ${BDIR}/pkginfo
}
emulate_legacy() {
HAS_LEGACY=true
NAME="$OUTPKG"
VERSION=`uname -v`
ARCH=`uname -p`
CATEGORY="application"
VENDOR="Tribblix"
BASEDIR="/"
PKG="$OUTPKG"
# FIXME should be pkg.summary
DESC="$OUTPKG"
# PSTAMP automatically generated by pkgmk
# CLASSES automatically set by pkgmk
echo "PKG=\"${PKG}\"" >> ${BDIR}/pkginfo
echo "NAME=\"${NAME}\"" >> ${BDIR}/pkginfo
echo "ARCH=\"${ARCH}\"" >> ${BDIR}/pkginfo
echo "VERSION=\"${VERSION}\"" >> ${BDIR}/pkginfo
echo "CATEGORY=\"${CATEGORY}\"" >> ${BDIR}/pkginfo
echo "VENDOR=\"${VENDOR}\"" >> ${BDIR}/pkginfo
echo "BASEDIR=\"${BASEDIR}\"" >> ${BDIR}/pkginfo
}
#
# parse set directives
#
handle_set() {
for frag in "$*"
do
eval "$frag"
done
case $name in
'pkg.renamed')
IS_GARBAGE=true
;;
'pkg.obsolete')
IS_GARBAGE=true
;;
'pkg.description')
echo "IPS_DESCRIPTION=$value" >> ${BDIR}/pkginfo
;;
'pkg.summary')
echo "IPS_SUMMARY=$value" >> ${BDIR}/pkginfo
;;
'pkg.fmri')
echo "IPS_FMRI=$value" >> ${BDIR}/pkginfo
;;
'info.classification')
echo "IPS_CLASSIFICATION=$value" >> ${BDIR}/pkginfo
;;
'org.opensolaris.consolidation')
echo "IPS_CONSOLIDATION=$value" >> ${BDIR}/pkginfo
;;
'variant.arch'|'variant.opensolaris.zone'|'opensolaris.smf.fmri'|'org.opensolaris.smf.fmri'|'opensolaris.arc_url')
printf ""
;;
'info.repository_changeset'|'info.maintainer_url'|'info.repository_url'|'info.defect_tracker.url'|'info.source_url'|'info.upstream_url'|'info.upstream')
printf ""
;;
*)
echo "Unhandled set directive $name"
;;
esac
}
#
# handle dependencies. we only accept pkg fmris, ignore consolidations
# we could put the version information in, but need to decide if and how
# to use it before doing so
#
# if we hit an incorporate dependency then this is an incorporation
# and we simply bail
#
handle_depend() {
for frag in "$*"
do
eval "$frag"
done
case $type in
'incorporate')
echo "Looks like an incorporation, bailing out"
bail_out
;;
'require')
case $fmri in
pkg*)
pkg_str=`echo $fmri | sed 's=^pkg:/=='`
pkg_name=`echo $pkg_str | awk -F@ '{print $1}'`
pkg_vers=`echo $pkg_str | awk -F@ '{print $2}'`
case $pkg_name in
*incorporation)
printf ""
;;
*)
svr4_name=`$PNAME $pkg_name`
init_depend
echo "P $svr4_name" >> ${BDIR}/install/depend
;;
esac
;;
*)
printf ""
;;
esac
;;
*)
echo "Unhandled dependency type $type"
;;
esac
}
case $# in
2)
INPKG=$1
OUTPKG=$2
;;
1)
INPKG=$1
OUTPKG=`$PNAME $INPKG`
;;
*)
usage
;;
esac
#
# these ought to be args
#
REPODIR=/home/ptribble/Illumos/m7-rc/illumos-gate/packages/i386/nightly-nd/repo.redist
DSTDIR=/var/tmp/illumos-pkgs
if [ ! -d "${REPODIR}" ]; then
echo "ERROR: Missing repo"
exit 1
fi
mkdir -p $DSTDIR/build $DSTDIR/pkgs $DSTDIR/tmp
#
# find the input manifest
#
PDIR="${REPODIR}/pkg/${INPKG}"
if [ ! -d "${PDIR}" ]; then
echo "ERROR: cannot find ${PDIR}"
exit 1
fi
MANIFEST=`find $PDIR -type f`
if [ -z "$MANIFEST" ]; then
bail_out
fi
MANIFEST=`/bin/ls -1tr ${PDIR}/* | tail -1`
#
# this is the temporary build area
#
BDIR=$DSTDIR/build/${OUTPKG}
mkdir -p $BDIR
touch ${BDIR}/pkginfo ${BDIR}/prototype
echo "i pkginfo=./pkginfo" >> ${BDIR}/prototype
#
# read the manifest, line by line
#
cat $MANIFEST |
{
while read directive line ;
do
case $directive in
dir)
handle_dir $line
;;
set)
handle_set $line
;;
depend)
handle_depend $line
;;
file)
handle_file $line
;;
link)
handle_link $line
;;
hardlink)
handle_hardlink $line
;;
legacy)
handle_legacy $line
;;
driver)
# the eval is some funky magic to pass quoted arguments
eval handle_driver $line
;;
*)
echo ...directive $directive not yet supported...
;;
esac
done
}
#
# is this a completely empty package? if it has no content, no legacy
# action, and is garbage (either renamed or obsolete) then just stop
#
if [ "$HAS_CONTENT" = "false" -a "$HAS_LEGACY" = "false" -a "$IS_GARBAGE" = "true" ]; then
echo "Empty package, bailing out"
bail_out
fi
#
# if one of the above is true, then we're in some sort of limbo
# issue an error and carry on hoping for the best
#
if [ "$HAS_CONTENT" = "false" ]; then
echo "Unhandled package condition - no content"
fi
if [ "$HAS_LEGACY" = "false" ]; then
echo "Unhandled package condition - no legacy, emulating"
emulate_legacy
fi
if [ "$IS_GARBAGE" = "true" ]; then
echo "Unhandled package condition - garbage package"
fi
#
# SUNWcs has bogus timestamps on
# etc/logadm.conf etc/security/*attr etc/user_attr
#
# need to reset kernel state files back to null
# (IMHO, that these files are editable is a bug)
#
# also remove history of the current live system
#
cd $BDIR
if [ -f etc/logadm.conf ]; then
touch -r /etc/passwd etc/logadm.conf
fi
if [ -f etc/user_attr ]; then
cat /etc/user_attr | grep -v ptribble > etc/user_attr
touch -r /etc/passwd etc/user_attr
fi
if [ -f etc/passwd ]; then
cat /etc/passwd | grep -v ptribble > etc/passwd
touch -r /etc/passwd etc/passwd
fi
if [ -f etc/shadow ]; then
cat /etc/shadow | grep -v ptribble > etc/shadow
touch -r /etc/passwd etc/shadow
fi
if [ -f etc/security/auth_attr ]; then
touch -r /etc/passwd etc/security/auth_attr
fi
if [ -f etc/security/exec_attr ]; then
touch -r /etc/passwd etc/security/exec_attr
fi
if [ -f etc/security/prof_attr ]; then
touch -r /etc/passwd etc/security/prof_attr
fi
if [ -f etc/inet/hosts ]; then
HNAME=`/usr/bin/hostname`
cat /etc/inet/hosts | sed s:${HNAME}:tribblix:g > etc/inet/hosts
touch -r /etc/passwd etc/inet/hosts
fi
if [ -f root/.bashrc ]; then
cat > root/.bashrc <<EOF
PS1='\u@\h:\w\\\$ '
EOF
fi
if [ -f root/.profile ]; then
cat > root/.profile <<EOF
#
# Simple profile places /usr/gnu/bin at front,
# adds /usr/sbin and /sbin to the end.
#
export PATH=/usr/gnu/bin:/usr/bin:/usr/sbin:/sbin
export PAGER="more -s"
#
# Define default prompt to <username>@<hostname>:<path><"($|#) "
#
PS1='root@\$(/usr/bin/hostname):\$(
printf "%s" "\${PWD/\${HOME}/~}# ")'
EOF
fi
#
# if there were any services that need to be restarted, create install scripts
#
handle_restarts
#
# build a package
#
cd $BDIR
${PKGMK} -d $DSTDIR/tmp -f prototype -r `pwd` ${OUTPKG} > /dev/null
${PKGTRANS} -s $DSTDIR/tmp ${DSTDIR}/pkgs/${OUTPKG}.pkg ${OUTPKG} > /dev/null
if [ -f ${DSTDIR}/pkgs/${OUTPKG}.pkg ]; then
cd /
bail_out
fi
exit 0