[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit
Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/app/busybox/src/examples/android-build b/ap/app/busybox/src/examples/android-build
new file mode 100755
index 0000000..89f3b63
--- /dev/null
+++ b/ap/app/busybox/src/examples/android-build
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Build Busybox against Android's bionic
+# Originally by Dan Fandrich
+#
+# Configure with "make android_defconfig"
+#
+# This file has been tested on Android Froyo (the lack of ttyname_r in
+# the android libc must be patched around) and Gingerbread.
+
+# Point this to the Android root directory; it's used in the defconfig CFLAGS
+export A="$HOME/android"
+
+# Android product being built
+P=zoom2
+
+# Toolchain version in use by this version of Android
+GCCVER=4.4.3
+
+export PATH="$A/prebuilt/linux-x86/toolchain/arm-eabi-$GCCVER/bin:$PATH"
+
+# Set the linker flags; compiler flags are in the defconfig file
+if grep "^CONFIG_STATIC=y" .config >/dev/null ; then
+ # Static linking
+ LDFLAGS="-static -Xlinker -z -Xlinker muldefs -nostdlib $A/out/target/product/$P/obj/lib/crtbegin_static.o $A/out/target/product/$P/obj/lib/crtend_android.o -L$A/out/target/product/$P/obj/lib -L$A/out/target/product/$P/obj/STATIC_LIBRARIES/libm_intermediates -L$A/out/target/product/$P/obj/STATIC_LIBRARIES/libc_intermediates"
+ LDLIBS="m c gcc"
+else
+ # Dynamic linking
+ LDFLAGS="-Xlinker -z -Xlinker muldefs -nostdlib -Bdynamic -Xlinker -T$A/build/core/armelf.x -Xlinker -dynamic-linker -Xlinker /system/bin/linker -Xlinker -z -Xlinker nocopyreloc -Xlinker --no-undefined $A/out/target/product/$P/obj/lib/crtbegin_dynamic.o $A/out/target/product/$P/obj/lib/crtend_android.o -L$A/out/target/product/$P/obj/lib"
+ LDLIBS="dl m c gcc"
+fi
+
+make EXTRA_LDFLAGS="$LDFLAGS" LDLIBS="$LDLIBS" "$@"
diff --git a/ap/app/busybox/src/examples/bootfloppy/bootfloppy.txt b/ap/app/busybox/src/examples/bootfloppy/bootfloppy.txt
new file mode 100644
index 0000000..9e2cbe2
--- /dev/null
+++ b/ap/app/busybox/src/examples/bootfloppy/bootfloppy.txt
@@ -0,0 +1,180 @@
+Building a Busybox Boot Floppy
+==============================
+
+This document describes how to buid a boot floppy using the following
+components:
+
+ - Linux Kernel (http://www.kernel.org)
+ - uClibc: C library (http://www.uclibc.org/)
+ - Busybox: Unix utilities (http://busybox.net/)
+ - Syslinux: bootloader (http://syslinux.zytor.com)
+
+It is based heavily on a paper presented by Erik Andersen at the 2001 Embedded
+Systems Conference.
+
+
+
+Building The Software Components
+--------------------------------
+
+Detailed instructions on how to build Busybox, uClibc, or a working Linux
+kernel are beyond the scope of this document. The following guidelines will
+help though:
+
+ - Stock Busybox from CVS or a tarball will work with no modifications to
+ any files. Just extract and go.
+ - Ditto uClibc.
+ - Your Linux kernel must include support for initrd or else the floppy
+ won't be able to mount it's root file system.
+
+If you require further information on building Busybox uClibc or Linux, please
+refer to the web pages and documentation for those individual programs.
+
+
+
+Making a Root File System
+-------------------------
+
+The following steps will create a root file system.
+
+ - Create an empty file that you can format as a filesystem:
+
+ dd if=/dev/zero of=rootfs bs=1k count=4000
+
+ - Set up the rootfs file we just created to be used as a loop device (may not
+ be necessary)
+
+ losetup /dev/loop0 rootfs
+
+ - Format the rootfs file with a filesystem:
+
+ mkfs.ext2 -F -i 2000 rootfs
+
+ - Mount the file on a mountpoint so we can place files in it:
+
+ mkdir loop
+ mount -o loop rootfs loop/
+
+ (you will probably need to be root to do this)
+
+ - Copy on the C library, the dynamic linking library, and other necessary
+ libraries. For this example, we copy the following files from the uClibc
+ tree:
+
+ mkdir loop/lib
+ (chdir to uClibc directory)
+ cp -a libc.so* uClibc*.so \
+ ld.so-1/d-link/ld-linux-uclibc.so* \
+ ld.so-1/libdl/libdl.so* \
+ crypt/libcrypt.so* \
+ (path to)loop/lib
+
+ - Install the Busybox binary and accompanying symlinks:
+
+ (chdir to busybox directory)
+ make CONFIG_PREFIX=(path to)loop/ install
+
+ - Make device files in /dev:
+
+ This can be done by running the 'mkdevs.sh' script. If you want the gory
+ details, you can read the script.
+
+ - Make necessary files in /etc:
+
+ For this, just cp -a the etc/ directory onto rootfs. Again, if you want
+ all the details, you can just look at the files in the dir.
+
+ - Unmount the rootfs from the mountpoint:
+
+ umount loop
+
+ - Compress it:
+
+ gzip -9 rootfs
+
+
+Making a SYSLINUX boot floppy
+-----------------------------
+
+The following steps will create the boot floppy.
+
+Note: You will need to have the mtools package installed beforehand.
+
+ - Insert a floppy in the drive and format it with an MSDOS filesystem:
+
+ mformat a:
+
+ (if the system doesn't know what device 'a:' is, look at /etc/mtools.conf)
+
+ - Run syslinux on the floppy:
+
+ syslinux -s /dev/fd0
+
+ (the -s stands for "safe, slow, and stupid" and should work better with
+ buggy BIOSes; it can be omitted)
+
+ - Put on a syslinux.cfg file:
+
+ mcopy syslinux.cfg a:
+
+ (more on syslinux.cfg below)
+
+ - Copy the root file system you made onto the MSDOS formatted floppy
+
+ mcopy rootfs.gz a:
+
+ - Build a linux kernel and copy it onto the disk with the filename 'linux'
+
+ mcopy bzImage a:linux
+
+
+Sample syslinux.cfg
+~~~~~~~~~~~~~~~~~~~
+
+The following simple syslinux.cfg file should work. You can tweak it if you
+like.
+
+----begin-syslinux.cfg---------------
+DEFAULT linux
+APPEND initrd=rootfs.gz root=/dev/ram0
+TIMEOUT 10
+PROMPT 1
+----end-syslinux.cfg---------------
+
+Some changes you could make to syslinux.cfg:
+
+ - This value is the number seconds it will wait before booting. You can set
+ the timeout to 0 (or omit) to boot instantly, or you can set it as high as
+ 10 to wait awhile.
+
+ - PROMPT can be set to 0 to disable the 'boot:' prompt.
+
+ - you can add this line to display the contents of a file as a welcome
+ message:
+
+ DISPLAY display.txt
+
+
+
+Additional Resources
+--------------------
+
+Other useful information on making a Linux bootfloppy is available at the
+following URLs:
+
+http://www.linuxdoc.org/HOWTO/Bootdisk-HOWTO/index.html
+http://www.linux-embedded.com/howto/Embedded-Linux-Howto.html
+http://linux-embedded.org/howto/LFS-HOWTO.html
+http://linux-embedded.org/pmhowto.html
+http://recycle.lbl.gov/~ldoolitt/embedded/ (Larry Doolittle's stuff)
+
+
+
+Possible TODOs
+--------------
+
+The following features that we might want to add later:
+
+ - support for additional filesystems besides ext2, i.e. minix
+ - different libc, static vs dynamic loading
+ - maybe using an alternate bootloader
diff --git a/ap/app/busybox/src/examples/bootfloppy/display.txt b/ap/app/busybox/src/examples/bootfloppy/display.txt
new file mode 100644
index 0000000..7cae48b
--- /dev/null
+++ b/ap/app/busybox/src/examples/bootfloppy/display.txt
@@ -0,0 +1,3 @@
+
+This boot floppy is made with Busybox, uClibc, and the Linux kernel.
+Hit RETURN to boot or enter boot parameters at the prompt below.
diff --git a/ap/app/busybox/src/examples/bootfloppy/etc/fstab b/ap/app/busybox/src/examples/bootfloppy/etc/fstab
new file mode 100644
index 0000000..b31f602
--- /dev/null
+++ b/ap/app/busybox/src/examples/bootfloppy/etc/fstab
@@ -0,0 +1 @@
+proc /proc proc defaults 0 0
diff --git a/ap/app/busybox/src/examples/bootfloppy/etc/init.d/rcS b/ap/app/busybox/src/examples/bootfloppy/etc/init.d/rcS
new file mode 100755
index 0000000..4f29b92
--- /dev/null
+++ b/ap/app/busybox/src/examples/bootfloppy/etc/init.d/rcS
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+/bin/mount -a
diff --git a/ap/app/busybox/src/examples/bootfloppy/etc/inittab b/ap/app/busybox/src/examples/bootfloppy/etc/inittab
new file mode 100644
index 0000000..1ac9f68
--- /dev/null
+++ b/ap/app/busybox/src/examples/bootfloppy/etc/inittab
@@ -0,0 +1,4 @@
+::sysinit:/etc/init.d/rcS
+::respawn:-/bin/sh
+tty2::askfirst:-/bin/sh
+::ctrlaltdel:/bin/umount -a -r
diff --git a/ap/app/busybox/src/examples/bootfloppy/etc/profile b/ap/app/busybox/src/examples/bootfloppy/etc/profile
new file mode 100644
index 0000000..cf68d33
--- /dev/null
+++ b/ap/app/busybox/src/examples/bootfloppy/etc/profile
@@ -0,0 +1,7 @@
+# /etc/profile: system-wide .profile file for the Bourne shells
+
+echo
+echo -n "Processing /etc/profile... "
+# no-op
+echo "Done"
+echo
diff --git a/ap/app/busybox/src/examples/bootfloppy/mkdevs.sh b/ap/app/busybox/src/examples/bootfloppy/mkdevs.sh
new file mode 100755
index 0000000..8e9512f
--- /dev/null
+++ b/ap/app/busybox/src/examples/bootfloppy/mkdevs.sh
@@ -0,0 +1,62 @@
+#!/bin/sh
+#
+# makedev.sh - creates device files for a busybox boot floppy image
+
+
+# we do our work in the dev/ directory
+if [ -z "$1" ]; then
+ echo "usage: `basename $0` path/to/dev/dir"
+ exit 1
+fi
+
+cd $1
+
+
+# miscellaneous one-of-a-kind stuff
+mknod console c 5 1
+mknod full c 1 7
+mknod kmem c 1 2
+mknod mem c 1 1
+mknod null c 1 3
+mknod port c 1 4
+mknod random c 1 8
+mknod urandom c 1 9
+mknod zero c 1 5
+ln -s /proc/kcore core
+
+# IDE HD devs
+# note: not going to bother creating all concievable partitions; you can do
+# that yourself as you need 'em.
+mknod hda b 3 0
+mknod hdb b 3 64
+mknod hdc b 22 0
+mknod hdd b 22 64
+
+# loop devs
+for i in `seq 0 7`; do
+ mknod loop$i b 7 $i
+done
+
+# ram devs
+for i in `seq 0 9`; do
+ mknod ram$i b 1 $i
+done
+ln -s ram1 ram
+
+# ttys
+mknod tty c 5 0
+for i in `seq 0 9`; do
+ mknod tty$i c 4 $i
+done
+
+# virtual console screen devs
+for i in `seq 0 9`; do
+ mknod vcs$i b 7 $i
+done
+ln -s vcs0 vcs
+
+# virtual console screen w/ attributes devs
+for i in `seq 0 9`; do
+ mknod vcsa$i b 7 $((128 + i))
+done
+ln -s vcsa0 vcsa
diff --git a/ap/app/busybox/src/examples/bootfloppy/mkrootfs.sh b/ap/app/busybox/src/examples/bootfloppy/mkrootfs.sh
new file mode 100755
index 0000000..a7fc48b
--- /dev/null
+++ b/ap/app/busybox/src/examples/bootfloppy/mkrootfs.sh
@@ -0,0 +1,104 @@
+#!/bin/bash
+#
+# mkrootfs.sh - creates a root file system
+#
+
+# TODO: need to add checks here to verify that busybox, uClibc and bzImage
+# exist
+
+
+# command-line settable variables
+BUSYBOX_DIR=..
+UCLIBC_DIR=../../uClibc
+TARGET_DIR=./loop
+FSSIZE=4000
+CLEANUP=1
+MKFS='mkfs.ext2 -F'
+
+# don't-touch variables
+BASE_DIR=`pwd`
+
+
+while getopts 'b:u:s:t:Cm' opt
+do
+ case $opt in
+ b) BUSYBOX_DIR=$OPTARG ;;
+ u) UCLIBC_DIR=$OPTARG ;;
+ t) TARGET_DIR=$OPTARG ;;
+ s) FSSIZE=$OPTARG ;;
+ C) CLEANUP=0 ;;
+ m) MKFS='mkfs.minix' ;;
+ *)
+ echo "usage: `basename $0` [-bu]"
+ echo " -b DIR path to busybox direcory (default ..)"
+ echo " -u DIR path to uClibc direcory (default ../../uClibc)"
+ echo " -t DIR path to target direcory (default ./loop)"
+ echo " -s SIZE size of root filesystem in Kbytes (default 4000)"
+ echo " -C don't perform cleanup (umount target dir, gzip rootfs, etc.)"
+ echo " (this allows you to 'chroot loop/ /bin/sh' to test it)"
+ echo " -m use minix filesystem (default is ext2)"
+ exit 1
+ ;;
+ esac
+done
+
+
+
+
+# clean up from any previous work
+mount | grep -q loop
+[ $? -eq 0 ] && umount $TARGET_DIR
+[ -d $TARGET_DIR ] && rm -rf $TARGET_DIR/
+[ -f rootfs ] && rm -f rootfs
+[ -f rootfs.gz ] && rm -f rootfs.gz
+
+
+# prepare root file system and mount as loopback
+dd if=/dev/zero of=rootfs bs=1k count=$FSSIZE
+$MKFS -i 2000 rootfs
+mkdir $TARGET_DIR
+mount -o loop,exec rootfs $TARGET_DIR # must be root
+
+
+# install uClibc
+mkdir -p $TARGET_DIR/lib
+cd $UCLIBC_DIR
+make INSTALL_DIR=
+cp -a libc.so* $BASE_DIR/$TARGET_DIR/lib
+cp -a uClibc*.so $BASE_DIR/$TARGET_DIR/lib
+cp -a ld.so-1/d-link/ld-linux-uclibc.so* $BASE_DIR/$TARGET_DIR/lib
+cp -a ld.so-1/libdl/libdl.so* $BASE_DIR/$TARGET_DIR/lib
+cp -a crypt/libcrypt.so* $BASE_DIR/$TARGET_DIR/lib
+cd $BASE_DIR
+
+
+# install busybox and components
+cd $BUSYBOX_DIR
+make distclean
+make CC=$BASE_DIR/$UCLIBC_DIR/extra/gcc-uClibc/i386-uclibc-gcc
+make CONFIG_PREFIX=$BASE_DIR/$TARGET_DIR install
+cd $BASE_DIR
+
+
+# make files in /dev
+mkdir $TARGET_DIR/dev
+./mkdevs.sh $TARGET_DIR/dev
+
+
+# make files in /etc
+cp -a etc $TARGET_DIR
+ln -s /proc/mounts $TARGET_DIR/etc/mtab
+
+
+# other miscellaneous setup
+mkdir $TARGET_DIR/initrd
+mkdir $TARGET_DIR/proc
+
+
+# Done. Maybe do cleanup.
+if [ $CLEANUP -eq 1 ]
+then
+ umount $TARGET_DIR
+ rmdir $TARGET_DIR
+ gzip -9 rootfs
+fi
diff --git a/ap/app/busybox/src/examples/bootfloppy/mksyslinux.sh b/ap/app/busybox/src/examples/bootfloppy/mksyslinux.sh
new file mode 100755
index 0000000..e254173
--- /dev/null
+++ b/ap/app/busybox/src/examples/bootfloppy/mksyslinux.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+#
+# Formats a floppy to use Syslinux
+
+dummy=""
+
+
+# need to have mtools installed
+if [ -z `which mformat` -o -z `which mcopy` ]; then
+ echo "You must have the mtools package installed to run this script"
+ exit 1
+fi
+
+
+# need an arg for the location of the kernel
+if [ -z "$1" ]; then
+ echo "usage: `basename $0` path/to/linux/kernel"
+ exit 1
+fi
+
+
+# need to have a root file system built
+if [ ! -f rootfs.gz ]; then
+ echo "You need to have a rootfs built first."
+ echo "Hit RETURN to make one now or Control-C to quit."
+ read dummy
+ ./mkrootfs.sh
+fi
+
+
+# prepare the floppy
+echo "Please insert a blank floppy in the drive and press RETURN to format"
+echo "(WARNING: All data will be erased! Hit Control-C to abort)"
+read dummy
+
+echo "Formatting the floppy..."
+mformat a:
+echo "Making it bootable with Syslinux..."
+syslinux -s /dev/fd0
+echo "Copying Syslinux configuration files..."
+mcopy syslinux.cfg display.txt a:
+echo "Copying root filesystem file..."
+mcopy rootfs.gz a:
+# XXX: maybe check for "no space on device" errors here
+echo "Copying linux kernel..."
+mcopy $1 a:linux
+# XXX: maybe check for "no space on device" errors here too
+echo "Finished: boot floppy created"
diff --git a/ap/app/busybox/src/examples/bootfloppy/quickstart.txt b/ap/app/busybox/src/examples/bootfloppy/quickstart.txt
new file mode 100644
index 0000000..0d80908
--- /dev/null
+++ b/ap/app/busybox/src/examples/bootfloppy/quickstart.txt
@@ -0,0 +1,15 @@
+Quickstart on making the Busybox boot-floppy:
+
+ 1) Download Busybox and uClibc from CVS or tarballs. Make sure they share a
+ common parent directory. (i.e. busybox/ and uclibc/ are both right off of
+ /tmp, or wherever.)
+
+ 2) Build a Linux kernel. Make sure you include support for initrd.
+
+ 3) Put a floppy in the drive. Make sure it is a floppy you don't care about
+ because the contents will be overwritten.
+
+ 4) As root, type ./mksyslinux.sh path/to/linux/kernel from this directory.
+ Wait patiently while the magic happens.
+
+ 5) Boot up on the floppy.
diff --git a/ap/app/busybox/src/examples/bootfloppy/syslinux.cfg b/ap/app/busybox/src/examples/bootfloppy/syslinux.cfg
new file mode 100644
index 0000000..fa2677c
--- /dev/null
+++ b/ap/app/busybox/src/examples/bootfloppy/syslinux.cfg
@@ -0,0 +1,7 @@
+display display.txt
+default linux
+timeout 10
+prompt 1
+label linux
+ kernel linux
+ append initrd=rootfs.gz root=/dev/ram0
diff --git a/ap/app/busybox/src/examples/busybox.spec b/ap/app/busybox/src/examples/busybox.spec
new file mode 100644
index 0000000..27d0051
--- /dev/null
+++ b/ap/app/busybox/src/examples/busybox.spec
@@ -0,0 +1,120 @@
+Summary: Statically linked binary providing simplified versions of system commands
+Name: busybox
+Version: 1.15.1
+Release: 1%{?dist}
+Epoch: 1
+License: GPLv2
+Group: System Environment/Shells
+Source: http://www.busybox.net/downloads/%{name}-%{version}.tar.bz2
+Source1: busybox-static.config
+Source2: busybox-petitboot.config
+Source3: http://www.uclibc.org/downloads/uClibc-0.9.30.1.tar.bz2
+Source4: uClibc.config
+Patch16: busybox-1.10.1-hwclock.patch
+# patch to avoid conflicts with getline() from stdio.h, already present in upstream VCS
+Patch22: uClibc-0.9.30.1-getline.patch
+Obsoletes: busybox-anaconda
+URL: http://www.busybox.net
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildRequires: libselinux-devel >= 1.27.7-2
+BuildRequires: libsepol-devel
+BuildRequires: libselinux-static
+BuildRequires: libsepol-static
+BuildRequires: glibc-static
+
+%define debug_package %{nil}
+
+%package petitboot
+Group: System Environment/Shells
+Summary: Version of busybox configured for use with petitboot
+
+%description
+Busybox is a single binary which includes versions of a large number
+of system commands, including a shell. This package can be very
+useful for recovering from certain types of system failures,
+particularly those involving broken shared libraries.
+
+%description petitboot
+Busybox is a single binary which includes versions of a large number
+of system commands, including a shell. The version contained in this
+package is a minimal configuration intended for use with the Petitboot
+bootloader used on PlayStation 3. The busybox package provides a binary
+better suited to normal use.
+
+%prep
+%setup -q -a3
+%patch16 -b .ia64 -p1
+cat %{SOURCE4} >uClibc-0.9.30.1/.config1
+%patch22 -b .getline -p1
+
+%build
+# create static busybox - the executable is kept as busybox-static
+# We use uclibc instead of system glibc, uclibc is several times
+# smaller, this is important for static build.
+# Build uclibc first.
+cd uClibc-0.9.30.1
+# fixme:
+mkdir kernel-include
+cp -a /usr/include/asm kernel-include
+cp -a /usr/include/asm-generic kernel-include
+cp -a /usr/include/linux kernel-include
+# uclibc can't be built on ppc64,s390,ia64, we set $arch to "" in this case
+arch=`uname -m | sed -e 's/i.86/i386/' -e 's/ppc/powerpc/' -e 's/ppc64//' -e 's/powerpc64//' -e 's/ia64//' -e 's/s390.*//'`
+echo "TARGET_$arch=y" >.config
+echo "TARGET_ARCH=\"$arch\"" >>.config
+cat .config1 >>.config
+if test "$arch"; then yes "" | make oldconfig; fi
+if test "$arch"; then cat .config; fi
+if test "$arch"; then make V=1; fi
+if test "$arch"; then make install; fi
+if test "$arch"; then make install_kernel_headers; fi
+cd ..
+# we are back in busybox-NN.MM dir now
+cp %{SOURCE1} .config
+# set all new options to defaults
+yes "" | make oldconfig
+# gcc needs to be convinced to use neither system headers, nor libs,
+# nor startfiles (i.e. crtXXX.o files)
+if test "$arch"; then \
+ mv .config .config1 && \
+ grep -v ^CONFIG_SELINUX .config1 >.config && \
+ yes "" | make oldconfig && \
+ cat .config && \
+ make V=1 \
+ EXTRA_CFLAGS="-isystem uClibc-0.9.30.1/installed/include" \
+ CFLAGS_busybox="-static -nostartfiles -LuClibc-0.9.30.1/installed/lib uClibc-0.9.30.1/installed/lib/crt1.o uClibc-0.9.30.1/installed/lib/crti.o uClibc-0.9.30.1/installed/lib/crtn.o"; \
+else \
+ cat .config && \
+ make V=1 CC="gcc $RPM_OPT_FLAGS"; \
+fi
+cp busybox busybox.static
+
+# create busybox optimized for petitboot
+make clean
+# copy new configuration file
+cp %{SOURCE2} .config
+# set all new options to defaults
+yes "" | make oldconfig
+make V=1 CC="%__cc $RPM_OPT_FLAGS"
+cp busybox busybox.petitboot
+
+%install
+rm -rf $RPM_BUILD_ROOT
+mkdir -p $RPM_BUILD_ROOT/sbin
+install -m 755 busybox.static $RPM_BUILD_ROOT/sbin/busybox
+install -m 755 busybox.petitboot $RPM_BUILD_ROOT/sbin/busybox.petitboot
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root,-)
+%doc LICENSE docs/busybox.net/*.html
+/sbin/busybox
+
+%files petitboot
+%defattr(-,root,root,-)
+%doc LICENSE
+/sbin/busybox.petitboot
+
+%changelog
diff --git a/ap/app/busybox/src/examples/depmod b/ap/app/busybox/src/examples/depmod
new file mode 100755
index 0000000..d769590
--- /dev/null
+++ b/ap/app/busybox/src/examples/depmod
@@ -0,0 +1,57 @@
+#!/bin/sh
+#
+# Simple depmod, use to generate modprobe.conf
+#
+# Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com>
+#
+# Licensed under GPLv2, see file LICENSE in this source tree.
+#
+
+local BASE="${1:-/usr/lib/modules}"
+
+find "$BASE" -name '*.ko.gz' | while read I ; do
+ N=`basename "$I" '.ko.gz'`
+ echo -n "@$N"
+ zcat "$I" | strings | grep '^depends=' | sed -e 's/^depends=$//' -e 's/^depends=/,/' -e 's/,/ @/g'
+done | awk '
+{
+ # modules which has no dependencies are resolved
+ if ( NF == 1 ) { res[$1] = ""; next }
+ # others have to be resolved based on those which already resolved
+ i = $1; $1 = ""; deps[i] = $0; ++ndeps
+}
+END {
+ # resolve implicit dependencies
+ while ( ndeps ) for (mod in deps) {
+ if ( index(deps[mod], "@") > 0 ) {
+ $0 = deps[mod]
+ for ( i=1; i<=NF; ++i ) {
+ if ( substr($i,1,1) == "@" ) {
+ if ( $i in res ) {
+ $i = res[$i] " " substr($i,2)
+ }
+ }
+ }
+ deps[mod] = $0
+ } else {
+ res[mod] = deps[mod]
+ delete deps[mod]
+ --ndeps
+ }
+ }
+
+ # output dependencies in modules.dep format
+ for ( mod in res ) {
+ $0 = res[mod]
+ s = ""
+ delete a
+ for ( i=1; i<=NF; ++i ) {
+ if ( ! ($i in a) ) {
+ a[$i] = $i
+ s = " ," $i s
+ }
+ }
+ print "," substr(mod,2) ":" s
+ }
+}
+' | sort | sed -r -e "s!,([^,: ]*)!/usr/lib/modules/\\1.ko.gz!g"
diff --git a/ap/app/busybox/src/examples/depmod.pl b/ap/app/busybox/src/examples/depmod.pl
new file mode 100755
index 0000000..809dc08
--- /dev/null
+++ b/ap/app/busybox/src/examples/depmod.pl
@@ -0,0 +1,353 @@
+#!/usr/bin/perl -w
+# vi: set sw=4 ts=4:
+# Copyright (c) 2001 David Schleef <ds@schleef.org>
+# Copyright (c) 2001 Erik Andersen <andersen@codepoet.org>
+# Copyright (c) 2001 Stuart Hughes <seh@zee2.com>
+# Copyright (c) 2002 Steven J. Hill <shill@broadcom.com>
+# Copyright (c) 2006 Freescale Semiconductor, Inc <stuarth@freescale.com>
+#
+# History:
+# March 2006: Stuart Hughes <stuarth@freescale.com>.
+# Significant updates, including implementing the '-F' option
+# and adding support for 2.6 kernels.
+
+# This program is free software; you can redistribute it and/or modify it
+# under the same terms as Perl itself.
+use Getopt::Long qw(:config no_auto_abbrev no_ignore_case);
+use File::Find;
+use strict;
+
+# Set up some default values
+my $kdir="";
+my $basedir="";
+my $kernel="";
+my $kernelsyms="";
+my $symprefix="";
+my $all=0;
+my $quick=0;
+my $errsyms=0;
+my $stdout=0;
+my $verbose=0;
+my $help=0;
+my $nm = $ENV{'NM'} || "nm";
+
+# more globals
+my (@liblist) = ();
+my $exp = {};
+my $dep = {};
+my $mod = {};
+
+my $usage = <<TXT;
+$0 -b basedir { -k <vmlinux> | -F <System.map> } [options]...
+ Where:
+ -h --help : Show this help screen
+ -b --basedir : Modules base directory (e.g /lib/modules/<2.x.y>)
+ -k --kernel : Kernel binary for the target (e.g. vmlinux)
+ -F --kernelsyms : Kernel symbol file (e.g. System.map)
+ -n --stdout : Write to stdout instead of <basedir>/modules.dep
+ -v --verbose : Print out lots of debugging stuff
+ -P --symbol-prefix : Symbol prefix
+ -a --all : Probe all modules (default/only thing supported)
+ -e --errsyms : Report any symbols not supplied by modules/kernel
+TXT
+
+# get command-line options
+GetOptions(
+ "help|h" => \$help,
+ "basedir|b=s" => \$basedir,
+ "kernel|k=s" => \$kernel,
+ "kernelsyms|F=s" => \$kernelsyms,
+ "stdout|n" => \$stdout,
+ "verbose|v" => \$verbose,
+ "symbol-prefix|P=s" => \$symprefix,
+ "all|a" => \$all,
+ # unsupported options
+ "quick|A" => \$quick,
+ # ignored options (for historical usage)
+ "quiet|q",
+ "root|r",
+ "unresolved-error|u"
+);
+
+die $usage if $help;
+die $usage unless $basedir && ( $kernel || $kernelsyms );
+die "can't use both -k and -F\n\n$usage" if $kernel && $kernelsyms;
+die "sorry, -A/--quick is not supported" if $quick;
+die "--errsyms requires --kernelsyms" if $errsyms && !$kernelsyms;
+
+# Strip any trailing or multiple slashes from basedir
+$basedir =~ s-/+$--g;
+
+# The base directory should contain /lib/modules somewhere
+if($basedir !~ m-/lib/modules-) {
+ warn "WARNING: base directory does not match ..../lib/modules\n";
+}
+
+# if no kernel version is contained in the basedir, try to find one
+if($basedir !~ m-/lib/modules/\d\.\d-) {
+ opendir(BD, $basedir) or die "can't open basedir $basedir : $!\n";
+ foreach ( readdir(BD) ) {
+ next if /^\.\.?$/;
+ next unless -d "$basedir/$_";
+ warn "dir = $_\n" if $verbose;
+ if( /^\d\.\d/ ) {
+ $kdir = $_;
+ warn("Guessed module directory as $basedir/$kdir\n");
+ last;
+ }
+ }
+ closedir(BD);
+ die "Cannot find a kernel version under $basedir\n" unless $kdir;
+ $basedir = "$basedir/$kdir";
+}
+
+# Find the list of .o or .ko files living under $basedir
+warn "**** Locating all modules\n" if $verbose;
+find sub {
+ my $file;
+ if ( -f $_ && ! -d $_ ) {
+ $file = $File::Find::name;
+ if ( $file =~ /\.k?o$/ ) {
+ push(@liblist, $file);
+ warn "$file\n" if $verbose;
+ }
+ }
+}, $basedir;
+warn "**** Finished locating modules\n" if $verbose;
+
+foreach my $obj ( @liblist ){
+ # turn the input file name into a target tag name
+ my ($tgtname) = $obj =~ m-(/lib/modules/.*)$-;
+
+ warn "\nMODULE = $tgtname\n" if $verbose;
+
+ # get a list of symbols
+ my @output=`$nm $obj`;
+
+ build_ref_tables($tgtname, \@output, $exp, $dep);
+}
+
+
+# vmlinux is a special name that is only used to resolve symbols
+my $tgtname = 'vmlinux';
+my @output = $kernelsyms ? `cat $kernelsyms` : `$nm $kernel`;
+warn "\nMODULE = $tgtname\n" if $verbose;
+build_ref_tables($tgtname, \@output, $exp, $dep);
+
+# resolve the dependencies for each module
+# reduce dependencies: remove unresolvable and resolved from vmlinux/System.map
+# remove duplicates
+foreach my $module (keys %$dep) {
+ warn "reducing module: $module\n" if $verbose;
+ $mod->{$module} = {};
+ foreach (@{$dep->{$module}}) {
+ if( $exp->{$_} ) {
+ warn "resolved symbol $_ in file $exp->{$_}\n" if $verbose;
+ next if $exp->{$_} =~ /vmlinux/;
+ $mod->{$module}{$exp->{$_}} = 1;
+ } else {
+ warn "unresolved symbol $_ in file $module\n";
+ }
+ }
+}
+
+# build a complete dependency list for each module and make sure it
+# is kept in order proper order
+my $mod2 = {};
+sub maybe_unshift
+{
+ my ($array, $ele) = @_;
+ # chop off the leading path /lib/modules/<kver>/ as modprobe
+ # will handle relative paths just fine
+ $ele =~ s:^/lib/modules/[^/]*/::;
+ foreach (@{$array}) {
+ if ($_ eq $ele) {
+ return;
+ }
+ }
+ unshift (@{$array}, $ele);
+}
+sub add_mod_deps
+{
+ my ($depth, $mod, $mod2, $module, $this_module) = @_;
+
+ $depth .= " ";
+ warn "${depth}loading deps of module: $this_module\n" if $verbose;
+ if (length($depth) > 50) {
+ die "too much recursion (circular dependencies in modules?)";
+ }
+
+ foreach my $md (keys %{$mod->{$this_module}}) {
+ add_mod_deps ($depth, $mod, $mod2, $module, $md);
+ warn "${depth} outputting $md\n" if $verbose;
+ maybe_unshift (\@{$$mod2->{$module}}, $md);
+ }
+
+ if (!%{$mod->{$this_module}}) {
+ warn "${depth} no deps\n" if $verbose;
+ }
+}
+foreach my $module (keys %$mod) {
+ warn "filling out module: $module\n" if $verbose;
+ @{$mod2->{$module}} = ();
+ add_mod_deps ("", $mod, \$mod2, $module, $module);
+}
+
+# figure out where the output should go
+if ($stdout == 0) {
+ warn "writing $basedir/modules.dep\n" if $verbose;
+ open(STDOUT, ">$basedir/modules.dep")
+ or die "cannot open $basedir/modules.dep: $!";
+}
+my $kseries = $basedir =~ m,/2\.4\.[^/]*, ? '2.4' : 'others';
+
+foreach my $module ( keys %$mod ) {
+ if($kseries eq '2.4') {
+ print "$module:\t";
+ my @sorted = sort bydep keys %{$mod->{$module}};
+ print join(" \\\n\t",@sorted);
+ print "\n\n";
+ } else {
+ my $shortmod = $module;
+ $shortmod =~ s:^/lib/modules/[^/]*/::;
+ print "$shortmod:";
+ my @sorted = @{$mod2->{$module}};
+ printf " " if @sorted;
+ print join(" ",@sorted);
+ print "\n";
+ }
+}
+
+
+sub build_ref_tables
+{
+ my ($name, $sym_ar, $exp, $dep) = @_;
+
+ my $ksymtab = grep m/ ${symprefix}__ksymtab/, @$sym_ar;
+
+ # gather the exported symbols
+ if($ksymtab){
+ # explicitly exported
+ foreach ( @$sym_ar ) {
+ / ${symprefix}__ksymtab_(.*)$/ and do {
+ my $sym = ${symprefix} . $1;
+ warn "sym = $sym\n" if $verbose;
+ $exp->{$sym} = $name;
+ };
+ }
+ } else {
+ # exporting all symbols
+ foreach ( @$sym_ar ) {
+ / [ABCDGRSTW] (.*)$/ and do {
+ warn "syma = $1\n" if $verbose;
+ $exp->{$1} = $name;
+ };
+ }
+ }
+
+ # this takes makes sure modules with no dependencies get listed
+ push @{$dep->{$name}}, $symprefix . 'printk' unless $name eq 'vmlinux';
+
+ # gather the unresolved symbols
+ foreach ( @$sym_ar ) {
+ !/ ${symprefix}__this_module/ && / U (.*)$/ and do {
+ warn "und = $1\n" if $verbose;
+ push @{$dep->{$name}}, $1;
+ };
+ }
+}
+
+sub bydep
+{
+ foreach my $f ( keys %{$mod->{$b}} ) {
+ if($f eq $a) {
+ return 1;
+ }
+ }
+ return -1;
+}
+
+
+
+__END__
+
+=head1 NAME
+
+depmod.pl - a cross platform script to generate kernel module
+dependency lists (modules.conf) which can then be used by modprobe
+on the target platform.
+
+It supports Linux 2.4 and 2.6 styles of modules.conf (auto-detected)
+
+=head1 SYNOPSIS
+
+depmod.pl [OPTION]... [basedir]...
+
+Example:
+
+ depmod.pl -F linux/System.map -b target/lib/modules/2.6.11
+
+=head1 DESCRIPTION
+
+The purpose of this script is to automagically generate a list of of kernel
+module dependencies. This script produces dependency lists that should be
+identical to the depmod program from the modutils package. Unlike the depmod
+binary, however, depmod.pl is designed to be run on your host system, not
+on your target system.
+
+This script was written by David Schleef <ds@schleef.org> to be used in
+conjunction with the BusyBox modprobe applet.
+
+=head1 OPTIONS
+
+=over 4
+
+=item B<-h --help>
+
+This displays the help message.
+
+=item B<-b --basedir>
+
+The base directory uner which the target's modules will be found. This
+defaults to the /lib/modules directory.
+
+If you don't specify the kernel version, this script will search for
+one under the specified based directory and use the first thing that
+looks like a kernel version.
+
+=item B<-k --kernel>
+
+Kernel binary for the target (vmlinux). You must either supply a kernel binary
+or a kernel symbol file (using the -F option).
+
+=item B<-F --kernelsyms>
+
+Kernel symbol file for the target (System.map).
+
+=item B<-n --stdout>
+
+Write to stdout instead of modules.dep
+kernel binary for the target (using the -k option).
+
+=item B<--verbose>
+
+Verbose (debug) output
+
+=back
+
+=head1 COPYRIGHT AND LICENSE
+
+ Copyright (c) 2001 David Schleef <ds@schleef.org>
+ Copyright (c) 2001 Erik Andersen <andersen@codepoet.org>
+ Copyright (c) 2001 Stuart Hughes <seh@zee2.com>
+ Copyright (c) 2002 Steven J. Hill <shill@broadcom.com>
+ Copyright (c) 2006 Freescale Semiconductor, Inc <stuarth@freescale.com>
+
+This program is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+=head1 AUTHOR
+
+David Schleef <ds@schleef.org>
+
+=cut
diff --git a/ap/app/busybox/src/examples/devfsd.conf b/ap/app/busybox/src/examples/devfsd.conf
new file mode 100644
index 0000000..10f1c87
--- /dev/null
+++ b/ap/app/busybox/src/examples/devfsd.conf
@@ -0,0 +1,133 @@
+# Sample /etc/devfsd.conf configuration file.
+# Richard Gooch <rgooch@atnf.csiro.au> 17-FEB-2002
+#
+# adapted for busybox devfsd implementation by Tito <farmatito@tiscali.it>
+#
+# Enable full compatibility mode for old device names. You may comment these
+# out if you don't use the old device names. Make sure you know what you're
+# doing!
+REGISTER .* MKOLDCOMPAT
+UNREGISTER .* RMOLDCOMPAT
+
+# You may comment out the above and uncomment the following if you've
+# configured your system to use the original "new" devfs names or the really
+# new names
+#REGISTER ^vc/ MKOLDCOMPAT
+#UNREGISTER ^vc/ RMOLDCOMPAT
+#REGISTER ^pty/ MKOLDCOMPAT
+#UNREGISTER ^pty/ RMOLDCOMPAT
+#REGISTER ^misc/ MKOLDCOMPAT
+#UNREGISTER ^misc/ RMOLDCOMPAT
+
+# You may comment these out if you don't use the original "new" names
+REGISTER .* MKNEWCOMPAT
+UNREGISTER .* RMNEWCOMPAT
+
+# Enable module autoloading. You may comment this out if you don't use
+# autoloading
+# Supported by busybox when CONFIG_DEVFSD_MODLOAD is set.
+# This actually doesn't work with busybox modutils but needs
+# the real modutils' modprobe
+LOOKUP .* MODLOAD
+
+# Uncomment the following if you want to set the group to "tty" for the
+# pseudo-tty devices. This is necessary so that mesg(1) can later be used to
+# enable/disable talk requests and wall(1) messages.
+REGISTER ^pty/s.* PERMISSIONS -1.tty 0600
+#REGISTER ^pts/.* PERMISSIONS -1.tty 0600
+
+# Restoring /dev/log on startup would trigger the minilogd/initlog deadlock
+# (minilogd falsely assuming syslogd has been started).
+REGISTER ^log$ IGNORE
+CREATE ^log$ IGNORE
+CHANGE ^log$ IGNORE
+DELETE ^log$ IGNORE
+
+#
+# Uncomment this if you want permissions to be saved and restored
+# Do not do this for pseudo-terminal devices
+REGISTER ^pt[sy] IGNORE
+CREATE ^pt[sy] IGNORE
+CHANGE ^pt[sy] IGNORE
+DELETE ^pt[sy] IGNORE
+REGISTER .* COPY /lib/dev-state/$devname $devpath
+CREATE .* COPY $devpath /lib/dev-state/$devname
+CHANGE .* COPY $devpath /lib/dev-state/$devname
+#DELETE .* CFUNCTION GLOBAL unlink /lib/dev-state/$devname
+# Busybox
+DELETE .* EXECUTE /bin/rm -f /lib/dev-state/$devname
+
+RESTORE /lib/dev-state
+
+#
+# Uncomment this if you want the old /dev/cdrom symlink
+#REGISTER ^cdroms/cdrom0$ CFUNCTION GLOBAL mksymlink $devname cdrom
+#UNREGISTER ^cdroms/cdrom0$ CFUNCTION GLOBAL unlink cdrom
+# busybox
+REGISTER ^cdroms/cdrom0$ EXECUTE /bin/ln -sf $devname cdrom
+UNREGISTER ^cdroms/cdrom0$ EXECUTE /bin/rm -f cdrom
+
+#REGISTER ^v4l/video0$ CFUNCTION GLOBAL mksymlink v4l/video0 video
+#UNREGISTER ^v4l/video0$ CFUNCTION GLOBAL unlink video
+#REGISTER ^radio0$ CFUNCTION GLOBAL mksymlink radio0 radio
+#UNREGISTER ^radio0$ CFUNCTION GLOBAL unlink radio
+# Busybox
+REGISTER ^v4l/video0$ EXECUTE /bin/ln -sf v4l/video0 video
+UNREGISTER ^v4l/video0$ EXECUTE /bin/rm -f video
+REGISTER ^radio0$ EXECUTE /bin/ln -sf radio0 radio
+UNREGISTER ^radio0$ EXECUTE /bin/rm -f radio
+
+# ALSA stuff
+#LOOKUP snd MODLOAD ACTION snd
+
+# Uncomment this to let PAM manage devfs
+# Not supported by busybox
+#REGISTER .* CFUNCTION /lib/security/pam_console_apply_devfsd.so pam_console_apply_single $devpath
+
+# Uncomment this to manage USB mouse
+# Not supported by busybox
+#REGISTER ^input/mouse0$ CFUNCTION GLOBAL mksymlink $devname usbmouse
+#UNREGISTER ^input/mouse0$ CFUNCTION GLOBAL unlink usbmouse
+# Busybox
+#REGISTER ^input/mouse0$ EXECUTE /bin/ln -sf $devname usbmouse
+#UNREGISTER ^input/mouse0$ EXECUTE /bin/rm -f usbmouse
+# Not supported by busybox
+#REGISTER ^input/mice$ CFUNCTION GLOBAL mksymlink $devname usbmouse
+#UNREGISTER ^input/mice$ CFUNCTION GLOBAL unlink usbmouse
+# Busybox
+REGISTER ^input/mice$ EXECUTE /bin/ln -sf $devname usbmouse
+UNREGISTER ^input/mice$ EXECUTE /bin/rm -f usbmouse
+
+# If you have removable media and want to force media revalidation when looking
+# up new or old compatibility names, uncomment the following lines
+# SCSI NEWCOMPAT /dev/sd/* names
+LOOKUP ^(sd/c[0-9]+b[0-9]+t[0-9]+u[0-9]+)p[0-9]+$ EXECUTE /bin/dd if=$mntpnt/\1 of=/dev/null count=1
+# SCSI OLDCOMPAT /dev/sd?? names
+LOOKUP ^(sd[a-z]+)[0-9]+$ EXECUTE /bin/dd if=$mntpnt/\1 of=/dev/null count=1
+# IDE NEWCOMPAT /dev/ide/hd/* names
+LOOKUP ^(ide/hd/c[0-9]+b[0-9]+t[0-9]+u[0-9]+)p[0-9]+$ EXECUTE /bin/dd if=$mntpnt/\1 of=/dev/null count=1
+# IDE OLDCOMPAT /dev/hd?? names
+LOOKUP ^(hd[a-z])[0-9]+$ EXECUTE /bin/dd if=$mntpnt/\1 of=/dev/null count=1
+# IDE-SCSI NEWCOMPAT /dev/sd/* names
+#LOOKUP ^(sd/c[0-9]+b[0-9]+t[0-9]+u[0-9]+)p[0-9]+$ EXECUTE /bin/dd if=$mntpnt/\1 of=/dev/null count=1
+#SCSI OLDCOMPAT /dev/scd? names
+LOOKUP ^(scd+)[0-9]+$ EXECUTE /bin/dd if=$mntpnt/\1 of=/dev/null count=1
+
+
+REGISTER ^dvb/card[0-9]+/[^/]+$ PERMISSIONS root.video 0660
+# Not supported by busybox
+#REGISTER ^dvb/card([0-9]+)/([^/0-9]*)[0-9]+$ CFUNCTION GLOBAL mksymlink /dev/$devname ost/\2\1
+#UNREGISTER ^dvb/card([0-9]+)/([^/0-9]*)[0-9]+$ CFUNCTION GLOBAL unlink ost/\2\1
+# Busybox
+REGISTER ^dvb/card([0-9]+)/([^/0-9]*)[0-9]+$ EXECUTE /bin/ln -sf /dev/$devname ost/\2\1
+UNREGISTER ^dvb/card([0-9]+)/([^/0-9]*)[0-9]+$ EXECUTE /bin/rm -f ost/\2\1
+
+# Include package-generated files from /etc/devfs/conf.d
+# Supported by busybox
+# INCLUDE /etc/devfs/conf.d/
+INCLUDE /etc/devfs/busybox/
+# Busybox: just for testing
+#INCLUDE /etc/devfs/nothing/
+#INCLUDE /etc/devfs/nothing/nothing
+#OPTIONAL_INCLUDE /etc/devfs/nothing/
+#OPTIONAL_INCLUDE /etc/devfs/nothing/nothing
diff --git a/ap/app/busybox/src/examples/dnsd.conf b/ap/app/busybox/src/examples/dnsd.conf
new file mode 100644
index 0000000..8af622b
--- /dev/null
+++ b/ap/app/busybox/src/examples/dnsd.conf
@@ -0,0 +1 @@
+thebox 192.168.1.5
diff --git a/ap/app/busybox/src/examples/inetd.conf b/ap/app/busybox/src/examples/inetd.conf
new file mode 100644
index 0000000..ca7e3d8
--- /dev/null
+++ b/ap/app/busybox/src/examples/inetd.conf
@@ -0,0 +1,73 @@
+# /etc/inetd.conf: see inetd(8) for further informations.
+#
+# Internet server configuration database
+#
+#
+# If you want to disable an entry so it isn't touched during
+# package updates just comment it out with a single '#' character.
+#
+# If you make changes to this file, either reboot your machine or
+# send the inetd process a HUP signal:
+# Do a "ps x" as root and look up the pid of inetd. Then do a
+# kill -HUP <pid of inetd>
+# inetd will re-read this file whenever it gets that signal.
+# <service_name> <sock_type> <proto> <flags> <user> <server_path> <args>
+#
+#:INTERNAL: Internal services
+# It is generally considered safer to keep these off.
+echo stream tcp nowait root internal
+echo dgram udp wait root internal
+#discard stream tcp nowait root internal
+#discard dgram udp wait root internal
+daytime stream tcp nowait root internal
+daytime dgram udp wait root internal
+#chargen stream tcp nowait root internal
+#chargen dgram udp wait root internal
+time stream tcp nowait root internal
+time dgram udp wait root internal
+
+# These are standard services.
+#
+#ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd
+#telnet stream tcp nowait root /sbin/telnetd /sbin/telnetd
+#nntp stream tcp nowait root tcpd in.nntpd
+#smtp stream tcp nowait root tcpd sendmail -v
+#
+# Shell, login, exec and talk are BSD protocols.
+#
+# If you run an ntalk daemon (such as netkit-ntalk) on the old talk
+# port, that is, "talk" as opposed to "ntalk", it won't work and may
+# cause certain broken talk clients to malfunction.
+#
+# The talkd from netkit-ntalk 0.12 and higher, however, can speak the
+# old talk protocol and can be used safely.
+#
+#shell stream tcp nowait root /usr/sbin/tcpd in.rshd -L
+#login stream tcp nowait root /usr/sbin/tcpd in.rlogind -L
+#exec stream tcp nowait root /usr/sbin/tcpd in.rexecd
+#talk dgram udp wait root /usr/sbin/tcpd in.talkd
+#ntalk dgram udp wait root /usr/sbin/tcpd in.talkd
+#
+# Pop et al
+# Leave these off unless you're using them.
+#pop2 stream tcp nowait root /usr/sbin/tcpd in.pop2d
+#pop3 stream tcp nowait root /usr/sbin/tcpd in.pop3d
+#
+# The Internet UUCP service.
+# uucp stream tcp nowait uucp /usr/sbin/tcpd /usr/lib/uucp/uucico -l
+#
+# Tftp service is provided primarily for booting. Most sites
+# run this only on machines acting as "boot servers." If you don't
+# need it, don't use it.
+#
+#tftp dgram udp wait nobody /usr/sbin/tcpd in.tftpd
+#bootps dgram udp wait root /usr/sbin/in.bootpd in.bootpd
+#
+# Finger, systat and netstat give out user information which may be
+# valuable to potential "system crackers." Many sites choose to disable
+# some or all of these services to improve security.
+#
+#finger stream tcp nowait nobody /usr/sbin/tcpd in.fingerd -w
+#systat stream tcp nowait nobody /usr/sbin/tcpd /bin/ps -auwwx
+#netstat stream tcp nowait root /bin/netstat /bin/netstat -a
+#ident stream tcp nowait root /usr/sbin/in.identd in.identd
diff --git a/ap/app/busybox/src/examples/inittab b/ap/app/busybox/src/examples/inittab
new file mode 100644
index 0000000..c4e0af5
--- /dev/null
+++ b/ap/app/busybox/src/examples/inittab
@@ -0,0 +1,89 @@
+# /etc/inittab init(8) configuration for BusyBox
+#
+# Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
+#
+#
+# Note, BusyBox init doesn't support runlevels. The runlevels field is
+# completely ignored by BusyBox init. If you want runlevels, use sysvinit.
+#
+#
+# Format for each entry: <id>:<runlevels>:<action>:<process>
+#
+# <id>: WARNING: This field has a non-traditional meaning for BusyBox init!
+#
+# The id field is used by BusyBox init to specify the controlling tty for
+# the specified process to run on. The contents of this field are
+# appended to "/dev/" and used as-is. There is no need for this field to
+# be unique, although if it isn't you may have strange results. If this
+# field is left blank, it is completely ignored. Also note that if
+# BusyBox detects that a serial console is in use, then all entries
+# containing non-empty id fields will be ignored. BusyBox init does
+# nothing with utmp. We don't need no stinkin' utmp.
+#
+# <runlevels>: The runlevels field is completely ignored.
+#
+# <action>: Valid actions include: sysinit, respawn, askfirst, wait, once,
+# restart, ctrlaltdel, and shutdown.
+#
+# Note: askfirst acts just like respawn, but before running the specified
+# process it displays the line "Please press Enter to activate this
+# console." and then waits for the user to press enter before starting
+# the specified process.
+#
+# Note: unrecognized actions (like initdefault) will cause init to emit
+# an error message, and then go along with its business.
+#
+# <process>: Specifies the process to be executed and it's command line.
+#
+# Note: BusyBox init works just fine without an inittab. If no inittab is
+# found, it has the following default behavior:
+# ::sysinit:/etc/init.d/rcS
+# ::askfirst:/bin/sh
+# ::ctrlaltdel:/sbin/reboot
+# ::shutdown:/sbin/swapoff -a
+# ::shutdown:/bin/umount -a -r
+# ::restart:/sbin/init
+#
+# if it detects that /dev/console is _not_ a serial console, it will
+# also run:
+# tty2::askfirst:/bin/sh
+# tty3::askfirst:/bin/sh
+# tty4::askfirst:/bin/sh
+#
+# Boot-time system configuration/initialization script.
+# This is run first except when booting in single-user mode.
+#
+::sysinit:/etc/init.d/rcS
+
+# /bin/sh invocations on selected ttys
+#
+# Note below that we prefix the shell commands with a "-" to indicate to the
+# shell that it is supposed to be a login shell. Normally this is handled by
+# login, but since we are bypassing login in this case, BusyBox lets you do
+# this yourself...
+#
+# Start an "askfirst" shell on the console (whatever that may be)
+::askfirst:-/bin/sh
+# Start an "askfirst" shell on /dev/tty2-4
+tty2::askfirst:-/bin/sh
+tty3::askfirst:-/bin/sh
+tty4::askfirst:-/bin/sh
+
+# /sbin/getty invocations for selected ttys
+tty4::respawn:/sbin/getty 38400 tty5
+tty5::respawn:/sbin/getty 38400 tty6
+
+# Example of how to put a getty on a serial line (for a terminal)
+#::respawn:/sbin/getty -L ttyS0 9600 vt100
+#::respawn:/sbin/getty -L ttyS1 9600 vt100
+#
+# Example how to put a getty on a modem line.
+#::respawn:/sbin/getty 57600 ttyS2
+
+# Stuff to do when restarting the init process
+::restart:/sbin/init
+
+# Stuff to do before rebooting
+::ctrlaltdel:/sbin/reboot
+::shutdown:/bin/umount -a -r
+::shutdown:/sbin/swapoff -a
diff --git a/ap/app/busybox/src/examples/linux-2.6.30_proc_self_exe.patch b/ap/app/busybox/src/examples/linux-2.6.30_proc_self_exe.patch
new file mode 100644
index 0000000..a36581b
--- /dev/null
+++ b/ap/app/busybox/src/examples/linux-2.6.30_proc_self_exe.patch
@@ -0,0 +1,34 @@
+This patch makes /proc/self/exe executable even if proc
+is not mounted. It is especially useful on NOMMU arches.
+
+diff -urp ../linux-2.6.30.org/fs/exec.c linux-2.6.30/fs/exec.c
+--- ../linux-2.6.30.org/fs/exec.c 2009-06-10 05:05:27.000000000 +0200
++++ linux-2.6.30/fs/exec.c 2009-06-25 00:20:13.000000000 +0200
+@@ -652,9 +652,25 @@ struct file *open_exec(const char *name)
+ file = do_filp_open(AT_FDCWD, name,
+ O_LARGEFILE | O_RDONLY | FMODE_EXEC, 0,
+ MAY_EXEC | MAY_OPEN);
+- if (IS_ERR(file))
+- goto out;
++ if (IS_ERR(file)) {
++ if ((PTR_ERR(file) == -ENOENT || PTR_ERR(file) == -EACCES)
++ && strcmp(name, "/proc/self/exe") == 0
++ ) {
++ struct file *sv = file;
++ struct mm_struct *mm;
+
++ mm = get_task_mm(current);
++ if (!mm)
++ goto out;
++ file = get_mm_exe_file(mm);
++ mmput(mm);
++ if (file)
++ goto ok;
++ file = sv;
++ }
++ goto out;
++ }
++ok:
+ err = -EACCES;
+ if (!S_ISREG(file->f_path.dentry->d_inode->i_mode))
+ goto exit;
diff --git a/ap/app/busybox/src/examples/mdev.conf b/ap/app/busybox/src/examples/mdev.conf
new file mode 100644
index 0000000..5179569
--- /dev/null
+++ b/ap/app/busybox/src/examples/mdev.conf
@@ -0,0 +1,36 @@
+#
+# This is a sample mdev.conf
+#
+
+# Provide user, group, and mode information for devices. If a regex matches
+# the device name provided by sysfs, use the appropriate user:group and mode
+# instead of the default 0:0 660.
+#
+# Syntax:
+# [-]devicename_regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
+# [-]$ENVVAR=regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
+# [-]@maj,min[-min2] user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
+#
+# [-]: do not stop on this match, continue reading mdev.conf
+# =: move, >: move and create a symlink
+# !: do not create device node
+# @|$|*: run@cmd if $ACTION=add, $cmd if $ACTION=remove, *cmd in all cases
+
+null 0:0 666
+zero 0:0 666
+urandom 0:0 444
+
+kmem 0:9 000
+mem 0:9 640
+port 0:9 640
+
+console 0:5 600
+ptmx 0:5 660
+tty[0-9]* 0:5 660
+
+ttyS[0-9]* 0:20 640
+
+fd[0-9]* 0:11 660
+
+sd[a-z]* 0:6 660
+hd[a-z]* 0:6 660
diff --git a/ap/app/busybox/src/examples/mdev_fat.conf b/ap/app/busybox/src/examples/mdev_fat.conf
new file mode 100644
index 0000000..ceba3a7
--- /dev/null
+++ b/ap/app/busybox/src/examples/mdev_fat.conf
@@ -0,0 +1,113 @@
+#
+# This is a sample mdev.conf
+#
+
+# Provide user, group, and mode information for devices. If a regex matches
+# the device name provided by sysfs, use the appropriate user:group and mode
+# instead of the default 0:0 660.
+#
+# Syntax:
+# [-]devicename_regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
+# [-]$ENVVAR=regex user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
+# [-]@maj,min[-min2] user:group mode [=path]|[>path]|[!] [@|$|*cmd args...]
+#
+# [-]: do not stop on this match, continue reading mdev.conf
+# =: move, >: move and create a symlink
+# !: do not create device node
+# @|$|*: run cmd if $ACTION=remove, @cmd if $ACTION=add, *cmd in all cases
+
+# support module loading on hotplug
+$MODALIAS=.* root:root 660 @modprobe "$MODALIAS"
+
+# null may already exist; therefore ownership has to be changed with command
+null root:root 666 @chmod 666 $MDEV
+zero root:root 666
+full root:root 666
+random root:root 444
+urandom root:root 444
+hwrandom root:root 444
+grsec root:root 660
+
+kmem root:root 640
+mem root:root 640
+port root:root 640
+# console may already exist; therefore ownership has to be changed with command
+console root:tty 600 @chmod 600 $MDEV
+ptmx root:tty 666
+pty.* root:tty 660
+
+# Typical devices
+
+tty root:tty 666
+tty[0-9]* root:tty 660
+vcsa*[0-9]* root:tty 660
+ttyS[0-9]* root:uucp 660
+
+# block devices
+ram([0-9]*) root:disk 660 >rd/%1
+loop([0-9]+) root:disk 660 >loop/%1
+sd[a-z].* root:disk 660 */lib/mdev/usbdisk_link
+hd[a-z][0-9]* root:disk 660 */lib/mdev/ide_links
+md[0-9]* root:disk 660
+sr[0-9]* root:cdrom 660 @ln -sf $MDEV cdrom
+fd[0-9]* root:floppy 660
+
+# net devices
+tun[0-9]* root:root 600 =net/
+tap[0-9]* root:root 600 =net/
+
+# alsa sound devices and audio stuff
+pcm.* root:audio 660 =snd/
+control.* root:audio 660 =snd/
+midi.* root:audio 660 =snd/
+seq root:audio 660 =snd/
+timer root:audio 660 =snd/
+
+adsp root:audio 660 >sound/
+audio root:audio 660 >sound/
+dsp root:audio 660 >sound/
+mixer root:audio 660 >sound/
+sequencer.* root:audio 660 >sound/
+
+# Less typical devices
+
+# raid controllers
+cciss!(.*) root:disk 660 =cciss/%1
+ida!(.*) root:disk 660 =ida/%1
+rd!(.*) root:disk 660 =rd/%1
+
+ttyLTM[0-9] root:dialout 660 @ln -sf $MDEV modem
+ttySHSF[0-9] root:dialout 660 @ln -sf $MDEV modem
+slamr root:dialout 660 @ln -sf $MDEV slamr0
+slusb root:dialout 660 @ln -sf $MDEV slusb0
+
+fuse root:root 666
+
+# dri device
+card[0-9] root:video 660 =dri/
+
+# misc stuff
+agpgart root:root 660 >misc/
+psaux root:root 660 >misc/
+rtc root:root 664 >misc/
+
+# input stuff
+event[0-9]+ root:root 640 =input/
+mice root:root 640 =input/
+mouse[0-9] root:root 640 =input/
+ts[0-9] root:root 600 =input/
+
+# v4l stuff
+vbi[0-9] root:video 660 >v4l/
+video[0-9] root:video 660 >v4l/
+
+# dvb stuff
+dvb.* root:video 660 */lib/mdev/dvbdev
+
+# load drivers for usb devices
+usbdev[0-9].[0-9] root:root 660 */lib/mdev/usbdev
+usbdev[0-9].[0-9]_.* root:root 660
+
+# zaptel devices
+zap(.*) root:dialout 660 =zap/%1
+dahdi!(.*) root:dialout 660 =dahdi/%1
diff --git a/ap/app/busybox/src/examples/mk2knr.pl b/ap/app/busybox/src/examples/mk2knr.pl
new file mode 100755
index 0000000..1259b84
--- /dev/null
+++ b/ap/app/busybox/src/examples/mk2knr.pl
@@ -0,0 +1,84 @@
+#!/usr/bin/perl -w
+#
+# @(#) mk2knr.pl - generates a perl script that converts lexemes to K&R-style
+#
+# How to use this script:
+# - In the busybox directory type 'examples/mk2knr.pl files-to-convert'
+# - Review the 'convertme.pl' script generated and remove / edit any of the
+# substitutions in there (please especially check for false positives)
+# - Type './convertme.pl same-files-as-before'
+# - Compile and see if it works
+#
+# BUGS: This script does not ignore strings inside comments or strings inside
+# quotes (it probably should).
+
+# set this to something else if you want
+$convertme = 'convertme.pl';
+
+# internal-use variables (don't touch)
+$convert = 0;
+%converted = ();
+
+# if no files were specified, print usage
+die "usage: $0 file.c | file.h\n" if scalar(@ARGV) == 0;
+
+# prepare the "convert me" file
+open(CM, ">$convertme") or die "convertme.pl $!";
+print CM "#!/usr/bin/perl -p -i\n\n";
+
+# process each file passed on the cmd line
+while (<>) {
+
+ # if the line says "getopt" in it anywhere, we don't want to muck with it
+ # because option lists tend to include strings like "cxtzvOf:" which get
+ # matched by the "check for mixed case" regexps below
+ next if /getopt/;
+
+ # tokenize the string into just the variables
+ while (/([a-zA-Z_][a-zA-Z0-9_]*)/g) {
+ $var = $1;
+
+ # ignore the word "BusyBox"
+ next if ($var =~ /BusyBox/);
+
+ # this checks for javaStyle or szHungarianNotation
+ $convert++ if ($var =~ /^[a-z]+[A-Z][a-z]+/);
+
+ # this checks for PascalStyle
+ $convert++ if ($var =~ /^[A-Z][a-z]+[A-Z][a-z]+/);
+
+ # if we want to add more checks, we can add 'em here, but the above
+ # checks catch "just enough" and not too much, so prolly not.
+
+ if ($convert) {
+ $convert = 0;
+
+ # skip ahead if we've already dealt with this one
+ next if ($converted{$var});
+
+ # record that we've dealt with this var
+ $converted{$var} = 1;
+
+ print CM "s/\\b$var\\b/"; # more to come in just a minute
+
+ # change the first letter to lower-case
+ $var = lcfirst($var);
+
+ # put underscores before all remaining upper-case letters
+ $var =~ s/([A-Z])/_$1/g;
+
+ # now change the remaining characters to lower-case
+ $var = lc($var);
+
+ print CM "$var/g;\n";
+ }
+ }
+}
+
+# tidy up and make the $convertme script executable
+close(CM);
+chmod 0755, $convertme;
+
+# print a helpful help message
+print "Done. Scheduled name changes are in $convertme.\n";
+print "Please review/modify it and then type ./$convertme to do the search & replace.\n";
diff --git a/ap/app/busybox/src/examples/udhcp/sample.bound b/ap/app/busybox/src/examples/udhcp/sample.bound
new file mode 100755
index 0000000..bd3569c
--- /dev/null
+++ b/ap/app/busybox/src/examples/udhcp/sample.bound
@@ -0,0 +1,31 @@
+#!/bin/sh
+# Sample udhcpc renew script
+
+RESOLV_CONF="/etc/udhcpc/resolv.conf"
+
+[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
+[ -n "$subnet" ] && NETMASK="netmask $subnet"
+
+/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
+
+if [ -n "$router" ]
+then
+ echo "deleting routers"
+ while /sbin/route del default gw 0.0.0.0 dev $interface
+ do :
+ done
+
+ metric=0
+ for i in $router
+ do
+ /sbin/route add default gw $i dev $interface metric $((metric++))
+ done
+fi
+
+echo -n > $RESOLV_CONF
+[ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF
+for i in $dns
+do
+ echo adding dns $i
+ echo nameserver $i >> $RESOLV_CONF
+done
diff --git a/ap/app/busybox/src/examples/udhcp/sample.deconfig b/ap/app/busybox/src/examples/udhcp/sample.deconfig
new file mode 100755
index 0000000..b221bcf
--- /dev/null
+++ b/ap/app/busybox/src/examples/udhcp/sample.deconfig
@@ -0,0 +1,4 @@
+#!/bin/sh
+# Sample udhcpc deconfig script
+
+/sbin/ifconfig $interface 0.0.0.0
diff --git a/ap/app/busybox/src/examples/udhcp/sample.nak b/ap/app/busybox/src/examples/udhcp/sample.nak
new file mode 100755
index 0000000..f4d08e6
--- /dev/null
+++ b/ap/app/busybox/src/examples/udhcp/sample.nak
@@ -0,0 +1,4 @@
+#!/bin/sh
+# Sample udhcpc nak script
+
+echo Received a NAK: $message
diff --git a/ap/app/busybox/src/examples/udhcp/sample.renew b/ap/app/busybox/src/examples/udhcp/sample.renew
new file mode 100755
index 0000000..ea368fc
--- /dev/null
+++ b/ap/app/busybox/src/examples/udhcp/sample.renew
@@ -0,0 +1,31 @@
+#!/bin/sh
+# Sample udhcpc bound script
+
+RESOLV_CONF="/etc/udhcpc/resolv.conf"
+
+[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
+[ -n "$subnet" ] && NETMASK="netmask $subnet"
+
+/sbin/ifconfig $interface $ip $BROADCAST $NETMASK
+
+if [ -n "$router" ]
+then
+ echo "deleting routers"
+ while /sbin/route del default gw 0.0.0.0 dev $interface
+ do :
+ done
+
+ metric=0
+ for i in $router
+ do
+ /sbin/route add default gw $i dev $interface metric $((metric++))
+ done
+fi
+
+echo -n > $RESOLV_CONF
+[ -n "$domain" ] && echo domain $domain >> $RESOLV_CONF
+for i in $dns
+do
+ echo adding dns $i
+ echo nameserver $i >> $RESOLV_CONF
+done
diff --git a/ap/app/busybox/src/examples/udhcp/sample.script b/ap/app/busybox/src/examples/udhcp/sample.script
new file mode 100755
index 0000000..9b717ac
--- /dev/null
+++ b/ap/app/busybox/src/examples/udhcp/sample.script
@@ -0,0 +1,7 @@
+#!/bin/sh
+# Currently, we only dispatch according to command. However, a more
+# elaborate system might dispatch by command and interface or do some
+# common initialization first, especially if more dhcp event notifications
+# are added.
+
+exec /usr/share/udhcpc/sample.$1
diff --git a/ap/app/busybox/src/examples/udhcp/simple.script b/ap/app/busybox/src/examples/udhcp/simple.script
new file mode 100755
index 0000000..40ee738
--- /dev/null
+++ b/ap/app/busybox/src/examples/udhcp/simple.script
@@ -0,0 +1,47 @@
+#!/bin/sh
+# udhcpc script edited by Tim Riker <Tim@Rikers.org>
+
+RESOLV_CONF="/etc/resolv.conf"
+
+[ -n "$1" ] || { echo "Error: should be called from udhcpc"; exit 1; }
+
+NETMASK=""
+[ -n "$subnet" ] && NETMASK="netmask $subnet"
+BROADCAST="broadcast +"
+[ -n "$broadcast" ] && BROADCAST="broadcast $broadcast"
+
+case "$1" in
+ deconfig)
+ echo "Setting IP address 0.0.0.0 on $interface"
+ ifconfig $interface 0.0.0.0
+ ;;
+
+ renew|bound)
+ echo "Setting IP address $ip on $interface"
+ ifconfig $interface $ip $NETMASK $BROADCAST
+
+ if [ -n "$router" ] ; then
+ echo "Deleting routers"
+ while route del default gw 0.0.0.0 dev $interface ; do
+ :
+ done
+
+ metric=0
+ for i in $router ; do
+ echo "Adding router $i"
+ route add default gw $i dev $interface metric $((metric++))
+ done
+ fi
+
+ echo "Recreating $RESOLV_CONF"
+ echo -n > $RESOLV_CONF-$$
+ [ -n "$domain" ] && echo "search $domain" >> $RESOLV_CONF-$$
+ for i in $dns ; do
+ echo " Adding DNS server $i"
+ echo "nameserver $i" >> $RESOLV_CONF-$$
+ done
+ mv $RESOLV_CONF-$$ $RESOLV_CONF
+ ;;
+esac
+
+exit 0
diff --git a/ap/app/busybox/src/examples/udhcp/udhcpd.conf b/ap/app/busybox/src/examples/udhcp/udhcpd.conf
new file mode 100644
index 0000000..eca44c0
--- /dev/null
+++ b/ap/app/busybox/src/examples/udhcp/udhcpd.conf
@@ -0,0 +1,115 @@
+# Sample udhcpd configuration file (/etc/udhcpd.conf)
+# Values shown are defaults
+
+# The start and end of the IP lease block
+start 192.168.0.20
+end 192.168.0.254
+
+# The interface that udhcpd will use
+interface eth0
+
+# The maximum number of leases (includes addresses reserved
+# by OFFER's, DECLINE's, and ARP conflicts). Will be corrected
+# if it's bigger than IP lease block, but it ok to make it
+# smaller than lease block.
+#max_leases 254
+
+# The amount of time that an IP will be reserved (leased to nobody)
+# if a DHCP decline message is received (seconds)
+#decline_time 3600
+
+# The amount of time that an IP will be reserved
+# if an ARP conflict occurs (seconds)
+#conflict_time 3600
+
+# How long an offered address is reserved (seconds)
+#offer_time 60
+
+# If client asks for lease below this value, it will be rounded up
+# to this value (seconds)
+#min_lease 60
+
+# The location of the pid file
+#pidfile /var/run/udhcpd.pid
+
+# The location of the leases file
+#lease_file /var/lib/misc/udhcpd.leases
+
+# The time period at which udhcpd will write out leases file.
+# If this is 0, udhcpd will never automatically write leases file.
+# Specified in seconds.
+#auto_time 7200
+
+# Every time udhcpd writes a leases file, the below script will be called
+#notify_file # default: no script
+#notify_file dumpleases # useful for debugging
+
+# The following are bootp specific options
+# next server to use in bootstrap
+#siaddr 192.168.0.22 # default: 0.0.0.0 (none)
+# tftp server name
+#sname zorak # default: none
+# tftp file to download (e.g. kernel image)
+#boot_file /var/nfs_root # default: none
+
+# Static leases map
+#static_lease 00:60:08:11:CE:4E 192.168.0.54
+#static_lease 00:60:08:11:CE:3E 192.168.0.44
+
+# The remainder of options are DHCP options and can be specified with the
+# keyword 'opt' or 'option'. If an option can take multiple items, such
+# as the dns option, they can be listed on the same line, or multiple
+# lines.
+# Examples:
+opt dns 192.168.10.2 192.168.10.10
+option subnet 255.255.255.0
+opt router 192.168.10.2
+opt wins 192.168.10.10
+option dns 129.219.13.81 # appended to above DNS servers for a total of 3
+option domain local
+option lease 864000 # default: 10 days
+option msstaticroutes 10.0.0.0/8 10.127.0.1 # single static route
+option staticroutes 10.0.0.0/8 10.127.0.1, 10.11.12.0/24 10.11.12.1
+# Arbitrary option in hex form:
+option 0x08 01020304 # option 8: "cookie server IP addr: 1.2.3.4"
+
+# Currently supported options (for more info, see options.c):
+#opt lease NUM
+#opt subnet IP
+#opt broadcast IP
+#opt router IP_LIST
+#opt ipttl NUM
+#opt mtu NUM
+#opt hostname STRING # client's hostname
+#opt domain STRING # client's domain suffix
+#opt search STRING_LIST # search domains
+#opt nisdomain STRING
+#opt timezone NUM # (localtime - UTC_time) in seconds. signed
+#opt tftp STRING # tftp server name
+#opt bootfile STRING # tftp file to download (e.g. kernel image)
+#opt bootsize NUM # size of that file
+#opt rootpath STRING # (NFS) path to mount as root fs
+#opt wpad STRING
+#opt serverid IP # default: server's IP
+#opt message STRING # error message (udhcpd sends it on success too)
+#opt vlanid NUM # 802.1P VLAN ID
+#opt vlanpriority NUM # 802.1Q VLAN priority
+# Options specifying server(s)
+#opt dns IP_LIST
+#opt wins IP_LIST
+#opt nissrv IP_LIST
+#opt ntpsrv IP_LIST
+#opt lprsrv IP_LIST
+#opt swapsrv IP
+# Options specifying routes
+#opt routes IP_PAIR_LIST
+#opt staticroutes STATIC_ROUTES # RFC 3442 classless static route option
+#opt msstaticroutes STATIC_ROUTES # same, using MS option number
+# Obsolete options, no longer supported
+#opt logsrv IP_LIST # 704/UDP log server (not syslog!)
+#opt namesrv IP_LIST # IEN 116 name server, obsolete (August 1979!!!)
+#opt cookiesrv IP_LIST # RFC 865 "quote of the day" server, rarely (never?) used
+#opt timesrv IP_LIST # RFC 868 time server, rarely (never?) used
+# TODO: in development
+#opt userclass STRING # RFC 3004. set of LASCII strings. "I am a printer" etc
+#opt sipserv STRING LIST # RFC 3361. flag byte, then: 0: domain names, 1: IP addrs
diff --git a/ap/app/busybox/src/examples/undeb b/ap/app/busybox/src/examples/undeb
new file mode 100755
index 0000000..37104e9
--- /dev/null
+++ b/ap/app/busybox/src/examples/undeb
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# This should work with the GNU version of tar and gzip!
+# This should work with the bash or ash shell!
+# Requires the programs (ar, tar, gzip, and the pager more or less).
+#
+usage() {
+echo "Usage: undeb -c package.deb <Print control file info>"
+echo " undeb -l package.deb <List contents of deb package>"
+echo " undeb -x package.deb /foo/boo <Extract deb package to this directory,"
+echo " put . for current directory>"
+exit
+}
+
+deb=$2
+
+exist() {
+if [ "$deb" = "" ]; then
+usage
+elif [ ! -s "$deb" ]; then
+echo "Can't find $deb!"
+exit
+fi
+}
+
+if [ "$1" = "" ]; then
+usage
+elif [ "$1" = "-l" ]; then
+exist
+type more >/dev/null 2>&1 && pager=more
+type less >/dev/null 2>&1 && pager=less
+[ "$pager" = "" ] && echo "No pager found!" && exit
+(ar -p $deb control.tar.gz | tar -xzO *control ; echo -e "\nPress enter to scroll, q to Quit!\n" ; ar -p $deb data.tar.gz | tar -tzv) | $pager
+exit
+elif [ "$1" = "-c" ]; then
+exist
+ar -p $deb control.tar.gz | tar -xzO *control
+exit
+elif [ "$1" = "-x" ]; then
+exist
+if [ "$3" = "" ]; then
+usage
+elif [ ! -d "$3" ]; then
+echo "No such directory $3!"
+exit
+fi
+ar -p $deb data.tar.gz | tar -xzvpf - -C $3 || exit
+echo
+echo "Extracted $deb to $3!"
+exit
+else
+usage
+fi
diff --git a/ap/app/busybox/src/examples/unrpm b/ap/app/busybox/src/examples/unrpm
new file mode 100755
index 0000000..7fd3676
--- /dev/null
+++ b/ap/app/busybox/src/examples/unrpm
@@ -0,0 +1,48 @@
+#!/bin/sh
+#
+# This should work with the GNU version of cpio and gzip!
+# This should work with the bash or ash shell!
+# Requires the programs (cpio, gzip, and the pager more or less).
+#
+usage() {
+echo "Usage: unrpm -l package.rpm <List contents of rpm package>"
+echo " unrpm -x package.rpm /foo/boo <Extract rpm package to this directory,"
+echo " put . for current directory>"
+exit
+}
+
+rpm=$2
+
+exist() {
+if [ "$rpm" = "" ]; then
+usage
+elif [ ! -s "$rpm" ]; then
+echo "Can't find $rpm!"
+exit
+fi
+}
+
+if [ "$1" = "" ]; then
+usage
+elif [ "$1" = "-l" ]; then
+exist
+type more >/dev/null 2>&1 && pager=more
+type less >/dev/null 2>&1 && pager=less
+[ "$pager" = "" ] && echo "No pager found!" && exit
+(echo -e "\nPress enter to scroll, q to Quit!\n" ; rpm2cpio $rpm | cpio -tv --quiet) | $pager
+exit
+elif [ "$1" = "-x" ]; then
+exist
+if [ "$3" = "" ]; then
+usage
+elif [ ! -d "$3" ]; then
+echo "No such directory $3!"
+exit
+fi
+rpm2cpio $rpm | (umask 0 ; cd $3 ; cpio -idmuv) || exit
+echo
+echo "Extracted $rpm to $3!"
+exit
+else
+usage
+fi
diff --git a/ap/app/busybox/src/examples/var_service/README b/ap/app/busybox/src/examples/var_service/README
new file mode 100644
index 0000000..06817c8
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/README
@@ -0,0 +1,59 @@
+In many cases, network configuration makes it necessary to run several daemons:
+dhcp, zeroconf, ppp, openvpn and such. They need to be controlled,
+and in many cases you also want to babysit them. runsvdir is a good tool for this.
+examples/var_service directory provides a few examples. It is meant to be used
+this way: copy it somewhere (say, /var/service) and run something like
+
+env - PATH=... <other vars=...> runsvdir /var/service &
+
+from one of system startup scripts. (Google "man runsvdir" and "man runsv"
+for more info about these tools).
+
+Some existing examples:
+
+var_service/dhcp_if -
+controls a udhcpc instance which provides dhpc-assigned IP
+address on interface named "if". Copy/rename this directory as needed to run
+udhcpc on other interfaces (var_service/dhcp_if/run script uses _foo suffix
+of the parent directory as interface name). When IP address is obtained or lost,
+var_service/dhcp_if/dhcp_handler is run. It saves new config data to
+/var/run/service/fw/dhcp_if.ipconf and (re)starts /var/service/fw service.
+This example can be used as a template for other dynamic network link services
+(ppp/vpn/zcip).
+
+var_service/ifplugd_if -
+watches link status of interface if. Downs and ups /var/service/dhcp_if
+service accordingly. In effect, it allows you to unplug/plug-to-different-network
+and have your IP properly re-negotiated at once.
+
+var_service/dhcp_if_pinger -
+Uses var_service/dhcp_if's data (/var/service/dhcp_if/dhcp_if.out file)
+to determine router IP. Pings it. If ping fails, restarts /var/service/dhcp_if
+service. Basically, an example of watchdog service for networks
+which are not reliable and need babysitting.
+
+var_service/fw -
+A *one-shot* service which reconfigures network based on current known state
+of ALL interfaces. Uses conf/*.ipconf (static config) and /var/run/service/fw/*.ipconf
+(dynamic config from dhcp/ppp/vpn/etc) to determine what to do.
+One-shot-ness of this service means that it shuts itself off after single run.
+IOW: it is not a constantly running daemon sort of thing.
+It starts, it configures the network, it shuts down, all done
+(unlike infamous NetworkManagers which sit in RAM forever, doing hell knows what).
+
+However, any dhcp/ppp/vpn or similar service can restart it anytime
+when it senses the change in network configuration.
+This even works while fw service runs: if dhcp signals fw to (re)start
+while fw runs, fw will not stop after its execution, but will re-execute once,
+picking up dhcp's new configuration.
+This is achieved very simply by having
+# Make ourself one-shot
+sv o .
+at the very beginning of fw/run script, not at the end.
+Therefore, any "sv u /var/run/service/fw" command by any other
+script "undoes" o(ne-shot) command if fw still runs, thus
+runsv will rerun it; or start it in a normal way if fw is not running.
+
+System administrators are expected to edit fw/run script, since
+network configuration needs are likely to be very complex and different
+for non-trivial installations.
diff --git a/ap/app/busybox/src/examples/var_service/dhcp_if/convert2ipconf b/ap/app/busybox/src/examples/var_service/dhcp_if/convert2ipconf
new file mode 100755
index 0000000..62a288e
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/dhcp_if/convert2ipconf
@@ -0,0 +1,41 @@
+#!/bin/sh
+# convert:
+
+# dhcptype=5
+# serverid=172.16.42.102
+# lease=97200
+# interface=eth0
+# ip=172.16.42.177
+# subnet=255.255.255.0
+# mask=24
+# broadcast=172.16.22.255
+# router=172.16.42.98
+# dns=10.34.32.125 10.32.63.5 10.34.255.7 10.11.255.27
+# domain=lab.example.com example.com
+# ntpsrv=10.34.32.125 10.34.255.7
+
+# into:
+
+#let cfg=cfg+1
+#if[$cfg]=...; ip[$cfg]=...; ipmask[$cfg]=.../...; gw[$cfg]=...; net[$cfg]=... dns[$cfg]=...
+
+exec >/dev/null
+#exec >"$0.out" # debug
+exec 2>&1
+
+test "$interface" || exit 1
+test "$ip" || exit 1
+
+{
+echo "let cfg=cfg+1"
+test "$interface" && echo "if[\$cfg]='$interface'"
+test "$ip" && echo "ip[\$cfg]='$ip'"
+test "$ip" && test "$mask" \
+ && echo "ipmask[\$cfg]='$ip/$mask'"
+test "$router" && echo "gw[\$cfg]='$router'"
+test "$dns" && echo "dns[\$cfg]='$dns'"
+# TODO: I never saw a dhcp server which correctly announces
+# which subnet(s) is/are available thru advertised router
+# Assume 0/0
+echo "net[\$cfg]='0/0'"
+} >"$1"
diff --git a/ap/app/busybox/src/examples/var_service/dhcp_if/convert2ntpconf b/ap/app/busybox/src/examples/var_service/dhcp_if/convert2ntpconf
new file mode 100755
index 0000000..debf1eb
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/dhcp_if/convert2ntpconf
@@ -0,0 +1,34 @@
+#!/bin/sh
+# convert:
+
+# dhcptype=5
+# serverid=172.16.42.102
+# lease=97200
+# interface=eth0
+# ip=172.16.42.177
+# subnet=255.255.255.0
+# mask=24
+# broadcast=172.16.22.255
+# router=172.16.42.98
+# dns=10.34.32.125 10.32.63.5 10.34.255.7 10.11.255.27
+# domain=lab.example.com example.com
+# ntpsrv=10.34.32.125 10.34.255.7
+
+# into:
+
+#let cfg=cfg+1
+#ntpip[$cfg]=...
+
+exec >/dev/null
+#exec >"$0.out" # debug
+exec 2>&1
+
+test "$interface" || exit 1
+test "$ip" || exit 1
+
+{
+for n in $ntpsrv; do
+ echo "let cfg=cfg+1"
+ echo "ntpip[\$cfg]='$n'";
+done
+} >"$1"
diff --git a/ap/app/busybox/src/examples/var_service/dhcp_if/dhcp_handler b/ap/app/busybox/src/examples/var_service/dhcp_if/dhcp_handler
new file mode 100755
index 0000000..927e02a
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/dhcp_if/dhcp_handler
@@ -0,0 +1,83 @@
+#!/bin/sh
+# executed by udhcpc
+# parameters: $1 and environment
+# $1 is:
+#
+# deconfig: udhcpc starts, or lease is lost.
+# Environment example: interface=eth0
+#
+# bound: lease is obtained. Environment example:
+# dhcptype=5
+# serverid=172.16.42.102
+# lease=97200
+# interface=eth0
+# ip=172.16.42.177
+# subnet=255.255.255.0
+# mask=24
+# broadcast=172.16.22.255
+# router=172.16.42.98
+# dns=10.34.32.125 10.32.63.5 10.34.255.7 10.11.255.27
+# domain=lab.example.com example.com
+# ntpsrv=10.34.32.125 10.34.255.7
+#
+# renew: lease is renewed. Environment is similar to "bound".
+# The IP address does not change, however, the other DHCP paramaters,
+# such as the default gateway, subnet mask, and dns server may change.
+#
+# nak: udhcpc received a NAK message.
+# Environment example: interface=eth0
+#
+# leasefail: udhcpc cannot obtain a lease (DHCP server not responding, etc).
+# Environment example: interface=eth0
+
+# TODO: put $domain into /etc/resolv.conf (thru /var/service/fw)
+
+service=${PWD##*/}
+file_ipconf="$service.ipconf"
+file_ntpconf="$service.ntpconf"
+dir_ipconf="/var/run/service/fw"
+dir_ntpconf="/var/run/service/ntp"
+
+exec >/dev/null
+#exec >>"$0.out" #debug
+exec 2>&1
+
+echo "`date`: Params: $*"
+
+if test x"$1" != x"bound" && test x"$1" != x"renew" ; then
+ # Reconfigure network with this interface disabled
+ echo "Deconfiguring"
+ rm "$service.out"
+ rm "$file_ipconf"
+ rm "$file_ntpconf"
+ rm "$dir_ipconf/$file_ipconf"
+ rm "$dir_ntpconf/$file_ntpconf"
+ sv u /var/service/fw
+ exit
+fi
+
+# Bound: we've got the lease
+#env >"$service.out" # debug
+
+./convert2ipconf "$file_ipconf"
+# Reconfigure routing and firewall if needed
+diff --brief "$file_ipconf" "$dir_ipconf/$file_ipconf" >/dev/null 2>&1
+if test $? != 0; then
+ echo "Reconfiguring fw"
+ mkdir -p "$dir_ipconf" 2>/dev/null
+ cp "$file_ipconf" "$dir_ipconf/$file_ipconf"
+ sv u /var/service/fw
+fi
+
+if test -d /var/service/ntp; then
+ ./convert2ntpconf "$file_ntpconf"
+ # Reconfigure ntp server addresses if needed
+ diff --brief "$file_ntpconf" "$dir_ntpconf/$file_ntpconf" >/dev/null 2>&1
+ if test $? != 0; then
+ echo "Reconfiguring ntp"
+ mkdir -p "$dir_ntpconf" 2>/dev/null
+ cp "$file_ntpconf" "$dir_ntpconf/$file_ntpconf"
+ sv t /var/service/ntp
+ sv u /var/service/ntp
+ fi
+fi
diff --git a/ap/app/busybox/src/examples/var_service/dhcp_if/log/run b/ap/app/busybox/src/examples/var_service/dhcp_if/log/run
new file mode 100755
index 0000000..560d1b1
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/dhcp_if/log/run
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+user=logger
+
+logdir="/var/log/service/`(cd ..;basename $PWD)`"
+mkdir -p "$logdir" 2>/dev/null
+chown -R "$user": "$logdir"
+chmod -R go-rwxst,u+rwX "$logdir"
+rm logdir
+ln -s "$logdir" logdir
+
+# make this dir accessible to logger
+chmod a+rX .
+
+exec >/dev/null
+exec 2>&1
+exec \
+env - PATH="$PATH" \
+softlimit \
+setuidgid "$user" \
+svlogd -tt "$logdir"
diff --git a/ap/app/busybox/src/examples/var_service/dhcp_if/p_log b/ap/app/busybox/src/examples/var_service/dhcp_if/p_log
new file mode 100755
index 0000000..a2521be
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/dhcp_if/p_log
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd log/logdir || exit 1
+cat @* current | $PAGER
diff --git a/ap/app/busybox/src/examples/var_service/dhcp_if/run b/ap/app/busybox/src/examples/var_service/dhcp_if/run
new file mode 100755
index 0000000..aec79e0
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/dhcp_if/run
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+exec 2>&1
+exec </dev/null
+
+pwd="$PWD"
+
+if="${PWD##*/dhcp_}"
+
+echo "* Upping iface $if"
+ip link set dev "$if" up
+
+echo "* Starting udhcpc"
+exec \
+env - PATH="$PATH" \
+softlimit \
+setuidgid root \
+udhcpc -vv \
+--hostname=null \
+--foreground \
+--interface="$if" \
+--pidfile="$pwd/udhcpc.pid" \
+--script="$pwd/dhcp_handler"
diff --git a/ap/app/busybox/src/examples/var_service/dhcp_if/w_log b/ap/app/busybox/src/examples/var_service/dhcp_if/w_log
new file mode 100755
index 0000000..aa36ef1
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/dhcp_if/w_log
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd log/logdir || exit 1
+watch -n2 'w=`ttysize w`; h=`ttysize h`; tail -$((h-3)) current 2>&1 | cut -b1-$((w-2))'
diff --git a/ap/app/busybox/src/examples/var_service/dhcp_if_pinger/run b/ap/app/busybox/src/examples/var_service/dhcp_if_pinger/run
new file mode 100755
index 0000000..20b2fc5
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/dhcp_if_pinger/run
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+delay=67
+
+if=${PWD##*/dhcp_}
+if=${if%%_pinger}
+
+if test -f "$0.log"; then
+ tail -999 "$0.log" >"$0.log.new"
+ mv "$0.log.new" "$0.log"
+fi
+
+test -f "/var/service/dhcp_$if/dhcp_$if.out" || exec env - sleep "$delay"
+. "/var/service/dhcp_$if/dhcp_$if.out"
+test x"$router" != x"" || exec env - sleep "$delay"
+
+#echo "`date '+%Y-%m-%d %H:%M:%S'` Testing ping -c3 $router" >>"$0.log"
+ping -c3 "$router" && exec env - sleep "$delay"
+
+echo "`date '+%Y-%m-%d %H:%M:%S'` Restarting /var/service/dhcp_$if" >>"$0.log"
+sv t "/var/service/dhcp_$if"
+
+exec env - sleep "$delay"
diff --git a/ap/app/busybox/src/examples/var_service/ftpd/log/run b/ap/app/busybox/src/examples/var_service/ftpd/log/run
new file mode 100755
index 0000000..560d1b1
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/ftpd/log/run
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+user=logger
+
+logdir="/var/log/service/`(cd ..;basename $PWD)`"
+mkdir -p "$logdir" 2>/dev/null
+chown -R "$user": "$logdir"
+chmod -R go-rwxst,u+rwX "$logdir"
+rm logdir
+ln -s "$logdir" logdir
+
+# make this dir accessible to logger
+chmod a+rX .
+
+exec >/dev/null
+exec 2>&1
+exec \
+env - PATH="$PATH" \
+softlimit \
+setuidgid "$user" \
+svlogd -tt "$logdir"
diff --git a/ap/app/busybox/src/examples/var_service/ftpd/p_log b/ap/app/busybox/src/examples/var_service/ftpd/p_log
new file mode 100755
index 0000000..a2521be
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/ftpd/p_log
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd log/logdir || exit 1
+cat @* current | $PAGER
diff --git a/ap/app/busybox/src/examples/var_service/ftpd/run b/ap/app/busybox/src/examples/var_service/ftpd/run
new file mode 100755
index 0000000..87b7d2b
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/ftpd/run
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#exec >/dev/null
+exec 2>&1
+exec </dev/null
+
+user=www
+user=root
+
+exec \
+env - PATH="$PATH" \
+softlimit \
+tcpsvd \
+ -vE -l 0 -c 40 \
+ 0.0.0.0 21 \
+setuidgid "$user" \
+ftpd -vv -t10 /pub/ftpd_root
diff --git a/ap/app/busybox/src/examples/var_service/ftpd/w_log b/ap/app/busybox/src/examples/var_service/ftpd/w_log
new file mode 100755
index 0000000..aa36ef1
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/ftpd/w_log
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd log/logdir || exit 1
+watch -n2 'w=`ttysize w`; h=`ttysize h`; tail -$((h-3)) current 2>&1 | cut -b1-$((w-2))'
diff --git a/ap/app/busybox/src/examples/var_service/fw/conf/11.22.33.44.ipconf-- b/ap/app/busybox/src/examples/var_service/fw/conf/11.22.33.44.ipconf--
new file mode 100644
index 0000000..9b44e90
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/fw/conf/11.22.33.44.ipconf--
@@ -0,0 +1,10 @@
+#!/bin/sh
+# If we have simple static address...
+#
+let cfg=cfg+1
+if[$cfg]=if
+ip[$cfg]=11.22.33.44
+ipmask[$cfg]=11.22.33.44/24
+gw[$cfg]=11.22.33.1
+net[$cfg]=0/0
+dns[$cfg]='11.22.33.2 11.22.33.3'
diff --git a/ap/app/busybox/src/examples/var_service/fw/conf/192.168.0.1.ipconf b/ap/app/busybox/src/examples/var_service/fw/conf/192.168.0.1.ipconf
new file mode 100644
index 0000000..5cf55db
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/fw/conf/192.168.0.1.ipconf
@@ -0,0 +1,11 @@
+#!/bin/sh
+# A small network with no routers
+# (maybe *we* are their router)
+#
+let cfg=cfg+1
+if[$cfg]=if
+ip[$cfg]=192.168.0.1
+ipmask[$cfg]=192.168.0.1/24
+### gw[$cfg]=
+### net[$cfg]=0/0
+### dns[$cfg]=''
diff --git a/ap/app/busybox/src/examples/var_service/fw/conf/lo.ipconf b/ap/app/busybox/src/examples/var_service/fw/conf/lo.ipconf
new file mode 100644
index 0000000..e6be5f0
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/fw/conf/lo.ipconf
@@ -0,0 +1,10 @@
+#!/bin/bash
+# Mostly redundant except when you need dns[]=your_static_dns_srv
+#
+let cfg=cfg+1
+if[$cfg]=lo
+ip[$cfg]=127.0.0.1
+ipmask[$cfg]=127.0.0.1/8
+gw[$cfg]=''
+net[$cfg]=''
+#dns[$cfg]=127.0.0.1
diff --git a/ap/app/busybox/src/examples/var_service/fw/etc/hosts b/ap/app/busybox/src/examples/var_service/fw/etc/hosts
new file mode 100644
index 0000000..f7ee533
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/fw/etc/hosts
@@ -0,0 +1,21 @@
+#!/bin/sh
+echo "\
+# This file is automagically regenerated
+# Note! /etc/nsswitch.conf may override this!
+
+# For loopbacking
+127.0.0.1 localhost
+
+# Our local IPs"
+
+hostname=`hostname`
+test "$hostname" || hostname=localhost
+domain=`(. /boot.conf; echo "$DNSDOMAINNAME")`
+test "$domain" && hostname="$hostname $hostname.$domain"
+
+ip -o a l \
+| grep -F 'inet ' \
+| sed -e 's/^.*inet //' -e 's:[ /].*$: '"$hostname"':'
+
+echo
+echo "# End of /etc/hosts"
diff --git a/ap/app/busybox/src/examples/var_service/fw/etc/resolv.conf b/ap/app/busybox/src/examples/var_service/fw/etc/resolv.conf
new file mode 100644
index 0000000..6561987
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/fw/etc/resolv.conf
@@ -0,0 +1,31 @@
+#!/bin/bash
+
+domain=`(. /boot.conf; echo "$DNSDOMAINNAME") 2>/dev/null`
+
+echo "# This file is automagically regenerated with each boot"
+echo
+test "$domain" && echo "domain $domain"
+test "$domain" && echo "search $domain"
+echo
+echo "# Note that nslookup can choke on DNS server which itself"
+echo "# does NOT have domain name. Other things can work fine."
+echo
+# # If we run DNS cache:
+# echo "nameserver 127.0.0.1"
+# exit
+
+prio=0
+i=0; while test "${if[$i]}"; do
+ test x"${dns_prio[$i]}" != x"" \
+ && test "${dns_prio[$i]}" -gt "$prio" \
+ && prio="${dns_prio[$i]}"
+let i++; done
+
+i=0; while test "${if[$i]}"; do
+ for d in ${dns[$i]}; do
+ p="${dns_prio[$i]}"
+ test x"$p" == x"" && p=0
+ test x"$p" == x"$prio" || continue
+ echo "nameserver $d"
+ done
+let i++; done
diff --git a/ap/app/busybox/src/examples/var_service/fw/run b/ap/app/busybox/src/examples/var_service/fw/run
new file mode 100755
index 0000000..396b678
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/fw/run
@@ -0,0 +1,211 @@
+#!/bin/bash
+# (using bashism: arrays)
+
+service="${PWD##*/}"
+rundir="/var/run/service/$service"
+
+user=root
+extif=if
+ext_open_tcp="21 22 80" # space-separated
+
+# Make ourself one-shot
+sv o .
+# Debug
+#date '+%Y-%m-%d %H:%M:%S' >>"$0.log"
+
+### filter This is the default table (if no -t option is passed). It contains
+### the built-in chains INPUT (for packets coming into the box itself),
+### FORWARD (for packets being routed through the box), and OUTPUT (for
+### locally-generated packets).
+###
+### nat This table is consulted when a packet that creates a new connection
+### is encountered. It consists of three built-ins: PREROUTING (for
+### altering packets as soon as they come in), OUTPUT (for altering
+### locally-generated packets before routing), and POSTROUTING (for
+### altering packets as they are about to go out).
+###
+### mangle It had two built-in chains: PREROUTING (for altering incoming
+### packets before routing) and OUTPUT (for altering locally-generated
+### packets before routing). Recently three other built-in
+### chains are added: INPUT (for packets coming into the box
+### itself), FORWARD (for altering packets being routed through the
+### box), and POSTROUTING (for altering packets as they are about to go
+### out).
+###
+### ...iface... ...iface...
+### | ^
+### v |
+### -mangle,NAT- -mangle,filter- -mangle,NAT--
+### |PREROUTING|-->[Routing]-->|FORWARD |-->|POSTROUTING|
+### ------------ | ^ --------------- -------------
+### | | ^
+### | +--if NATed------------+ |
+### v | |
+### -mangle,filter- -mangle,NAT,filter-
+### |INPUT | +->[Routing]->|OUTPUT |
+### --------------- | -------------------
+### | |
+### v |
+### ... Local Process...
+
+doit() {
+ echo "# $*"
+ "$@"
+}
+
+#exec >/dev/null
+exec >"$0.out"
+exec 2>&1
+exec </dev/null
+
+umask 077
+
+# Make sure rundir/ exists
+mkdir -p "$rundir" 2>/dev/null
+chown -R "$user:" "$rundir"
+chmod -R a=rX "$rundir"
+rm -rf rundir 2>/dev/null
+ln -s "$rundir" rundir
+
+# Timestamping
+date '+%Y-%m-%d %H:%M:%S'
+
+
+echo; echo "* Reading IP config"
+cfg=-1
+# static cfg dhcp,zeroconf etc
+for ipconf in conf/*.ipconf "$rundir"/*.ipconf; do
+ if test -f "$ipconf"; then
+ echo "+ $ipconf"
+ . "$ipconf"
+ fi
+done
+
+echo; echo "* Configuring hardware"
+#doit ethtool -s if autoneg off speed 100 duplex full
+#doit ethtool -K if rx off tx off sg off tso off
+
+echo; echo "* Resetting address and routing info"
+doit ip a f dev lo
+i=0; while test "${if[$i]}"; do
+ doit ip a f dev "${if[$i]}"
+ doit ip r f dev "${if[$i]}" root 0/0
+let i++; done
+
+echo; echo "* Configuring addresses"
+doit ip a a dev lo 127.0.0.1/8 scope host
+doit ip a a dev lo ::1/128 scope host
+i=0; while test "${if[$i]}"; do
+ if test "${ipmask[$i]}"; then
+ doit ip a a dev "${if[$i]}" "${ipmask[$i]}" brd +
+ doit ip l set dev "${if[$i]}" up
+ fi
+let i++; done
+
+echo; echo "* Configuring routes"
+i=0; while test "${if[$i]}"; do
+ if test "${net[$i]}" && test "${gw[$i]}"; then
+ doit ip r a "${net[$i]}" via "${gw[$i]}"
+ fi
+let i++; done
+
+echo; echo "* Recreating /etc/* files reflecting new network configuration:"
+for i in etc/*; do
+ n=`basename "$i"`
+ echo "+ $n"
+ (. "$i") >"/etc/$n"
+ chmod 644 "/etc/$n"
+done
+
+
+# Usage: new_chain <chain> [<table>]
+new_chain() {
+ local t=""
+ test x"$2" != x"" && t="-t $2"
+ doit iptables $t -N $1
+ ipt="iptables $t -A $1"
+}
+
+echo; echo "* Reset iptables"
+doit iptables --flush
+doit iptables --delete-chain
+doit iptables --zero
+doit iptables -t nat --flush
+doit iptables -t nat --delete-chain
+doit iptables -t nat --zero
+doit iptables -t mangle --flush
+doit iptables -t mangle --delete-chain
+doit iptables -t mangle --zero
+
+echo; echo "* Configure iptables"
+doit modprobe nf_nat_ftp
+doit modprobe nf_nat_tftp
+doit modprobe nf_conntrack_ftp
+doit modprobe nf_conntrack_tftp
+
+# *** nat ***
+# INCOMING TRAFFIC
+ipt="iptables -t nat -A PREROUTING"
+# nothing here
+
+# LOCALLY ORIGINATED TRAFFIC
+ipt="iptables -t nat -A OUTPUT"
+# nothing here
+
+# OUTGOING TRAFFIC
+ipt="iptables -t nat -A POSTROUTING"
+# Masquerade boxes on my private net
+doit $ipt -s 192.168.0.0/24 -o $extif -j MASQUERADE
+
+# *** mangle ***
+### DEBUG
+### ipt="iptables -t mangle -A PREROUTING"
+### doit $ipt -s 192.168.0.0/24 -j RETURN
+### ipt="iptables -t mangle -A FORWARD"
+### doit $ipt -s 192.168.0.0/24 -j RETURN
+### ipt="iptables -t mangle -A POSTROUTING"
+### doit $ipt -s 192.168.0.0/24 -j RETURN
+# nothing here
+
+# *** filter ***
+#
+new_chain iext filter
+#doit $ipt -s 203.177.104.72 -j DROP # Some idiot probes my ssh
+#doit $ipt -d 203.177.104.72 -j DROP # Some idiot probes my ssh
+doit $ipt -m state --state ESTABLISHED,RELATED -j RETURN # FTP data etc is ok
+if test "$ext_open_tcp"; then
+ portlist="${ext_open_tcp// /,}"
+ doit $ipt -p tcp -m multiport --dports $portlist -j RETURN
+fi
+doit $ipt -p tcp -j REJECT # Anything else isn't ok. REJECT = irc opens faster
+ # (it probes proxy ports, DROP will incur timeout delays)
+ipt="iptables -t filter -A INPUT"
+doit $ipt -i $extif -j iext
+
+
+echo; echo "* Enabling forwarding"
+echo 1 >/proc/sys/net/ipv4/ip_forward
+echo "/proc/sys/net/ipv4/ip_forward: `cat /proc/sys/net/ipv4/ip_forward`"
+
+
+# Signal everybody that firewall is up
+date '+%Y-%m-%d %H:%M:%S' >"$rundir/up"
+
+# Ok, spew out gobs of info and disable ourself
+echo; echo "* IP:"
+ip a l
+echo; echo "* Routing:"
+ip r l
+echo; echo "* Firewall:"
+{
+echo '---FILTER--';
+iptables -v -L -x -n;
+echo '---NAT-----';
+iptables -t nat -v -L -x -n;
+echo '---MANGLE--';
+iptables -t mangle -v -L -x -n;
+} \
+| grep -v '^$' | grep -Fv 'bytes target'
+echo
+
+echo "* End of firewall configuration"
diff --git a/ap/app/busybox/src/examples/var_service/fw/stat b/ap/app/busybox/src/examples/var_service/fw/stat
new file mode 100755
index 0000000..08736ad
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/fw/stat
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+echo; echo "* Firewall:"
+{
+echo '---FILTER--';
+iptables -v -L -x -n;
+echo '---NAT-----';
+iptables -t nat -v -L -x -n;
+echo '---MANGLE--';
+iptables -t mangle -v -L -x -n;
+} \
+| grep -v '^$' | grep -Fv 'bytes target' | $PAGER
diff --git a/ap/app/busybox/src/examples/var_service/getty_tty1/alt08x16+unimap.fnt b/ap/app/busybox/src/examples/var_service/getty_tty1/alt08x16+unimap.fnt
new file mode 100644
index 0000000..9bcc457
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/getty_tty1/alt08x16+unimap.fnt
Binary files differ
diff --git a/ap/app/busybox/src/examples/var_service/getty_tty1/cfg b/ap/app/busybox/src/examples/var_service/getty_tty1/cfg
new file mode 100755
index 0000000..0f63e52
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/getty_tty1/cfg
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+if test x"$TERM" = x"" -o x"$TERM" = x"unknown"; then
+ TERM="linux"
+ echo "* Setting TERM='$TERM'"
+fi
+export TERM
+
+ttyname=`tty`
+ttybase="${ttyname%%[0123456789]*}" # strip numeric tail
+
+if test x"$ttybase" = x"/dev/vc/" -o x"$ttybase" = x"/dev/tty"; then
+ echo "* Activating Cyrillic KOI8-R -> CP866 font map"
+ echo -ne "\033(K" >"$ttyname"
+
+ echo "* Loading screen font"
+ setfont \
+ -C "$ttyname" \
+ -m "$PWD/koi8r_to_uni.trans" \
+ "$PWD/alt08x16+unimap.fnt" \
+ || echo "! setfont failure"
+
+ echo "* Loading keymap"
+ loadkeys "$PWD/ru_koi8r.keymap" \
+ || echo "! loadkeys failure"
+fi
diff --git a/ap/app/busybox/src/examples/var_service/getty_tty1/koi8r_to_uni.trans b/ap/app/busybox/src/examples/var_service/getty_tty1/koi8r_to_uni.trans
new file mode 100644
index 0000000..6c6bd01
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/getty_tty1/koi8r_to_uni.trans
@@ -0,0 +1,256 @@
+0x00 U+0000 # NULL (NUL)
+0x01 U+0001 # START OF HEADING (SOH)
+0x02 U+0002 # START OF TEXT (STX)
+0x03 U+0003 # END OF TEXT (ETX)
+0x04 U+0004 # END OF TRANSMISSION (EOT)
+0x05 U+0005 # ENQUIRY (ENQ)
+0x06 U+0006 # ACKNOWLEDGE (ACK)
+0x07 U+0007 # BELL (BEL)
+0x08 U+0008 # BACKSPACE (BS)
+0x09 U+0009 # CHARACTER TABULATION (HT)
+0x0a U+000A # LINE FEED (LF)
+0x0b U+000B # LINE TABULATION (VT)
+0x0c U+000C # FORM FEED (FF)
+0x0d U+000D # CARRIAGE RETURN (CR)
+0x0e U+000E # SHIFT OUT (SO)
+0x0f U+000F # SHIFT IN (SI)
+0x10 U+0010 # DATALINK ESCAPE (DLE)
+0x11 U+0011 # DEVICE CONTROL ONE (DC1)
+0x12 U+0012 # DEVICE CONTROL TWO (DC2)
+0x13 U+0013 # DEVICE CONTROL THREE (DC3)
+0x14 U+0014 # DEVICE CONTROL FOUR (DC4)
+0x15 U+0015 # NEGATIVE ACKNOWLEDGE (NAK)
+0x16 U+0016 # SYNCHRONOUS IDLE (SYN)
+0x17 U+0017 # END OF TRANSMISSION BLOCK (ETB)
+0x18 U+0018 # CANCEL (CAN)
+0x19 U+0019 # END OF MEDIUM (EM)
+0x1a U+001A # SUBSTITUTE (SUB)
+0x1b U+001B # ESCAPE (ESC)
+0x1c U+001C # FILE SEPARATOR (IS4)
+0x1d U+001D # GROUP SEPARATOR (IS3)
+0x1e U+001E # RECORD SEPARATOR (IS2)
+0x1f U+001F # UNIT SEPARATOR (IS1)
+0x20 U+0020 # SPACE
+0x21 U+0021 # EXCLAMATION MARK
+0x22 U+0022 # QUOTATION MARK
+0x23 U+0023 # NUMBER SIGN
+0x24 U+0024 # DOLLAR SIGN
+0x25 U+0025 # PERCENT SIGN
+0x26 U+0026 # AMPERSAND
+0x27 U+0027 # APOSTROPHE
+0x28 U+0028 # LEFT PARENTHESIS
+0x29 U+0029 # RIGHT PARENTHESIS
+0x2a U+002A # ASTERISK
+0x2b U+002B # PLUS SIGN
+0x2c U+002C # COMMA
+0x2d U+002D # HYPHEN-MINUS
+0x2e U+002E # FULL STOP
+0x2f U+002F # SOLIDUS
+0x30 U+0030 # DIGIT ZERO
+0x31 U+0031 # DIGIT ONE
+0x32 U+0032 # DIGIT TWO
+0x33 U+0033 # DIGIT THREE
+0x34 U+0034 # DIGIT FOUR
+0x35 U+0035 # DIGIT FIVE
+0x36 U+0036 # DIGIT SIX
+0x37 U+0037 # DIGIT SEVEN
+0x38 U+0038 # DIGIT EIGHT
+0x39 U+0039 # DIGIT NINE
+0x3a U+003A # COLON
+0x3b U+003B # SEMICOLON
+0x3c U+003C # LESS-THAN SIGN
+0x3d U+003D # EQUALS SIGN
+0x3e U+003E # GREATER-THAN SIGN
+0x3f U+003F # QUESTION MARK
+0x40 U+0040 # COMMERCIAL AT
+0x41 U+0041 # LATIN CAPITAL LETTER A
+0x42 U+0042 # LATIN CAPITAL LETTER B
+0x43 U+0043 # LATIN CAPITAL LETTER C
+0x44 U+0044 # LATIN CAPITAL LETTER D
+0x45 U+0045 # LATIN CAPITAL LETTER E
+0x46 U+0046 # LATIN CAPITAL LETTER F
+0x47 U+0047 # LATIN CAPITAL LETTER G
+0x48 U+0048 # LATIN CAPITAL LETTER H
+0x49 U+0049 # LATIN CAPITAL LETTER I
+0x4a U+004A # LATIN CAPITAL LETTER J
+0x4b U+004B # LATIN CAPITAL LETTER K
+0x4c U+004C # LATIN CAPITAL LETTER L
+0x4d U+004D # LATIN CAPITAL LETTER M
+0x4e U+004E # LATIN CAPITAL LETTER N
+0x4f U+004F # LATIN CAPITAL LETTER O
+0x50 U+0050 # LATIN CAPITAL LETTER P
+0x51 U+0051 # LATIN CAPITAL LETTER Q
+0x52 U+0052 # LATIN CAPITAL LETTER R
+0x53 U+0053 # LATIN CAPITAL LETTER S
+0x54 U+0054 # LATIN CAPITAL LETTER T
+0x55 U+0055 # LATIN CAPITAL LETTER U
+0x56 U+0056 # LATIN CAPITAL LETTER V
+0x57 U+0057 # LATIN CAPITAL LETTER W
+0x58 U+0058 # LATIN CAPITAL LETTER X
+0x59 U+0059 # LATIN CAPITAL LETTER Y
+0x5a U+005A # LATIN CAPITAL LETTER Z
+0x5b U+005B # LEFT SQUARE BRACKET
+0x5c U+005C # REVERSE SOLIDUS
+0x5d U+005D # RIGHT SQUARE BRACKET
+0x5e U+005E # CIRCUMFLEX ACCENT
+0x5f U+005F # LOW LINE
+0x60 U+0060 # GRAVE ACCENT
+0x61 U+0061 # LATIN SMALL LETTER A
+0x62 U+0062 # LATIN SMALL LETTER B
+0x63 U+0063 # LATIN SMALL LETTER C
+0x64 U+0064 # LATIN SMALL LETTER D
+0x65 U+0065 # LATIN SMALL LETTER E
+0x66 U+0066 # LATIN SMALL LETTER F
+0x67 U+0067 # LATIN SMALL LETTER G
+0x68 U+0068 # LATIN SMALL LETTER H
+0x69 U+0069 # LATIN SMALL LETTER I
+0x6a U+006A # LATIN SMALL LETTER J
+0x6b U+006B # LATIN SMALL LETTER K
+0x6c U+006C # LATIN SMALL LETTER L
+0x6d U+006D # LATIN SMALL LETTER M
+0x6e U+006E # LATIN SMALL LETTER N
+0x6f U+006F # LATIN SMALL LETTER O
+0x70 U+0070 # LATIN SMALL LETTER P
+0x71 U+0071 # LATIN SMALL LETTER Q
+0x72 U+0072 # LATIN SMALL LETTER R
+0x73 U+0073 # LATIN SMALL LETTER S
+0x74 U+0074 # LATIN SMALL LETTER T
+0x75 U+0075 # LATIN SMALL LETTER U
+0x76 U+0076 # LATIN SMALL LETTER V
+0x77 U+0077 # LATIN SMALL LETTER W
+0x78 U+0078 # LATIN SMALL LETTER X
+0x79 U+0079 # LATIN SMALL LETTER Y
+0x7a U+007A # LATIN SMALL LETTER Z
+0x7b U+007B # LEFT CURLY BRACKET
+0x7c U+007C # VERTICAL LINE
+0x7d U+007D # RIGHT CURLY BRACKET
+0x7e U+007E # TILDE
+0x7f U+007F # DELETE (DEL)
+0x80 U+2500 # BOX DRAWINGS LIGHT HORIZONTAL
+0x81 U+2502 # BOX DRAWINGS LIGHT VERTICAL
+0x82 U+250C # BOX DRAWINGS LIGHT DOWN AND RIGHT
+0x83 U+2510 # BOX DRAWINGS LIGHT DOWN AND LEFT
+0x84 U+2514 # BOX DRAWINGS LIGHT UP AND RIGHT
+0x85 U+2518 # BOX DRAWINGS LIGHT UP AND LEFT
+0x86 U+251C # BOX DRAWINGS LIGHT VERTICAL AND RIGHT
+0x87 U+2524 # BOX DRAWINGS LIGHT VERTICAL AND LEFT
+0x88 U+252C # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL
+0x89 U+2534 # BOX DRAWINGS LIGHT UP AND HORIZONTAL
+0x8a U+253C # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL
+0x8b U+2580 # UPPER HALF BLOCK
+0x8c U+2584 # LOWER HALF BLOCK
+0x8d U+2588 # FULL BLOCK
+0x8e U+258C # LEFT HALF BLOCK
+0x8f U+2590 # RIGHT HALF BLOCK
+0x90 U+2591 # LIGHT SHADE
+0x91 U+2592 # MEDIUM SHADE
+0x92 U+2593 # DARK SHADE
+0x93 U+2320 # TOP HALF INTEGRAL
+0x94 U+25A0 # BLACK SQUARE
+0x95 U+2219 # BULLET OPERATOR
+0x96 U+221A # SQUARE ROOT
+0x97 U+2248 # ALMOST EQUAL TO
+0x98 U+2264 # LESS-THAN OR EQUAL TO
+0x99 U+2265 # GREATER-THAN OR EQUAL TO
+0x9a U+00A0 # NO-BREAK SPACE
+0x9b U+2321 # BOTTOM HALF INTEGRAL
+0x9c U+00B0 # DEGREE SIGN
+0x9d U+00B2 # SUPERSCRIPT TWO
+0x9e U+00B7 # MIDDLE DOT
+0x9f U+00F7 # DIVISION SIGN
+0xa0 U+2550 # BOX DRAWINGS DOUBLE HORIZONTAL
+0xa1 U+2551 # BOX DRAWINGS DOUBLE VERTICAL
+0xa2 U+2552 # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE
+0xa3 U+0451 # CYRILLIC SMALL LETTER IO
+0xa4 U+2553 # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE
+0xa5 U+2554 # BOX DRAWINGS DOUBLE DOWN AND RIGHT
+0xa6 U+2555 # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE
+0xa7 U+2556 # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE
+0xa8 U+2557 # BOX DRAWINGS DOUBLE DOWN AND LEFT
+0xa9 U+2558 # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE
+0xaa U+2559 # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE
+0xab U+255A # BOX DRAWINGS DOUBLE UP AND RIGHT
+0xac U+255B # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE
+0xad U+255C # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE
+0xae U+255D # BOX DRAWINGS DOUBLE UP AND LEFT
+0xaf U+255E # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE
+0xb0 U+255F # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE
+0xb1 U+2560 # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT
+0xb2 U+2561 # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE
+0xb3 U+0401 # CYRILLIC CAPITAL LETTER IO
+0xb4 U+2562 # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE
+0xb5 U+2563 # BOX DRAWINGS DOUBLE VERTICAL AND LEFT
+0xb6 U+2564 # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE
+0xb7 U+2565 # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE
+0xb8 U+2566 # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL
+0xb9 U+2567 # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE
+0xba U+2568 # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE
+0xbb U+2569 # BOX DRAWINGS DOUBLE UP AND HORIZONTAL
+0xbc U+256A # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE
+0xbd U+256B # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE
+0xbe U+256C # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL
+0xbf U+00A9 # COPYRIGHT SIGN
+0xc0 U+044E # CYRILLIC SMALL LETTER YU
+0xc1 U+0430 # CYRILLIC SMALL LETTER A
+0xc2 U+0431 # CYRILLIC SMALL LETTER BE
+0xc3 U+0446 # CYRILLIC SMALL LETTER TSE
+0xc4 U+0434 # CYRILLIC SMALL LETTER DE
+0xc5 U+0435 # CYRILLIC SMALL LETTER IE
+0xc6 U+0444 # CYRILLIC SMALL LETTER EF
+0xc7 U+0433 # CYRILLIC SMALL LETTER GHE
+0xc8 U+0445 # CYRILLIC SMALL LETTER HA
+0xc9 U+0438 # CYRILLIC SMALL LETTER I
+0xca U+0439 # CYRILLIC SMALL LETTER SHORT I
+0xcb U+043A # CYRILLIC SMALL LETTER KA
+0xcc U+043B # CYRILLIC SMALL LETTER EL
+0xcd U+043C # CYRILLIC SMALL LETTER EM
+0xce U+043D # CYRILLIC SMALL LETTER EN
+0xcf U+043E # CYRILLIC SMALL LETTER O
+0xd0 U+043F # CYRILLIC SMALL LETTER PE
+0xd1 U+044F # CYRILLIC SMALL LETTER YA
+0xd2 U+0440 # CYRILLIC SMALL LETTER ER
+0xd3 U+0441 # CYRILLIC SMALL LETTER ES
+0xd4 U+0442 # CYRILLIC SMALL LETTER TE
+0xd5 U+0443 # CYRILLIC SMALL LETTER U
+0xd6 U+0436 # CYRILLIC SMALL LETTER ZHE
+0xd7 U+0432 # CYRILLIC SMALL LETTER VE
+0xd8 U+044C # CYRILLIC SMALL LETTER SOFT SIGN
+0xd9 U+044B # CYRILLIC SMALL LETTER YERU
+0xda U+0437 # CYRILLIC SMALL LETTER ZE
+0xdb U+0448 # CYRILLIC SMALL LETTER SHA
+0xdc U+044D # CYRILLIC SMALL LETTER E
+0xdd U+0449 # CYRILLIC SMALL LETTER SHCHA
+0xde U+0447 # CYRILLIC SMALL LETTER CHE
+0xdf U+044A # CYRILLIC SMALL LETTER HARD SIGN
+0xe0 U+042E # CYRILLIC CAPITAL LETTER YU
+0xe1 U+0410 # CYRILLIC CAPITAL LETTER A
+0xe2 U+0411 # CYRILLIC CAPITAL LETTER BE
+0xe3 U+0426 # CYRILLIC CAPITAL LETTER TSE
+0xe4 U+0414 # CYRILLIC CAPITAL LETTER DE
+0xe5 U+0415 # CYRILLIC CAPITAL LETTER IE
+0xe6 U+0424 # CYRILLIC CAPITAL LETTER EF
+0xe7 U+0413 # CYRILLIC CAPITAL LETTER GHE
+0xe8 U+0425 # CYRILLIC CAPITAL LETTER HA
+0xe9 U+0418 # CYRILLIC CAPITAL LETTER I
+0xea U+0419 # CYRILLIC CAPITAL LETTER SHORT I
+0xeb U+041A # CYRILLIC CAPITAL LETTER KA
+0xec U+041B # CYRILLIC CAPITAL LETTER EL
+0xed U+041C # CYRILLIC CAPITAL LETTER EM
+0xee U+041D # CYRILLIC CAPITAL LETTER EN
+0xef U+041E # CYRILLIC CAPITAL LETTER O
+0xf0 U+041F # CYRILLIC CAPITAL LETTER PE
+0xf1 U+042F # CYRILLIC CAPITAL LETTER YA
+0xf2 U+0420 # CYRILLIC CAPITAL LETTER ER
+0xf3 U+0421 # CYRILLIC CAPITAL LETTER ES
+0xf4 U+0422 # CYRILLIC CAPITAL LETTER TE
+0xf5 U+0423 # CYRILLIC CAPITAL LETTER U
+0xf6 U+0416 # CYRILLIC CAPITAL LETTER ZHE
+0xf7 U+0412 # CYRILLIC CAPITAL LETTER VE
+0xf8 U+042C # CYRILLIC CAPITAL LETTER SOFT SIGN
+0xf9 U+042B # CYRILLIC CAPITAL LETTER YERU
+0xfa U+0417 # CYRILLIC CAPITAL LETTER ZE
+0xfb U+0428 # CYRILLIC CAPITAL LETTER SHA
+0xfc U+042D # CYRILLIC CAPITAL LETTER E
+0xfd U+0429 # CYRILLIC CAPITAL LETTER SHCHA
+0xfe U+0427 # CYRILLIC CAPITAL LETTER CHE
+0xff U+042A # CYRILLIC CAPITAL LETTER HARD SIGN
diff --git a/ap/app/busybox/src/examples/var_service/getty_tty1/login.sh b/ap/app/busybox/src/examples/var_service/getty_tty1/login.sh
new file mode 100755
index 0000000..d69b6fd
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/getty_tty1/login.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+ttyname=`tty`
+ttybase="${ttyname%%[0123456789]*}" # strip numeric tail
+
+if test "$ttybase" = "/dev/tty"; then
+ tail="${ttyname:8}"
+ echo "* Setting terminal device's owner to $LOGIN_UID:$LOGIN_GID"
+ chown "$LOGIN_UID:$LOGIN_GID" "/dev/vcs$tail" "/dev/vcsa$tail"
+fi
+# We can do this also, but login does it itself
+# chown "$LOGIN_UID:$LOGIN_GID" "$ttyname"
diff --git a/ap/app/busybox/src/examples/var_service/getty_tty1/ru_koi8r.keymap b/ap/app/busybox/src/examples/var_service/getty_tty1/ru_koi8r.keymap
new file mode 100644
index 0000000..6c81153
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/getty_tty1/ru_koi8r.keymap
@@ -0,0 +1,183 @@
+keymaps 0,1, 2,3, 4,6, 8,10, 12,14
+#
+# This one is for generating koi8r Russian chars
+# Cyr/Lat switches: RightAlt, Shift+Ctrl, Ctrl+Shift
+# (last one does not work for dark and obscure reasons 8( )
+#
+# plain,shift, plain,shift, ctrl,ctrl alt,alt ctrlalt,ctrlalt
+# lat-------- cyr-------- lat cyr lat cyr lat cyr
+#
+#Shift 1
+#AltGr (cyr) 2
+#Control 4
+#Alt 8
+#ShiftL 16
+#ShiftR 32
+#CtrlL 64
+#CtrlR 128
+#============== plain ========= shift========== plain cyr ===== shift cyr ===== ctrl ================== ctrl cyr ============== alt =================== alt cyr =============== ctrlalt =============== ctrlalt cyr ===========
+keycode 1 = Escape Escape Escape Escape Escape Escape Meta_Escape Meta_Escape SAK SAK
+keycode 2 = one exclam one exclam exclam exclam Meta_one Meta_one
+keycode 3 = two at two at nul nul Meta_two Meta_two
+keycode 4 = three numbersign three numbersign three three Meta_three Meta_three
+keycode 5 = four dollar four dollar Control_backslash Control_backslash Meta_four Meta_four
+keycode 6 = five percent five percent Control_bracketright Control_bracketright Meta_five Meta_five
+keycode 7 = six asciicircum six asciicircum Control_asciicircum Control_asciicircum Meta_six Meta_six
+keycode 8 = seven ampersand seven ampersand Control_underscore Control_underscore Meta_seven Meta_seven
+keycode 9 = eight asterisk eight asterisk eight eight Meta_eight Meta_eight
+keycode 10 = nine parenleft nine parenleft nine nine Meta_nine Meta_nine
+keycode 11 = zero parenright zero parenright zero zero Meta_zero Meta_zero
+keycode 12 = minus underscore minus underscore Control_underscore Control_underscore Meta_minus Meta_minus
+keycode 13 = equal plus equal plus equal equal Meta_equal Meta_equal
+keycode 14 = Delete Delete Delete Delete BackSpace BackSpace Meta_Delete Meta_Delete
+keycode 15 = Tab Tab Tab Tab Tab Tab Meta_Tab Meta_Tab
+keycode 16 = q Q 202 234 Control_q Control_q Meta_q Meta_q Meta_Control_q Meta_Control_q
+keycode 17 = w W 195 227 Control_w Control_w Meta_w Meta_w Meta_Control_w Meta_Control_w
+keycode 18 = e E 213 245 Control_e Control_e Meta_e Meta_e Meta_Control_e Meta_Control_e
+keycode 19 = r R 203 235 Control_r Control_r Meta_r Meta_r Meta_Control_r Meta_Control_r
+keycode 20 = t T 197 229 Control_t Control_t Meta_t Meta_t Meta_Control_t Meta_Control_t
+#============== plain ========= shift========== plain cyr ===== shift cyr ===== ctrl ================== ctrl cyr ============== alt =================== alt cyr =============== ctrlalt =============== ctrlalt cyr ===========
+keycode 21 = y Y 206 238 Control_y Control_y Meta_y Meta_y Meta_Control_y Meta_Control_y
+keycode 22 = u U 199 231 Control_u Control_u Meta_u Meta_u Meta_Control_u Meta_Control_u
+keycode 23 = i I 219 251 Control_i Control_i Meta_i Meta_i Meta_Control_i Meta_Control_i
+keycode 24 = o O 221 253 Control_o Control_o Meta_o Meta_o Meta_Control_o Meta_Control_o
+keycode 25 = p P 218 250 Control_p Control_p Meta_p Meta_p Meta_Control_p Meta_Control_p
+keycode 26 = bracketleft braceleft 200 232 Escape Escape Meta_bracketleft Meta_bracketleft
+keycode 27 = bracketright braceright 223 255 Control_bracketright Control_bracketright
+keycode 28 = Return
+# Shift+Ctrl - Cyrillic
+keycode 29 = Control AltGr_Lock Control AltGr_Lock Control Control Control Control Control Control
+keycode 30 = a A 198 230 Control_a Control_a Meta_a Meta_a Meta_Control_a Meta_Control_a
+keycode 31 = s S 217 249 Control_s Control_s Meta_s Meta_s Meta_Control_s Meta_Control_s
+keycode 32 = d D 215 247 Control_d Control_d Meta_d Meta_d Meta_Control_d Meta_Control_d
+keycode 33 = f F 193 225 Control_f Control_f Meta_f Meta_f Meta_Control_f Meta_Control_f
+keycode 34 = g G 208 240 Control_g Control_g Meta_g Meta_g Meta_Control_g Meta_Control_g
+keycode 35 = h H 210 242 Control_h Control_h Meta_h Meta_h Meta_Control_h Meta_Control_h
+keycode 36 = j J 207 239 Control_j Control_j Meta_j Meta_j Meta_Control_j Meta_Control_j
+keycode 37 = k K 204 236 Control_k Control_k Meta_k Meta_k Meta_Control_k Meta_Control_k
+keycode 38 = l L 196 228 Control_l Control_l Meta_l Meta_l Meta_Control_l Meta_Control_l
+keycode 39 = semicolon colon 214 246 semicolon semicolon Meta_semicolon Meta_semicolon
+keycode 40 = apostrophe quotedbl 220 252 Control_g Control_g Meta_apostrophe Meta_apostrophe
+#============== plain ========= shift========== plain cyr ===== shift cyr ===== ctrl ================== ctrl cyr ============== alt =================== alt cyr =============== ctrlalt =============== ctrlalt cyr ===========
+keycode 41 = grave asciitilde grave asciitilde nul nul Meta_grave Meta_grave
+keycode 42 = Shift
+keycode 43 = backslash bar backslash bar Control_backslash Control_backslash Meta_backslash Meta_backslash
+keycode 44 = z Z 209 241 Control_z Control_z Meta_z Meta_z Meta_Control_z Meta_Control_z
+keycode 45 = x X 222 254 Control_x Control_x Meta_x Meta_x Meta_Control_x Meta_Control_x
+keycode 46 = c C 211 243 Control_c Control_c Meta_c Meta_c Meta_Control_c Meta_Control_c
+keycode 47 = v V 205 237 Control_v Control_v Meta_v Meta_v Meta_Control_v Meta_Control_v
+keycode 48 = b B 201 233 Control_b Control_b Meta_b Meta_b Meta_Control_b Meta_Control_b
+keycode 49 = n N 212 244 Control_n Control_n Meta_n Meta_n Meta_Control_n Meta_Control_n
+keycode 50 = m M 216 248 Control_m Control_m Meta_m Meta_m Meta_Control_m Meta_Control_m
+keycode 51 = comma less 194 226 comma comma Meta_comma Meta_comma
+keycode 52 = period greater 192 224 Compose Compose Meta_period Meta_period
+keycode 53 = slash question slash question Delete Delete Meta_slash Meta_slash Meta_question Meta_question
+# Ctrl+Shift - Cyrillic (not working???)
+keycode 54 = Shift Shift Shift Shift AltGr_Lock AltGr_Lock Shift Shift Shift Shift
+keycode 55 = KP_Multiply
+keycode 56 = Alt
+keycode 57 = space space space space nul nul Meta_space Meta_space
+keycode 58 = Caps_Lock
+keycode 59 = F1 F11 F1 F11 F1 F1 Console_1 Console_1 Console_1 Console_1
+keycode 60 = F2 F12 F2 F12 F2 F2 Console_2 Console_2 Console_2 Console_2
+#============== plain ========= shift========== plain cyr ===== shift cyr ===== ctrl ================== ctrl cyr ============== alt =================== alt cyr =============== ctrlalt =============== ctrlalt cyr ===========
+keycode 61 = F3 F13 F3 F13 F3 F3 Console_3 Console_3 Console_3 Console_3
+keycode 62 = F4 F14 F4 F14 F4 F4 Console_4 Console_4 Console_4 Console_4
+keycode 63 = F5 F15 F5 F15 F5 F5 Console_5 Console_5 Console_5 Console_5
+keycode 64 = F6 F16 F6 F16 F6 F6 Console_6 Console_6 Console_6 Console_6
+keycode 65 = F7 F17 F7 F17 F7 F7 Console_7 Console_7 Console_7 Console_7
+keycode 66 = F8 F18 F8 F18 F8 F8 Console_8 Console_8 Console_8 Console_8
+keycode 67 = F9 F19 F9 F19 F9 F9 Console_9 Console_9 Console_9 Console_9
+keycode 68 = F10 F20 F10 F20 F10 F10 Console_10 Console_10 Console_10 Console_10
+keycode 69 = Num_Lock Bare_Num_Lock Num_Lock Bare_Num_Lock
+keycode 70 = Scroll_Lock Show_Memory Scroll_Lock Show_Memory Show_State Show_State
+keycode 71 = KP_7 KP_7 KP_7 KP_7 KP_7 KP_7 Ascii_7 Ascii_7
+keycode 72 = KP_8 KP_8 KP_8 KP_8 KP_8 KP_8 Ascii_8 Ascii_8
+keycode 73 = KP_9 KP_9 KP_9 KP_9 KP_9 KP_9 Ascii_9 Ascii_9
+keycode 74 = KP_Subtract KP_Subtract KP_Subtract KP_Subtract KP_Subtract KP_Subtract KP_Subtract KP_Subtract
+keycode 75 = KP_4 KP_4 KP_4 KP_4 KP_4 KP_4 Ascii_4 Ascii_4
+keycode 76 = KP_5 KP_5 KP_5 KP_5 KP_5 KP_5 Ascii_5 Ascii_5
+keycode 77 = KP_6 KP_6 KP_6 KP_6 KP_6 KP_6 Ascii_6 Ascii_6
+keycode 78 = KP_Add KP_Add KP_Add KP_Add KP_Add KP_Add KP_Add KP_Add
+keycode 79 = KP_1 KP_1 KP_1 KP_1 KP_1 KP_1 Ascii_1 Ascii_1
+keycode 80 = KP_2 KP_2 KP_2 KP_2 KP_2 KP_2 Ascii_2 Ascii_2
+#============== plain ========= shift========== plain cyr ===== shift cyr ===== ctrl ================== ctrl cyr ============== alt =================== alt cyr =============== ctrlalt =============== ctrlalt cyr ===========
+keycode 81 = KP_3 KP_3 KP_3 KP_3 KP_3 KP_3 Ascii_3 Ascii_3
+keycode 82 = KP_0 KP_0 KP_0 KP_0 KP_0 KP_0 Ascii_0 Ascii_0
+keycode 83 = KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period KP_Period Boot Boot
+keycode 84 = Last_Console
+keycode 85 =
+keycode 86 = less greater less greater less less Meta_less Meta_less
+keycode 87 = F11 F11 F11 F11 F11 F11 Console_11 Console_11 Console_11 Console_11
+keycode 88 = F12 F12 F12 F12 F12 F12 Console_12 Console_12 Console_12 Console_12
+keycode 89 =
+keycode 90 =
+keycode 91 =
+keycode 92 =
+keycode 93 =
+keycode 94 =
+keycode 95 =
+keycode 96 = KP_Enter
+keycode 97 = Control
+keycode 98 = KP_Divide
+keycode 99 = Control_backslash
+# Right Alt - Cyrillic
+keycode 100 = AltGr_Lock
+#============== plain ========= shift========== plain cyr ===== shift cyr ===== ctrl ================== ctrl cyr ============== alt =================== alt cyr =============== ctrlalt =============== ctrlalt cyr ===========
+keycode 101 = Break
+keycode 102 = Find
+keycode 103 = Up
+keycode 104 = Prior Scroll_Backward Prior Scroll_Backward Prior Prior Prior Prior Prior Prior
+keycode 105 = Left Left Left Left Left Left Left Left Decr_Console Decr_Console
+keycode 106 = Right Right Right Right Right Right Right Right Incr_Console Incr_Console
+keycode 107 = Select
+keycode 108 = Down
+keycode 109 = Next Scroll_Forward Next Scroll_Forward Next Next Next Next Next Next
+keycode 110 = Insert
+keycode 111 = Remove Remove Remove Remove Remove Remove Remove Remove Boot Boot
+keycode 112 = Macro
+keycode 113 = F13
+keycode 114 = F14
+keycode 115 = Help
+keycode 116 = Do
+keycode 117 = F17
+keycode 118 = KP_MinPlus
+keycode 119 = Pause
+keycode 120 =
+#============== plain ========= shift========== plain cyr ===== shift cyr ===== ctrl ================== ctrl cyr ============== alt =================== alt cyr =============== ctrlalt =============== ctrlalt cyr ===========
+keycode 121 =
+keycode 122 =
+keycode 123 =
+keycode 124 =
+keycode 125 =
+keycode 126 =
+keycode 127 =
+
+string F1 = "\033[[A"
+string F2 = "\033[[B"
+string F3 = "\033[[C"
+string F4 = "\033[[D"
+string F5 = "\033[[E"
+string F6 = "\033[17~"
+string F7 = "\033[18~"
+string F8 = "\033[19~"
+string F9 = "\033[20~"
+string F10 = "\033[21~"
+string F11 = "\033[23~"
+string F12 = "\033[24~"
+string F13 = "\033[25~"
+string F14 = "\033[26~"
+string F15 = "\033[28~"
+string F16 = "\033[29~"
+string F17 = "\033[31~"
+string F18 = "\033[32~"
+string F19 = "\033[33~"
+string F20 = "\033[34~"
+string Find = "\033[1~"
+string Insert = "\033[2~"
+string Remove = "\033[3~"
+string Select = "\033[4~"
+string Prior = "\033[5~"
+string Next = "\033[6~"
+string Macro = "\033[M"
+string Pause = "\033[P"
diff --git a/ap/app/busybox/src/examples/var_service/getty_tty1/run b/ap/app/busybox/src/examples/var_service/getty_tty1/run
new file mode 100755
index 0000000..c7c413b
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/getty_tty1/run
@@ -0,0 +1,30 @@
+#!/bin/sh
+
+exec >/dev/null
+exec 2>&1
+exec </dev/null
+
+user=root
+baud=38400
+delay=3
+export TERM=linux
+
+tty="/dev/${PWD##*/getty_}"
+
+if ! test -e "$tty"; then
+ exec env - sleep 32000
+fi
+
+sleep "$delay"
+
+chown "$user" "$tty" # - devfs made happy
+
+exec <"$tty" >"$tty" 2>&1
+# using . in order to be able to set env (TERM etc) in cfg
+test -x ./cfg && . ./cfg
+
+exec \
+env - "TERM=$TERM" PATH="$PATH" LOGIN_PRE_SUID_SCRIPT="$PWD/login.sh" \
+softlimit \
+setuidgid "$user" \
+getty "$baud" "$tty" "$TERM"
diff --git a/ap/app/busybox/src/examples/var_service/gpm/run b/ap/app/busybox/src/examples/var_service/gpm/run
new file mode 100755
index 0000000..a13fdcd
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/gpm/run
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+exec >/dev/null
+exec 2>&1
+exec </dev/null
+
+user=root
+options="-D -2 -m /dev/psaux -t ps2"
+#options="-D -2 -m /dev/ttyS0 -t bare"
+
+exec \
+env - PATH="$PATH" \
+softlimit \
+setuidgid "$user" \
+gpm $options
diff --git a/ap/app/busybox/src/examples/var_service/httpd/log/run b/ap/app/busybox/src/examples/var_service/httpd/log/run
new file mode 100755
index 0000000..560d1b1
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/httpd/log/run
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+user=logger
+
+logdir="/var/log/service/`(cd ..;basename $PWD)`"
+mkdir -p "$logdir" 2>/dev/null
+chown -R "$user": "$logdir"
+chmod -R go-rwxst,u+rwX "$logdir"
+rm logdir
+ln -s "$logdir" logdir
+
+# make this dir accessible to logger
+chmod a+rX .
+
+exec >/dev/null
+exec 2>&1
+exec \
+env - PATH="$PATH" \
+softlimit \
+setuidgid "$user" \
+svlogd -tt "$logdir"
diff --git a/ap/app/busybox/src/examples/var_service/httpd/p_log b/ap/app/busybox/src/examples/var_service/httpd/p_log
new file mode 100755
index 0000000..a2521be
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/httpd/p_log
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd log/logdir || exit 1
+cat @* current | $PAGER
diff --git a/ap/app/busybox/src/examples/var_service/httpd/run b/ap/app/busybox/src/examples/var_service/httpd/run
new file mode 100755
index 0000000..ff8869b
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/httpd/run
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+#exec >/dev/null
+exec 2>&1
+exec </dev/null
+
+user=www
+user=root
+
+echo "* Starting tcpsvd for httpd [$$]"
+exec \
+env - PATH="$PATH" \
+softlimit \
+tcpsvd \
+ -v -E -l localhost -c 5 \
+ 0 88 \
+setuidgid "$user" \
+httpd -vvv -i -h /pub/httpd_root
diff --git a/ap/app/busybox/src/examples/var_service/httpd/w_log b/ap/app/busybox/src/examples/var_service/httpd/w_log
new file mode 100755
index 0000000..aa36ef1
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/httpd/w_log
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd log/logdir || exit 1
+watch -n2 'w=`ttysize w`; h=`ttysize h`; tail -$((h-3)) current 2>&1 | cut -b1-$((w-2))'
diff --git a/ap/app/busybox/src/examples/var_service/ifplugd_if/ifplugd_handler b/ap/app/busybox/src/examples/var_service/ifplugd_if/ifplugd_handler
new file mode 100755
index 0000000..4962fcf
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/ifplugd_if/ifplugd_handler
@@ -0,0 +1,15 @@
+#!/bin/sh
+# parameters:
+# $1: interface
+# $2: state
+
+if test -d "/var/service/dhcp_$1"; then
+ if test x"$2" = x"down"; then
+ echo "Downing /var/service/dhcp_$1"
+ sv d "/var/service/dhcp_$1"
+ fi
+ if test x"$2" = x"up"; then
+ echo "Upping /var/service/dhcp_$1"
+ sv u "/var/service/dhcp_$1"
+ fi
+fi
diff --git a/ap/app/busybox/src/examples/var_service/ifplugd_if/log/run b/ap/app/busybox/src/examples/var_service/ifplugd_if/log/run
new file mode 100755
index 0000000..560d1b1
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/ifplugd_if/log/run
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+user=logger
+
+logdir="/var/log/service/`(cd ..;basename $PWD)`"
+mkdir -p "$logdir" 2>/dev/null
+chown -R "$user": "$logdir"
+chmod -R go-rwxst,u+rwX "$logdir"
+rm logdir
+ln -s "$logdir" logdir
+
+# make this dir accessible to logger
+chmod a+rX .
+
+exec >/dev/null
+exec 2>&1
+exec \
+env - PATH="$PATH" \
+softlimit \
+setuidgid "$user" \
+svlogd -tt "$logdir"
diff --git a/ap/app/busybox/src/examples/var_service/ifplugd_if/p_log b/ap/app/busybox/src/examples/var_service/ifplugd_if/p_log
new file mode 100755
index 0000000..a2521be
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/ifplugd_if/p_log
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd log/logdir || exit 1
+cat @* current | $PAGER
diff --git a/ap/app/busybox/src/examples/var_service/ifplugd_if/run b/ap/app/busybox/src/examples/var_service/ifplugd_if/run
new file mode 100755
index 0000000..2781cf9
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/ifplugd_if/run
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+#exec >/dev/null
+exec 2>&1
+exec </dev/null
+
+pwd="$PWD"
+
+if="${PWD##*/ifplugd_}"
+
+echo "* Starting ifplugd on $if [$$]"
+exec \
+env - PATH="$PATH" \
+softlimit \
+setuidgid root \
+ifplugd -apqns -t3 -u8 -d8 -i "$if" -r "$pwd/ifplugd_handler"
+
+# We use -t3 to wake ifplugd up less often.
+# If after three tests (3*3=9 > 8) link state seen to be different,
+# the handler will be called.
+# IOW: short link losses will be ignored, longer ones
+# will trigger DHCP reconfiguration and such (see handler code).
+
+#-a Do not up interface automatically
+#-p Dont run script on daemon startup
+#-q Dont run script on daemon quit
+#-n Do not daemonize
+#-s Do not log to syslog
+#-t SECS Poll time in seconds
+#-u SECS Delay before running script after link up
+#-d SECS Delay after link down
+#-i IFACE Interface
+#-r PROG Script to run
+#-f/-F Treat link detection error as link down/link up (otherwise exit on error)
+#-M Monitor creation/destruction of interface (otherwise it must exist)
+#-x ARG Extra argument for script
+#-I Dont exit on nonzero exit code from script
+#-l Run script on startup even if no cable is detected
+#-m MODE API mode (mii, priv, ethtool, wlan, auto)
diff --git a/ap/app/busybox/src/examples/var_service/ifplugd_if/w_log b/ap/app/busybox/src/examples/var_service/ifplugd_if/w_log
new file mode 100755
index 0000000..aa36ef1
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/ifplugd_if/w_log
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd log/logdir || exit 1
+watch -n2 'w=`ttysize w`; h=`ttysize h`; tail -$((h-3)) current 2>&1 | cut -b1-$((w-2))'
diff --git a/ap/app/busybox/src/examples/var_service/inetd/inetd.conf b/ap/app/busybox/src/examples/var_service/inetd/inetd.conf
new file mode 100644
index 0000000..c5f151b
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/inetd/inetd.conf
@@ -0,0 +1,18 @@
+# [ADDR:]service_name must be in /etc/services, or port number
+# socket_type stream/dgram/raw/rdm/seqpacket
+# protocol tcp/udp
+# wait/nowait[.max] wait is usually for udp, nowait for tcp
+# max: max copies to run
+# user[.group] or user[:group] user and group to run under
+# binary program to run
+# arg0 arg1 arg2... arguments, INCLUDING program name (arg0)
+
+# serv socket pro w/nw user binary args
+
+# IPv6
+555 dgram udp6 wait root echo echo Hello IPv6 udp world
+# ...with ADDR prefix:
+::1:444 stream tcp6 nowait root echo echo Hello IPv6 localhost
+
+# Rarely seen case: tcp *wait* service
+telnet stream tcp wait root telnetd telnetd -w10
diff --git a/ap/app/busybox/src/examples/var_service/inetd/log/run b/ap/app/busybox/src/examples/var_service/inetd/log/run
new file mode 100755
index 0000000..560d1b1
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/inetd/log/run
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+user=logger
+
+logdir="/var/log/service/`(cd ..;basename $PWD)`"
+mkdir -p "$logdir" 2>/dev/null
+chown -R "$user": "$logdir"
+chmod -R go-rwxst,u+rwX "$logdir"
+rm logdir
+ln -s "$logdir" logdir
+
+# make this dir accessible to logger
+chmod a+rX .
+
+exec >/dev/null
+exec 2>&1
+exec \
+env - PATH="$PATH" \
+softlimit \
+setuidgid "$user" \
+svlogd -tt "$logdir"
diff --git a/ap/app/busybox/src/examples/var_service/inetd/p_log b/ap/app/busybox/src/examples/var_service/inetd/p_log
new file mode 100755
index 0000000..a2521be
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/inetd/p_log
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd log/logdir || exit 1
+cat @* current | $PAGER
diff --git a/ap/app/busybox/src/examples/var_service/inetd/run b/ap/app/busybox/src/examples/var_service/inetd/run
new file mode 100755
index 0000000..910c1b3
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/inetd/run
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+#exec >/dev/null
+exec 2>&1
+exec </dev/null
+
+echo "* Starting inetd [$$]"
+exec \
+env - PATH="$PATH" \
+softlimit \
+inetd -f -e "$PWD/inetd.conf"
+
+# inetd [-f] [-q len] [conf]
+# -f Run in foreground
+# -e Log to stderr (default is syslog)
+# -q N Set the size of the socket listen queue to N
+# (default: 128)
diff --git a/ap/app/busybox/src/examples/var_service/inetd/w_log b/ap/app/busybox/src/examples/var_service/inetd/w_log
new file mode 100755
index 0000000..aa36ef1
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/inetd/w_log
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd log/logdir || exit 1
+watch -n2 'w=`ttysize w`; h=`ttysize h`; tail -$((h-3)) current 2>&1 | cut -b1-$((w-2))'
diff --git a/ap/app/busybox/src/examples/var_service/nmeter/run b/ap/app/busybox/src/examples/var_service/nmeter/run
new file mode 100755
index 0000000..7e51124
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/nmeter/run
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+exec >/dev/null
+exec 2>&1
+exec </dev/null
+
+# Since per-process /proc/net/ (-> /proc/self/net/) appeared,
+# we need to be root
+user="root"
+tty="/dev/tty9"
+cmd="nmeter '%t %c x %x p%p f %f b %b m %m if%[nif]'"
+
+chmod -R a+X . # or else env will moan
+chown "$user": "$tty" # devfs made happy
+
+eval exec \
+env - PATH="$PATH" \
+setuidgid "$user" \
+<"$tty" >"$tty" 2>&1 \
+$cmd
diff --git a/ap/app/busybox/src/examples/var_service/ntpd/log/run b/ap/app/busybox/src/examples/var_service/ntpd/log/run
new file mode 100755
index 0000000..560d1b1
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/ntpd/log/run
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+user=logger
+
+logdir="/var/log/service/`(cd ..;basename $PWD)`"
+mkdir -p "$logdir" 2>/dev/null
+chown -R "$user": "$logdir"
+chmod -R go-rwxst,u+rwX "$logdir"
+rm logdir
+ln -s "$logdir" logdir
+
+# make this dir accessible to logger
+chmod a+rX .
+
+exec >/dev/null
+exec 2>&1
+exec \
+env - PATH="$PATH" \
+softlimit \
+setuidgid "$user" \
+svlogd -tt "$logdir"
diff --git a/ap/app/busybox/src/examples/var_service/ntpd/ntp.script b/ap/app/busybox/src/examples/var_service/ntpd/ntp.script
new file mode 100755
index 0000000..76c34bf
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/ntpd/ntp.script
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+# Note that there is no provision to prevent several copies of the script
+# to be run in quick succession. In fact, it happens rather often
+# if initial syncronization results in a step.
+# You will see "step" and then "stratum" script runs, sometimes
+# as close as only 0.002 seconds apart.
+#
+# Script should be ready to deal with this.
+
+dt=`date '+%Y-%m-%d %H:%M:%S'`
+
+if test x"$stratum" != x"" \
+&& test x"$poll_interval" != x"" \
+&& test 4 -ge "$stratum" \
+&& test 128 -le "$poll_interval" \
+; then
+ echo "`tail -n 199 -- "$0.log" 2>/dev/null`" >"$0.log.$$"
+ echo "$dt: $1"\
+ "freq_drift_ppm=$freq_drift_ppm"\
+ "offset=$offset"\
+ "stratum=$stratum"\
+ "poll_interval=$poll_interval,"\
+ "setting hardware clock"\
+ >>"$0.log.$$"
+ mv -- "$0.log.$$" "$0.log"
+ exec hwclock --systohc
+fi
+
+echo "`tail -n 199 -- "$0.log" 2>/dev/null`" >"$0.log.$$"
+echo "$dt: $1"\
+ "freq_drift_ppm=$freq_drift_ppm"\
+ "offset=$offset"\
+ "stratum=$stratum"\
+ "poll_interval=$poll_interval"\
+ >>"$0.log.$$"
+mv -- "$0.log.$$" "$0.log"
diff --git a/ap/app/busybox/src/examples/var_service/ntpd/p_log b/ap/app/busybox/src/examples/var_service/ntpd/p_log
new file mode 100755
index 0000000..a2521be
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/ntpd/p_log
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd log/logdir || exit 1
+cat @* current | $PAGER
diff --git a/ap/app/busybox/src/examples/var_service/ntpd/run b/ap/app/busybox/src/examples/var_service/ntpd/run
new file mode 100755
index 0000000..581d231
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/ntpd/run
@@ -0,0 +1,60 @@
+#!/bin/bash
+# (using bashism (arrays) in dhcp config)
+
+#exec >/dev/null
+exec 2>&1
+exec </dev/null
+
+user=root
+pool="us.pool.ntp.org" # replace "us" with your country code
+
+service="${PWD##*/}"
+rundir="/var/run/service/$service"
+default_p_opt="-p 0.$pool -p 1.$pool -p 2.$pool -p 3.$pool"
+
+
+# Make sure rundir/ exists
+mkdir -p "$rundir" 2>/dev/null
+chown -R "$user:" "$rundir"
+chmod -R a=rX "$rundir"
+rm -rf rundir 2>/dev/null
+ln -s "$rundir" rundir
+
+
+echo "* Checking network"
+test -f /var/run/service/fw/up || exec sleep 7
+sleep 5 # to let it settle
+
+# Grab config from dhcp
+cfg=-1
+for f in rundir/*.ntpconf; do
+ test -f "$f" || continue
+ . "$f"
+done
+
+# Select peers
+p_opt=""
+cfg=0
+while test x"${ntpip[$cfg]}" != x""; do
+ p_opt="$p_opt -p ${ntpip[$cfg]}"
+ let cfg=cfg+1
+done
+test x"$p_opt" == x"" && p_opt="$default_p_opt"
+
+if test x"$p_opt" == x""; then
+ echo "* No NTP peers configured, stopping"
+ sv o .
+ exec sleep 1
+fi
+
+
+# Let others know that we are up
+date '+%Y-%m-%d %H:%M:%S %Z' >rundir/up
+
+# Go go go
+echo "* Starting ntpd[$$]"
+exec \
+env - PATH="$PATH" \
+softlimit \
+setuidgid "$user" \
+ntpd -ddnNl -S ./ntp.script $p_opt
diff --git a/ap/app/busybox/src/examples/var_service/ntpd/w_log b/ap/app/busybox/src/examples/var_service/ntpd/w_log
new file mode 100755
index 0000000..aa36ef1
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/ntpd/w_log
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd log/logdir || exit 1
+watch -n2 'w=`ttysize w`; h=`ttysize h`; tail -$((h-3)) current 2>&1 | cut -b1-$((w-2))'
diff --git a/ap/app/busybox/src/examples/var_service/tftpd/log/run b/ap/app/busybox/src/examples/var_service/tftpd/log/run
new file mode 100755
index 0000000..560d1b1
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/tftpd/log/run
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+user=logger
+
+logdir="/var/log/service/`(cd ..;basename $PWD)`"
+mkdir -p "$logdir" 2>/dev/null
+chown -R "$user": "$logdir"
+chmod -R go-rwxst,u+rwX "$logdir"
+rm logdir
+ln -s "$logdir" logdir
+
+# make this dir accessible to logger
+chmod a+rX .
+
+exec >/dev/null
+exec 2>&1
+exec \
+env - PATH="$PATH" \
+softlimit \
+setuidgid "$user" \
+svlogd -tt "$logdir"
diff --git a/ap/app/busybox/src/examples/var_service/tftpd/p_log b/ap/app/busybox/src/examples/var_service/tftpd/p_log
new file mode 100755
index 0000000..a2521be
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/tftpd/p_log
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd log/logdir || exit 1
+cat @* current | $PAGER
diff --git a/ap/app/busybox/src/examples/var_service/tftpd/run b/ap/app/busybox/src/examples/var_service/tftpd/run
new file mode 100755
index 0000000..e492d84
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/tftpd/run
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+#exec >/dev/null
+exec 2>&1
+exec </dev/null
+
+user=root # for bind to port 69
+
+exec \
+env - \
+softlimit \
+setuidgid "$user" \
+udpsvd -v -c 10 -l localhost \
+ 0 69 \
+tftpd /pub/tftpd_root
diff --git a/ap/app/busybox/src/examples/var_service/tftpd/w_log b/ap/app/busybox/src/examples/var_service/tftpd/w_log
new file mode 100755
index 0000000..aa36ef1
--- /dev/null
+++ b/ap/app/busybox/src/examples/var_service/tftpd/w_log
@@ -0,0 +1,4 @@
+#!/bin/sh
+
+cd log/logdir || exit 1
+watch -n2 'w=`ttysize w`; h=`ttysize h`; tail -$((h-3)) current 2>&1 | cut -b1-$((w-2))'
diff --git a/ap/app/busybox/src/examples/zcip.script b/ap/app/busybox/src/examples/zcip.script
new file mode 100755
index 0000000..e543c30
--- /dev/null
+++ b/ap/app/busybox/src/examples/zcip.script
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+# only for use as a "zcip" callback script
+if [ "x$interface" = x ]
+then
+ exit 1
+fi
+
+# zcip should start on boot/resume and various media changes
+case "$1" in
+init)
+ # for now, zcip requires the link to be already up,
+ # and it drops links when they go down. that isn't
+ # the most robust model...
+ exit 0
+ ;;
+config)
+ if [ "x$ip" = x ]
+ then
+ exit 1
+ fi
+ # remember $ip for $interface, to use on restart
+ if [ "x$ip" != x -a -w "$ip.$interface" ]
+ then
+ echo $ip > "$ip.$interface"
+ fi
+ exec ip address add dev $interface \
+ scope link local "$ip/16" broadcast +
+ ;;
+deconfig)
+ if [ x$ip = x ]
+ then
+ exit 1
+ fi
+ exec ip address del dev $interface local $ip
+ ;;
+esac
+exit 1