summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>2006-11-01 01:25:51 +0000
committerjulian <julian@FreeBSD.org>2006-11-01 01:25:51 +0000
commitca6370b606d37a5eddc529693cc6bee5ab6ad3c0 (patch)
tree0a6e3e7709312336faa0e54ef721a8fa9d8921f4 /tools
parenta9b80b86aefa567f9b27ba2f48144a1d48646988 (diff)
downloadFreeBSD-src-ca6370b606d37a5eddc529693cc6bee5ab6ad3c0.zip
FreeBSD-src-ca6370b606d37a5eddc529693cc6bee5ab6ad3c0.tar.gz
Reworking of how to add ports.
submitted by: Jean Milanez Melo
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/tinybsd/README8
-rw-r--r--tools/tools/tinybsd/conf/bridge/tinybsd.localfiles6
-rw-r--r--tools/tools/tinybsd/conf/bridge/tinybsd.ports9
-rw-r--r--tools/tools/tinybsd/conf/default/tinybsd.localfiles6
-rw-r--r--tools/tools/tinybsd/conf/default/tinybsd.ports9
-rw-r--r--tools/tools/tinybsd/conf/firewall/tinybsd.localfiles6
-rw-r--r--tools/tools/tinybsd/conf/firewall/tinybsd.ports9
-rw-r--r--tools/tools/tinybsd/conf/minimal/tinybsd.localfiles6
-rw-r--r--tools/tools/tinybsd/conf/minimal/tinybsd.ports9
-rw-r--r--tools/tools/tinybsd/conf/vpn/tinybsd.localfiles6
-rw-r--r--tools/tools/tinybsd/conf/vpn/tinybsd.ports9
-rw-r--r--tools/tools/tinybsd/conf/wireless/tinybsd.localfiles6
-rw-r--r--tools/tools/tinybsd/conf/wireless/tinybsd.ports9
-rw-r--r--tools/tools/tinybsd/conf/wrap/tinybsd.localfiles6
-rw-r--r--tools/tools/tinybsd/conf/wrap/tinybsd.ports9
-rwxr-xr-xtools/tools/tinybsd/tinybsd68
16 files changed, 126 insertions, 55 deletions
diff --git a/tools/tools/tinybsd/README b/tools/tools/tinybsd/README
index df19e52..eec7944 100644
--- a/tools/tools/tinybsd/README
+++ b/tools/tools/tinybsd/README
@@ -69,9 +69,11 @@ 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).
+tinybsd.ports: Here you can add the applications from the FreeBSD Ports Collection
+which you want TinyBSD ports system to install in your embedded system. You whould
+list one application per line, mentioning its category and name, like the examples:
+www/mini_httpd
+net-mgmt/rate
etc/: This is the directory where you can put your custom /etc configuration.
diff --git a/tools/tools/tinybsd/conf/bridge/tinybsd.localfiles b/tools/tools/tinybsd/conf/bridge/tinybsd.localfiles
deleted file mode 100644
index 1ad7bdc..0000000
--- a/tools/tools/tinybsd/conf/bridge/tinybsd.localfiles
+++ /dev/null
@@ -1,6 +0,0 @@
-# $FreeBSD$
-# Add here your third-party applications that are already installed on /usr/local
-# Make sure you have enough space to add it.
-# Example:
-# usr/local/sbin/httpd
-
diff --git a/tools/tools/tinybsd/conf/bridge/tinybsd.ports b/tools/tools/tinybsd/conf/bridge/tinybsd.ports
new file mode 100644
index 0000000..49bb521
--- /dev/null
+++ b/tools/tools/tinybsd/conf/bridge/tinybsd.ports
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# Here you can add the applications from the FreeBSD Ports Collection which you
+# want TinyBSD ports system to install in your embedded system. You whould list
+# one application per line, mentioning its category and name, like the examples:
+#
+# www/mini_httpd
+# net-mgmt/rate
+#
+# Make sure you have enough space to add it.
diff --git a/tools/tools/tinybsd/conf/default/tinybsd.localfiles b/tools/tools/tinybsd/conf/default/tinybsd.localfiles
deleted file mode 100644
index 1ad7bdc..0000000
--- a/tools/tools/tinybsd/conf/default/tinybsd.localfiles
+++ /dev/null
@@ -1,6 +0,0 @@
-# $FreeBSD$
-# Add here your third-party applications that are already installed on /usr/local
-# Make sure you have enough space to add it.
-# Example:
-# usr/local/sbin/httpd
-
diff --git a/tools/tools/tinybsd/conf/default/tinybsd.ports b/tools/tools/tinybsd/conf/default/tinybsd.ports
new file mode 100644
index 0000000..49bb521
--- /dev/null
+++ b/tools/tools/tinybsd/conf/default/tinybsd.ports
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# Here you can add the applications from the FreeBSD Ports Collection which you
+# want TinyBSD ports system to install in your embedded system. You whould list
+# one application per line, mentioning its category and name, like the examples:
+#
+# www/mini_httpd
+# net-mgmt/rate
+#
+# Make sure you have enough space to add it.
diff --git a/tools/tools/tinybsd/conf/firewall/tinybsd.localfiles b/tools/tools/tinybsd/conf/firewall/tinybsd.localfiles
deleted file mode 100644
index 1ad7bdc..0000000
--- a/tools/tools/tinybsd/conf/firewall/tinybsd.localfiles
+++ /dev/null
@@ -1,6 +0,0 @@
-# $FreeBSD$
-# Add here your third-party applications that are already installed on /usr/local
-# Make sure you have enough space to add it.
-# Example:
-# usr/local/sbin/httpd
-
diff --git a/tools/tools/tinybsd/conf/firewall/tinybsd.ports b/tools/tools/tinybsd/conf/firewall/tinybsd.ports
new file mode 100644
index 0000000..49bb521
--- /dev/null
+++ b/tools/tools/tinybsd/conf/firewall/tinybsd.ports
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# Here you can add the applications from the FreeBSD Ports Collection which you
+# want TinyBSD ports system to install in your embedded system. You whould list
+# one application per line, mentioning its category and name, like the examples:
+#
+# www/mini_httpd
+# net-mgmt/rate
+#
+# Make sure you have enough space to add it.
diff --git a/tools/tools/tinybsd/conf/minimal/tinybsd.localfiles b/tools/tools/tinybsd/conf/minimal/tinybsd.localfiles
deleted file mode 100644
index 1ad7bdc..0000000
--- a/tools/tools/tinybsd/conf/minimal/tinybsd.localfiles
+++ /dev/null
@@ -1,6 +0,0 @@
-# $FreeBSD$
-# Add here your third-party applications that are already installed on /usr/local
-# Make sure you have enough space to add it.
-# Example:
-# usr/local/sbin/httpd
-
diff --git a/tools/tools/tinybsd/conf/minimal/tinybsd.ports b/tools/tools/tinybsd/conf/minimal/tinybsd.ports
new file mode 100644
index 0000000..49bb521
--- /dev/null
+++ b/tools/tools/tinybsd/conf/minimal/tinybsd.ports
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# Here you can add the applications from the FreeBSD Ports Collection which you
+# want TinyBSD ports system to install in your embedded system. You whould list
+# one application per line, mentioning its category and name, like the examples:
+#
+# www/mini_httpd
+# net-mgmt/rate
+#
+# Make sure you have enough space to add it.
diff --git a/tools/tools/tinybsd/conf/vpn/tinybsd.localfiles b/tools/tools/tinybsd/conf/vpn/tinybsd.localfiles
deleted file mode 100644
index 1ad7bdc..0000000
--- a/tools/tools/tinybsd/conf/vpn/tinybsd.localfiles
+++ /dev/null
@@ -1,6 +0,0 @@
-# $FreeBSD$
-# Add here your third-party applications that are already installed on /usr/local
-# Make sure you have enough space to add it.
-# Example:
-# usr/local/sbin/httpd
-
diff --git a/tools/tools/tinybsd/conf/vpn/tinybsd.ports b/tools/tools/tinybsd/conf/vpn/tinybsd.ports
new file mode 100644
index 0000000..49bb521
--- /dev/null
+++ b/tools/tools/tinybsd/conf/vpn/tinybsd.ports
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# Here you can add the applications from the FreeBSD Ports Collection which you
+# want TinyBSD ports system to install in your embedded system. You whould list
+# one application per line, mentioning its category and name, like the examples:
+#
+# www/mini_httpd
+# net-mgmt/rate
+#
+# Make sure you have enough space to add it.
diff --git a/tools/tools/tinybsd/conf/wireless/tinybsd.localfiles b/tools/tools/tinybsd/conf/wireless/tinybsd.localfiles
deleted file mode 100644
index 1ad7bdc..0000000
--- a/tools/tools/tinybsd/conf/wireless/tinybsd.localfiles
+++ /dev/null
@@ -1,6 +0,0 @@
-# $FreeBSD$
-# Add here your third-party applications that are already installed on /usr/local
-# Make sure you have enough space to add it.
-# Example:
-# usr/local/sbin/httpd
-
diff --git a/tools/tools/tinybsd/conf/wireless/tinybsd.ports b/tools/tools/tinybsd/conf/wireless/tinybsd.ports
new file mode 100644
index 0000000..49bb521
--- /dev/null
+++ b/tools/tools/tinybsd/conf/wireless/tinybsd.ports
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# Here you can add the applications from the FreeBSD Ports Collection which you
+# want TinyBSD ports system to install in your embedded system. You whould list
+# one application per line, mentioning its category and name, like the examples:
+#
+# www/mini_httpd
+# net-mgmt/rate
+#
+# Make sure you have enough space to add it.
diff --git a/tools/tools/tinybsd/conf/wrap/tinybsd.localfiles b/tools/tools/tinybsd/conf/wrap/tinybsd.localfiles
deleted file mode 100644
index 1ad7bdc..0000000
--- a/tools/tools/tinybsd/conf/wrap/tinybsd.localfiles
+++ /dev/null
@@ -1,6 +0,0 @@
-# $FreeBSD$
-# Add here your third-party applications that are already installed on /usr/local
-# Make sure you have enough space to add it.
-# Example:
-# usr/local/sbin/httpd
-
diff --git a/tools/tools/tinybsd/conf/wrap/tinybsd.ports b/tools/tools/tinybsd/conf/wrap/tinybsd.ports
new file mode 100644
index 0000000..49bb521
--- /dev/null
+++ b/tools/tools/tinybsd/conf/wrap/tinybsd.ports
@@ -0,0 +1,9 @@
+# $FreeBSD$
+# Here you can add the applications from the FreeBSD Ports Collection which you
+# want TinyBSD ports system to install in your embedded system. You whould list
+# one application per line, mentioning its category and name, like the examples:
+#
+# www/mini_httpd
+# net-mgmt/rate
+#
+# Make sure you have enough space to add it.
diff --git a/tools/tools/tinybsd/tinybsd b/tools/tools/tinybsd/tinybsd
index 52a33cb..da953c9 100755
--- a/tools/tools/tinybsd/tinybsd
+++ b/tools/tools/tinybsd/tinybsd
@@ -15,7 +15,10 @@ fi
WORKDIR=/usr/obj/tinybsdbuild
KERNCONF=TINYBSD
BASEFILE="tinybsd.basefiles"
-LOCALFILE="tinybsd.localfiles"
+PORTSFILE="tinybsd.ports"
+PORTSDIR=/usr/ports
+PKGDIRS=/tmp/pkg.dirs
+PKGFILES=/tmp/pkg.files
DEFINSTARGS="-o 0 -g 0 -m 555"
TS="=====>"
@@ -272,13 +275,49 @@ create_tree() {
copy_binaries() {
cd ${CURRENTDIR}/conf/${CONF}
- for file in `cat ${BASEFILE} ${LOCALFILE} | grep -v "#" | \
+ for file in `cat ${BASEFILE} | grep -v "#" | \
cut -f1 -d":" | sort | uniq` ; do
echo "${TS} Copying "/${file}" to "${WORKDIR}/${file}
cp -fp /${file} ${WORKDIR}/${file} ;
done
}
+install_ports() {
+ for portname in `cat ${PORTSFILE} | grep -v '#'` ; do
+ cd ${PORTSDIR}/${portname}
+ pkgname=`make -V PKGNAME`
+ pkg_info -VQ ${pkgname}
+ install=`echo $?`
+ if [ ${install} -eq 0 ] ; then
+ echo "$portname is already installed..."
+ create_missingdir
+ copy_ports
+ else
+ make install clean
+ create_missingdir
+ copy_ports
+ fi
+ done
+}
+
+create_missingdir() {
+pkg_info -L ${pkgname} | egrep -v '(Information|Files|www|share|doc|man|include)' | sort | uniq >> ${PKGDIRS}
+ for dir in `cat ${PKGDIRS}`; do
+ if [ ! -d `dirname ${WORKDIR}/${dir}` ] ; then
+ mkdir -p `dirname ${WORKDIR}/${dir}`
+ fi
+ done
+ rm ${PKGDIRS}
+}
+
+copy_ports() {
+pkg_info -L ${pkgname} | egrep -v '(Information|Files|www|share|doc|man|include)' >> ${PKGFILES}
+ for port in `cat ${PKGFILES}` ; do
+ echo "${TS} Copying "${port}" to "${WORKDIR}${port}
+ cp -fp ${port} ${WORKDIR}${port} ;
+ done
+}
+
make_kernel() {
echo "${TS} Building customized tiny beastie kernel... "
cp -p ${CURRENTDIR}/conf/${CONF}/${KERNCONF} /usr/src/sys/i386/conf
@@ -292,21 +331,21 @@ make_kernel() {
install -o 0 -g 0 -m 444 /sys/i386/conf/GENERIC.hints ${WORKDIR}/boot/device.hints
}
-
copy_libraries() {
-#set -xv
TDEPFILE="`mktemp -t deps`"
TDEPFILES="`mktemp -t depsymlnk`"
cd ${CURRENTDIR}/conf/${CONF}
- for file in `cat ${BASEFILE} ${LOCALFILE} | grep -v "#" | cut -f1 -d":"`; do
+ for file in `cat ${BASEFILE} ${PKGFILES} | grep -v "#" | cut -f1 -d":"`; do
ldd -f "%p\n" /${file} >> ${TDEPFILE} ; # don't worry on progs been "not dynamic"
done
+ rm ${PKGFILES}
+
for libdeplib in `cat ${TDEPFILE} | sort | uniq`; do
ldd -f "%p\n" /${libdeplib} >> ${TDEPFILE} ;
done
-
+
for pamdep in `ls -1 /usr/lib/pam*`; do
echo $pamdep >> ${TDEPFILE} ;
ldd -f "%p\n" /${pamdep} >> ${TDEPFILE} ;
@@ -336,9 +375,16 @@ copy_libraries() {
echo -n "${TS} Unlinking "
rm -fv ${TDEPFILE} ${TDEPFILES}
-#set +xv
}
+deinstall_ports() {
+ for portname in `cat ${PORTSFILE} | grep -v '#'` ; do
+ cd ${PORTSDIR}/${portname}
+ if [ $? -ne ${install} ] ; then
+ make deinstall
+ fi
+ done
+}
create_etc() {
cd /usr/src/etc/sendmail/
@@ -368,13 +414,13 @@ personal_conf() {
}
symlinks() {
-set -xv
- for i in `cat ${BASEFILE} ${LOCALFILE} | grep -v "#" | grep ":"`; do
+#set -xv
+ for i in `cat ${BASEFILE} ${PORTSFILE} | 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
}
@@ -467,9 +513,11 @@ rotate_buidlog
check_alt_imgname
create_tree
copy_binaries
+ install_ports
make_kernel
copy_libraries
symlinks
+ deinstall_ports
create_etc
create_ssh_keys
personal_conf
OpenPOWER on IntegriCloud