code stringlengths 1 1.96M | language stringclasses 1
value |
|---|---|
#!/bin/sh
# Copyright 2010 by Denys Vlasenko
# Licensed under GPLv2, see file LICENSE in this source tree.
. ./testing.sh
test -f "$bindir/.config" && . "$bindir/.config"
# testing "test name" "command" "expected result" "file input" "stdin"
testing "cal 2000" "cal 1 2000" "\
January 2000
Su Mo Tu We Th Fr Sa
... | Shell |
#!/bin/sh
# Copyright 2008 by Denys Vlasenko
# Licensed under GPLv2, see file LICENSE in this source tree.
. ./testing.sh
# testing "test name" "cmd" "expected result" "file input" "stdin"
testing "start-stop-daemon -x without -a" \
'start-stop-daemon -S -x true 2>&1; echo $?' \
"0\n" \
"" ""
testing "start-stop... | Shell |
#!/bin/sh
# Wrapper for User Mode Linux emulation environment
RUNFILE="$(pwd)/${1}.testroot"
if [ -z "$RUNFILE" ] || [ ! -x "$RUNFILE" ]
then
echo "Can't run '$RUNFILE'"
exit 1
fi
shift
if [ -z $(which linux) ]
then
echo "No User Mode Linux."
exit 1;
fi
linux rootfstype=hostfs rw init="$RUNFILE" TESTDIR=`p... | Shell |
#!/bin/sh
# Used by {ms5,shaN}sum
# We pipe texts 0...999 bytes long, {md5,shaN}sum them,
# then {md5,shaN}sum the resulting list.
# Then we compare the result with expected result.
#
# Here are the expected results:
# efe30c482e0b687e0cca0612f42ca29b
# d41337e834377140ae7f98460d71d908598ef04f
# 8e1d3ed57ebc130f0f7250... | Shell |
#!/bin/sh
# Copyright 2009 by Denys Vlasenko
# Licensed under GPLv2, see file LICENSE in this source tree.
. ./testing.sh
# testing "test name" "options" "expected result" "file input" "stdin"
# Simple one-block file transfer
# rx => 'C'
# rx <= SOH <blockno> <255-blockno> <128 byte padded with x1A> <crc> <crc>
# rx... | Shell |
#!/bin/sh
# SUSv3 compliant mount and umount tests.
# Copyright 2005 by Rob Landley <rob@landley.net>
# Licensed under GPLv2, see file LICENSE in this source tree.
if [ -z "$TESTDIR" ]
then
echo 'Need $TESTDIR'
exit 1
fi
cd "$TESTDIR"
. testing.sh
# If we aren't PID 1, barf.
#if [ $$ -ne 1 ]
#then
# echo "SK... | Shell |
#!/bin/sh
#
# These are not ash tests, we use ash as a way to test lineedit!
#
# Copyright 2010 by Denys Vlasenko
# Licensed under GPLv2, see file LICENSE in this source tree.
. ./testing.sh
test -f "$bindir/.config" && . "$bindir/.config"
test x"CONFIG_SCRIPT" = x"y" || exit 0
test x"CONFIG_HEXDUMP" = x"y" || exit 0... | Shell |
#!/bin/sh
# Copyright 2009 by Denys Vlasenko <vda.linux@googlemail.com>
# Licensed under GPLv2, see file LICENSE in this source tree.
. ./testing.sh
# testing "test name" "command" "expected result" "file input" "stdin"
# file input will be file called "input"
# test can create a file "actual" instead of writing... | Shell |
#!/bin/sh
# unit test for sum.
# Copyright 2007 by Bernhard Reutner-Fischer
# Licensed under GPLv2 or later, see file LICENSE in this source tree.
# AUDIT: Unit tests for sum
. ./testing.sh
# testing "test name" "options" "expected result" "file input" "stdin"
# file input will be file called "input"
# test can... | Shell |
#!/bin/sh
FAILCOUNT=0
ext=bz2
bb="busybox "
unset LC_ALL
unset LC_MESSAGES
unset LANG
unset LANGUAGE
hello_gz() {
# Gzipped "HELLO\n"
#_________________________ vvv vvv vvv vvv - mtime
$ECHO -ne "\x1f\x8b\x08\x00\x85\x1d\xef\x45\x02\x03\xf3\x70\xf5\xf1\xf1\xe7"
$ECHO -ne "\x02\x00\x6e\xd7\xac\xfd\x... | Shell |
#!/bin/sh
# Copyright 2008 by Denys Vlasenko
# Licensed under GPLv2, see file LICENSE in this source tree.
. ./testing.sh
# testing "test name" "command(s)" "expected result" "file input" "stdin"
testing "patch with old_file == new_file" \
'patch 2>&1; echo $?; cat input' \
"\
patching file input
0
qwe
asd
zxc
" \
... | Shell |
#!/bin/sh
. ./md5sum.tests sha3sum c29d77bc548fa2b20a04c861400a5360879c52156e2a54a3415b99a9a3123e1d5f36714a24eca8c1f05a8e2d8ba859c930d41141f64a255c6794436fc99c486a
| Shell |
#!/bin/sh
# Copyright 2010 by Denys Vlasenko
# Licensed under GPLv2, see file LICENSE in this source tree.
. ./testing.sh
# Opening quote in "omitting directory 'dir'" message:
sq='`' # GNU cp: `
sq="'" # bbox cp: '
rm -rf cp.testdir >/dev/null
mkdir cp.testdir
mkdir cp.testdir/dir
> cp.testdir/dir/file
ln -s fil... | Shell |
# Simple test harness infrastructure for BusyBox
#
# Copyright 2005 by Rob Landley
#
# License is GPLv2, see LICENSE in the busybox tarball for full license text.
# This file defines two functions, "testing" and "optional"
# and a couple more...
# The following environment variables may be set to enable optional beha... | Shell |
#!/bin/sh
# Copyright 2009 by Denys Vlasenko
# Licensed under GPLv2, see file LICENSE in this source tree.
. ./testing.sh
unset LANG
unset LANGUAGE
unset LC_COLLATE
unset LC_ALL
umask 022
rm -rf tar.tempdir 2>/dev/null
mkdir tar.tempdir && cd tar.tempdir || exit 1
# testing "test name" "script" "expected result" "f... | Shell |
#!/bin/sh
# mkfs.minix tests.
# Copyright 2007 by Denys Vlasenko
# Licensed under GPLv2, see file LICENSE in this source tree.
. ./testing.sh
# testing "test name" "options" "expected result" "file input" "stdin"
# '\n' produces 10 on little endian, but not on big endian
cr=`echo | od -i | sed 's/ *$//g;s/.* //g;2d... | Shell |
#!/bin/sh
. ./md5sum.tests sha1sum d41337e834377140ae7f98460d71d908598ef04f
| Shell |
#!/bin/sh
# Copyright 2008 by Denys Vlasenko
# Licensed under GPLv2, see file LICENSE in this source tree.
. ./testing.sh
# ls -ln is showing date. Need to remove that, it's variable
# sed: (1) "maj, min" -> "maj,min" (2) coalesce spaces
# cut: remove date
FILTER_LS="grep -v '^total ' | sed -e 's/, */,/g' -e 's/ */... | Shell |
#!/bin/sh
# Readlink tests.
# Copyright 2006 by Natanael Copa <n@tanael.org>
# Licensed under GPLv2, see file LICENSE in this source tree.
. ./testing.sh
TESTDIR=readlink_testdir
TESTFILE="$TESTDIR/testfile"
TESTLINK="testlink"
FAILLINK="$TESTDIR/$TESTDIR/testlink"
# create the dir and test files
mkdir -p "./$TESTD... | Shell |
#!/bin/sh
. ./bunzip2.tests
| Shell |
#!/bin/sh
# SUSv3 compliant uniq tests.
# Copyright 2005 by Rob Landley <rob@landley.net>
# Licensed under GPLv2, see file LICENSE in this source tree.
# AUDIT: Full SUSv3 coverage (except internationalization).
. ./testing.sh
# testing "test name" "options" "expected result" "file input" "stdin"
# file input wil... | Shell |
#!/bin/sh
# Copyright 2011 by Denys Vlasenko
# Licensed under GPLv2, see file LICENSE in this source tree.
. ./testing.sh
# testing "test name" "commands" "expected result" "file input" "stdin"
testing "uncompress < \x1f\x9d\x90 \x01 x N" \
'uncompress 2>&1 1>/dev/null; echo $?' \
"\
uncompress: corrupted data
1
" \... | Shell |
#!/bin/sh
# Leak test for gunzip. Watch top for growing process size.
# In this case we look for leaks in "concatenated .gz" code -
# we feed gunzip with a stream of .gz files.
i=$PID
c=0
while true; do
c=$((c + 1))
echo "Block# $c" >&2
# RANDOM is not very random on some shells. Spice it up.
i=$((i * ... | Shell |
#!/bin/sh
# Leak test for gunzip. Watch top for growing process size.
# Just using urandom will make gzip use method 0 (store) -
# not good for test coverage!
cat /dev/urandom \
| while true; do read junk; echo "junk $RANDOM $junk"; done \
| ../busybox gzip \
| ../busybox gunzip -c >/dev/null
| Shell |
#!/bin/sh
# Test that concatenated gz files are unpacking correctly.
# It also tests that unpacking in general is working right.
# Since zip code has many corner cases, run it for a few hours
# to get a decent coverage (200000 tests or more).
gzip="gzip"
gunzip="../busybox gunzip"
# Or the other way around:
#gzip="../... | Shell |
#!/bin/sh
busybox=../busybox
i=4000
echo "Before we started $i copies of '$busybox sleep 10':"
$busybox nmeter '%t %[pn] %m' | head -3
while test $i != 0; do
$busybox sleep 10 &
i=$((i-1))
done
sleep 1
echo "After:"
$busybox nmeter '%t %[pn] %m' | head -3
| Shell |
#!/bin/sh
t_text=0
t_data=0
t_bss=0
printf "%9s %11s %9s %9s %s\n" "text+data" "text+rodata" rwdata bss filename
find -name '*.o' | grep -v '^\./scripts/' | grep -vF built-in.o \
| sed 's:^\./::' | xargs "${CROSS_COMPILE}size" | grep '^ *[0-9]' \
| {
while read text data bss dec hex filename; do
t_text=$((t_text... | Shell |
#!/bin/sh
# If not specified in environment...
if ! test "$LIBC"; then
# Select which libc to build against
LIBC="glibc"
LIBC="uclibc"
fi
# x86 32-bit:
#CROSS_COMPILER_PREFIX="i486-linux-uclibc-"
# My system has strange prefix for x86 64-bit uclibc:
#CROSS_COMPILER_PREFIX="x86_64-pc-linux-gnu-"
if test $# -lt 2 ||... | Shell |
#!/bin/sh
usage() {
echo "Usage: ${0##*/} DIR1 DIR2"
echo
echo "Compares all object files recursivelty found in DIR1 and DIR2."
echo "Prints diff of their disassembly."
echo
exit $1
}
filter() {
# sed removes " address: " prefixes which mess up diff
sed $'s/^\\(\t*\\)[ ]*[0-9a-f][0-9a-f]*:[ \t]*/\\1/' \
| se... | Shell |
#!/bin/sh
grep -n -B1 -r $'^\t*}$' . | grep -A1 '.[ch]-[0-9]*-$'
grep -n -A1 -r $'^\t*{$' . | grep -B1 '.[ch]-[0-9]*-$'
# or (less surefire ones):
grep -n -B1 -r $'^\t*}' . | grep -A1 '.[ch]-[0-9]*-$'
grep -n -A1 -r $'^\t*{' . | grep -B1 '.[ch]-[0-9]*-$'
# find trailing empty lines
find -type f | while read file; do
... | Shell |
#!/bin/sh
# Note: was using sed OPTS CMD -- FILES
# but users complain that many sed implementations
# are misinterpreting --.
test $# -ge 2 || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; }
# cd to objtree
cd -- "$2" || { echo "Syntax: $0 SRCTREE OBJTREE"; exit 1; }
# In separate objtree build, include/ might not e... | Shell |
#!/bin/sh
# Copyright 2006 Rob Landley <rob@landley.net>
# Licensed under GPLv2 or later, see file LICENSE in this source tree.
# Dumb little utility function to print out the assembly dump of a single
# function, or list the functions so dumpable in an executable. You'd think
# there would be a way to get objdump t... | Shell |
#!/bin/sh
#
# Copyright (C) 2002 Khalid Aziz <khalid_aziz at hp.com>
# Copyright (C) 2002 Randy Dunlap <rddunlap at osdl.org>
# Copyright (C) 2002 Al Stone <ahs3 at fc.hp.com>
# Copyright (C) 2002 Hewlett-Packard Company
#
# This program is free software; you can redistribute it and/or modify
# it under the terms o... | Shell |
#!/bin/sh
busybox=../busybox
$busybox sleep 10 &
pid=$!
sleep 1
echo "Memory map of '$busybox sleep 10':"
size $busybox
pmap $pid | env - grep "^[0-9a-f][0-9a-f]* " | sort -r -t " " -k2,999
| Shell |
#!/bin/sh
# Check ncurses compatibility
# What library to link
ldflags()
{
for ext in so a dylib ; do
for lib in ncursesw ncurses curses ; do
$cc -print-file-name=lib${lib}.${ext} | grep -q /
if [ $? -eq 0 ]; then
echo "-l${lib}"
exit
fi
done
done
exit 1
}
# Where is ncurses.h?
ccflags()
{
if... | Shell |
#!/bin/sh
# Needed for systems without gettext
$* -xc -o /dev/null - > /dev/null 2>&1 << EOF
#include <libintl.h>
int main()
{
gettext("");
return 0;
}
EOF
if [ ! "$?" -eq "0" ]; then
echo -DKBUILD_NO_NLS;
fi
| Shell |
#!/bin/sh
# Processes current directory recursively:
# printf("abc\n") -> puts("abc"). Beware of fprintf etc...
# BTW, gcc 4.1.2 already does the same! Can't believe it...
grep -lr 'printf\([^%%]*\\n"\)' . | grep '.[ch]$' | xargs -n1 \
sed -e 's/\([^A-Za-z0-9_]\)printf(\( *"[^%]*\)\\n")/\1puts(\2")/' -i
| Shell |
#!/bin/sh
#
# gcc-version gcc-command
#
# Prints the gcc version of `gcc-command' in a canonical 4-digit form
# such as `0295' for gcc-2.95, `0303' for gcc-3.3, etc.
#
compiler="$*"
MAJ_MIN=$(echo __GNUC__ __GNUC_MINOR__ | $compiler -E -xc - | tail -n 1)
printf '%02d%02d\n' $MAJ_MIN
| Shell |
#!/bin/sh
b=`basename $PWD`
test "${b#busybox}" != "$b" || { echo "Must be run in busybox tree"; exit 1; }
cd ..
cp -pPR "$b" busybox.$$.test_tree
cd busybox.$$.test_tree
make defconfig
make $MAKEOPTS
make clean
cd ..
diff -urp "$b" busybox.$$.test_tree >busybox.$$.test_tree.diff
cat busybox.$$.test_tree.diff
| Shell |
#!/bin/sh
b=`basename $PWD`
test "${b#busybox}" != "$b" || { echo "Must be run in busybox tree"; exit 1; }
rm -rf ../testdir_make_O.$$
mkdir ../testdir_make_O.$$
odir=`cd ../testdir_make_O.$$ && pwd`
test -d "$odir" || exit 1
make O="$odir" $MAKEOPTS "$@" defconfig busybox 2>&1 | tee test_make_O.log
| Shell |
#!/bin/sh
test -d "$1" || exit 1
test -d "$2" || exit 1
{
(
cd "$1" || exit 1
find -name '*.o' -o -name '*.os' # -o -name '*.so'
)
(
cd "$2" || exit 1
find -name '*.o' -o -name '*.os' # -o -name '*.so'
)
} | sed 's:^\./::' | sort | uniq | \
tee LST | \
(
IFS=''
while read -r oname; do
if ! test -f "$1/$o... | Shell |
#!/bin/sh
# Common variables are elusive, they don't show up in size output!
# This script will show all commons in *.o, sorted by size
find ! -path './scripts/*' -a ! -name built-in.o -a -name '*.o' \
| while read name; do
b=`basename "$name"`
nm "$name" | sed "s/^/$b: /"
done | grep -i ' c ' | sort -k2
| Shell |
#!/bin/sh
debug=false
# Linker flags used:
#
# Informational:
# --warn-common
# -Map $EXE.map
# --verbose
#
# Optimizations:
# --sort-common reduces padding
# --sort-section alignment reduces padding
# --gc-sections throws out unused sections,
# does ... | Shell |
#!/bin/bash
# Whitespace fixer
# Usage: fix_ws [dir]...
temp="/tmp/fix_ws.$$.$RANDOM"
# Using $'xxx' bashism
begin8sp_tab=$'s/^ /\t/'
beginchar7sp_chartab=$'s/^\\([^ \t]\\) /\\1\t/'
tab8sp_tabtab=$'s/\t /\t\t/g'
tab8sptab_tabtabtab=$'s/\t \t/\t\t\t/g'
begin17sptab_tab=$'s/^ \\{1,7\\}\t/\t/'... | Shell |
#!/bin/sh
run_testsuite=true
test -d "$1" || { echo "'$1' is not a directory"; exit 1; }
test -x "$1/scripts/randomtest" || { echo "No scripts/randomtest in '$1'"; exit 1; }
export LIBC="uclibc"
export CROSS_COMPILER_PREFIX="i686-"
export MAKEOPTS="-j9"
cnt=0
fail=0
while sleep 1; do
echo "Passes: $cnt Failures: $... | Shell |
#!/bin/sh
# Create signed release tarballs and signature files from current svn.
# Since you don't have my gpg key, this doesn't do you much good,
# but if I get hit by a bus the next maintainer might find this useful.
# Run this in an empty directory. The VERSION= line can get confused
# otherwise.
#svn co svn://bu... | Shell |
#!/bin/sh
# This script finds applets with multiple uses of bb_common_bufsiz1
# (== possible bugs).
# Currently (2007-06-04) reports 3 false positives:
# ./coreutils/diff.c:7
# ./loginutils/getty.c:2
# ./util-linux/mount.c:5
find -name '*.c' \
| while read name; do
grep -Hc bb_common_bufsiz1 "$name"
done | grep -... | Shell |
#!/bin/bash
# Test script for busybox id vs. coreutils id.
# Needs root privileges for some tests.
cp /usr/bin/id .
BUSYBOX=./busybox
ID=./id
LIST=`awk -F: '{ printf "%s\n", $1 }' /etc/passwd`
FLAG_USER_EXISTS="no"
TEST_USER="f583ca884c1d93458fb61ed137ff44f6"
echo "test 1: id [options] nousername"
rm -f foo bar
for O... | Shell |
#!/bin/sh
# Depmod output may be hard to diff.
# This script sorts dependencies within "xx.ko: yy.ko zz.ko" lines,
# and sorts all lines too.
# Usage:
#
# [./busybox] depmod -n | ./depmod_process.sh | sort >OUTFILE
#
# and then you can diff OUTFILEs. Useful for comparing bbox depmod
# with module-init-tools depmod and... | Shell |
#!/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
mkdi... | Shell |
#!/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 \
se... | Shell |
#!/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))'
| Shell |
#!/bin/sh
cd log/logdir || exit 1
cat @* current | $PAGER
| Shell |
#!/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 ... | Shell |
#!/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
| Shell |
#!/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 \
se... | Shell |
#!/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))'
| Shell |
#!/bin/sh
cd log/logdir || exit 1
cat @* current | $PAGER
| Shell |
#!/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*... | Shell |
#!/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
| Shell |
#!/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 \
se... | Shell |
#!/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))'
| Shell |
#!/bin/sh
cd log/logdir || exit 1
cat @* current | $PAGER
| Shell |
#!/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
| Shell |
#!/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
| Shell |
#!/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 \
se... | Shell |
#!/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))'
| Shell |
#!/bin/sh
cd log/logdir || exit 1
cat @* current | $PAGER
| Shell |
#!/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
| Shell |
#!/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 \
se... | Shell |
#!/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))'
| Shell |
#!/bin/sh
cd log/logdir || exit 1
cat @* current | $PAGER
| Shell |
#!/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
# ... | Shell |
#!/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 \
se... | Shell |
#!/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))'
| Shell |
#!/bin/sh
cd log/logdir || exit 1
cat @* current | $PAGER
| Shell |
#!/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 ... | Shell |
#!/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.$do... | Shell |
#!/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
### ... | Shell |
#!/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
| Shell |
#!/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
| Shell |
#!/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]=''
| Shell |
#!/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'
| Shell |
#!/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... | Shell |
#!/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 - P... | Shell |
#!/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/dhc... | Shell |
#!/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
# ... | Shell |
#!/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 \
se... | Shell |
#!/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
# ... | Shell |
#!/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))'
| Shell |
#!/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
... | Shell |
#!/bin/sh
cd log/logdir || exit 1
cat @* current | $PAGER
| Shell |
#!/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... | Shell |
#!/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... | Shell |
#!/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... | Shell |
#!/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 n... | Shell |
# /etc/profile: system-wide .profile file for the Bourne shells
echo
echo -n "Processing /etc/profile... "
# no-op
echo "Done"
echo
| Shell |
#! /bin/sh
/bin/mount -a
| Shell |
#!/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... | Shell |
#!/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`
... | Shell |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.