summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2006-10-30 19:47:05 +0000
committerjulian <julian@FreeBSD.org>2006-10-30 19:47:05 +0000
commit75e5d4bb248c0ac24e1c7e325a8e302ada5f4e1f (patch)
tree435127b39042c7400680d8b9871b5292996a4b41 /tools
parent4bea281f9ade627bae92397e800c3f3b5a307283 (diff)
downloadFreeBSD-src-75e5d4bb248c0ac24e1c7e325a8e302ada5f4e1f.zip
FreeBSD-src-75e5d4bb248c0ac24e1c7e325a8e302ada5f4e1f.tar.gz
Add some code to support including files ffrom packages in the image.
Submitted by: Jeremie Le Hen and tested by Jean Milanez Melo.
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/tinybsd/README4
-rwxr-xr-xtools/tools/tinybsd/tinybsd42
2 files changed, 31 insertions, 15 deletions
diff --git a/tools/tools/tinybsd/README b/tools/tools/tinybsd/README
index a49316d..df19e52 100644
--- a/tools/tools/tinybsd/README
+++ b/tools/tools/tinybsd/README
@@ -69,6 +69,10 @@ usr/sbin/pw
usr/sbin/pwd_mkdb
usr/sbin/setkey
+tinybsd.localfiles: Similar to tinybsd.basefiles but for /usr/local/. The
+difference is that directories will have to be created by TinyBSD because
+they are not handle by mtree(1).
+
etc/: This is the directory where you can put your custom /etc configuration.
# ls /usr/src/tools/tools/tinybsd/tinybsd
diff --git a/tools/tools/tinybsd/tinybsd b/tools/tools/tinybsd/tinybsd
index 10660a7..52a33cb 100755
--- a/tools/tools/tinybsd/tinybsd
+++ b/tools/tools/tinybsd/tinybsd
@@ -14,6 +14,8 @@ else
fi
WORKDIR=/usr/obj/tinybsdbuild
KERNCONF=TINYBSD
+BASEFILE="tinybsd.basefiles"
+LOCALFILE="tinybsd.localfiles"
DEFINSTARGS="-o 0 -g 0 -m 555"
TS="=====>"
@@ -239,6 +241,10 @@ check_alt_imgname() {
fi
}
+rotate_buidlog() {
+ mv -f ${HOME}/tinybsd.log ${HOME}/tinybsd.log.old
+}
+
remove_workdir() {
chflags -R noschg ${WORKDIR}
echo "${TS} Removing "${WORKDIR}
@@ -250,7 +256,7 @@ remove_workdir() {
prework() {
- remove_workdir
+ remove_workdir
mkdir -p ${WORKDIR}
}
@@ -259,18 +265,18 @@ create_tree() {
echo "${TS} Creating directory hierarchy... "
mtree -deU -f /etc/mtree/BSD.root.dist -p ${WORKDIR}
mtree -deU -f /etc/mtree/BSD.usr.dist -p ${WORKDIR}/usr
+ mtree -deU -f /etc/mtree/BSD.local.dist -p ${WORKDIR}/usr/local
mtree -deU -f /etc/mtree/BSD.var.dist -p ${WORKDIR}/var
}
-
copy_binaries() {
-#set -xv
- for file in `cat ${CURRENTDIR}/conf/${CONF}/tinybsd.basefiles | grep -v "#" | \
+ cd ${CURRENTDIR}/conf/${CONF}
+
+ for file in `cat ${BASEFILE} ${LOCALFILE} | grep -v "#" | \
cut -f1 -d":" | sort | uniq` ; do
echo "${TS} Copying "/${file}" to "${WORKDIR}/${file}
cp -fp /${file} ${WORKDIR}/${file} ;
done
-#set +xv
}
make_kernel() {
@@ -293,7 +299,7 @@ copy_libraries() {
TDEPFILES="`mktemp -t depsymlnk`"
cd ${CURRENTDIR}/conf/${CONF}
- for file in `cat tinybsd.basefiles | grep -v "#" | cut -f1 -d":"`; do
+ for file in `cat ${BASEFILE} ${LOCALFILE} | grep -v "#" | cut -f1 -d":"`; do
ldd -f "%p\n" /${file} >> ${TDEPFILE} ; # don't worry on progs been "not dynamic"
done
@@ -305,7 +311,7 @@ copy_libraries() {
echo $pamdep >> ${TDEPFILE} ;
ldd -f "%p\n" /${pamdep} >> ${TDEPFILE} ;
done
-
+
for lib in `cat ${TDEPFILE} | sort | uniq`; do
echo "${TS} Copying "${lib}" to "${WORKDIR}${lib}
cp -fp ${lib} ${WORKDIR}${lib} ;
@@ -321,6 +327,7 @@ copy_libraries() {
TARGET_FILE=`echo $i | awk -F ":" '{print $2}'`
echo "${TS} Unlinking ${WORKDIR}${TARGET_FILE}"
+ chroot ${WORKDIR} /bin/chflags 0 ${TARGET_FILE}
chroot ${WORKDIR} /bin/rm -f ${TARGET_FILE}
echo "${TS} Symlinking ${SOURCE_FILE} to ${TARGET_FILE}"
@@ -349,27 +356,29 @@ create_ssh_keys() {
ssh-keygen -t rsa -f ${WORKDIR}/etc/ssh/ssh_host_rsa_key -N ''
}
-personal_directories() {
+personal_conf() {
echo "${TS} Copying your custom configuration on conf/ ..."
- for custom in `find ${CURRENTDIR}/conf/${CONF}/ -type d -depth 1`; do
+ for custom in `find ${CURRENTDIR}/conf/${CONF}/ -type d -depth 1 \! -name CVS`; do
cp -Rp ${custom}/* ${WORKDIR}/${custom#${CURRENTDIR}/conf/${CONF}/}/
done
+
+ if [ -f ${CURRENTDIR}/conf/${CONF}/boot.config ]; then
+ cp ${CURRENTDIR}/conf/${CONF}/boot.config ${WORKDIR}/boot.config
+ fi
}
symlinks() {
-#set -xv
- for i in `cat tinybsd.basefiles | grep -v "#" | grep ":"`; do
+set -xv
+ for i in `cat ${BASEFILE} ${LOCALFILE} | grep -v "#" | grep ":"`; do
SOURCE_FILE=`echo $i | awk -F ":" {'print $1'}`
TARGET_FILE=`echo $i | awk -F ":" {'print $2'}`
chroot ${WORKDIR} /bin/ln -vs /${SOURCE_FILE} ${TARGET_FILE}
done
-#set +xv
+set +xv
}
create_image() {
- #set -ex
-
VNODEFILE=`mktemp -t tinybsd`
IMGMNT=`mktemp -d -t tinybsd`
@@ -448,6 +457,9 @@ setdefaults
loadconfig
saveconfig
+# Rotate build log
+rotate_buidlog
+
# Now start logging.
(
# Do the build
@@ -460,7 +472,7 @@ saveconfig
symlinks
create_etc
create_ssh_keys
- personal_directories
+ personal_conf
create_image
#set +xv
) 2>&1 |tee -a ${HOME}/tinybsd.log
OpenPOWER on IntegriCloud