code
stringlengths
1
1.96M
language
stringclasses
1 value
#!/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
Shell
#!/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 ;...
Shell
#!/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...
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
#!/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
#!/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 ...
Shell
#!/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 d...
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 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 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 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 cat @* current | $PAGER
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 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 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=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 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 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 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 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 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 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 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 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 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/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 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 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 cat @* current | $PAGER
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 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 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 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 # 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 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 # (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 # 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 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 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 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 cat @* current | $PAGER
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 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 # # 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 <Ex...
Shell
#!/bin/sh $THIS_SH -c ' cleanup() { echo "child exits as expected" exit } trap cleanup HUP echo "child sleeps" sleep 1 echo "BAD exit from child!" ' & child=$! sleep 0.1 # let child install handler first kill -HUP $child wait echo "parent exits"
Shell
#!/bin/sh $THIS_SH -c ' hup() { echo "child got HUP" } trap hup HUP echo "child sleeps" sleep 1 echo "child exits" ' & child=$! sleep 0.1 # let child install handler first kill -HUP $child wait echo "parent exits"
Shell
#!/bin/sh trap "echo Trapped" BADNAME TERM; echo $? kill $$ echo Ok
Shell
#!/bin/sh # Must not find us alive { sleep 2; kill -9 $$; } 2>/dev/null & sleep 1 & PID=$! # We must exit the loop in one second. # We had bug 5304: builtins never waited for exited children while kill -0 $PID >/dev/null 2>&1; do true done echo Ok
Shell
#!/bin/sh TOPDIR=$PWD test -x ash || { echo "No ./ash - creating a link to ../../busybox" ln -s ../../busybox ash } test -x printenv || gcc -O2 -o printenv printenv.c || exit $? test -x recho || gcc -O2 -o recho recho.c || exit $? test -x zecho || gcc -O2 -o zecho zecho.c || exit $? PATH="$...
Shell
#!/bin/sh unset LANG LANGUAGE unset LC_COLLATE unset LC_CTYPE unset LC_MONETARY unset LC_MESSAGES unset LC_NUMERIC unset LC_TIME unset LC_ALL if test ! -x hush; then if test ! -x ../../busybox; then echo "Can't run tests. Put hush binary into this directory (`pwd`)" exit 1 fi echo "No ./hush - creating a link ...
Shell
#!/bin/sh test -x msh || { echo "No ./msh - creating a link to ../../busybox" ln -s ../../busybox msh } PATH="$PWD:$PATH" # for msh export PATH THIS_SH="$PWD/msh" export THIS_SH do_test() { test -d "$1" || return 0 # echo Running tests in directory "$1" ( cd "$1" || { echo "cannot cd $1!"; exi...
Shell
#!/bin/sh # hush's stderr with leak debug enabled output=output freelist=`grep 'free 0x' "$output" | cut -d' ' -f2 | sort | uniq | xargs` grep -v free "$output" >"$output.leaked" i=8 list= for freed in $freelist; do list="$list -e $freed" test $((--i)) != 0 && continue echo Dropping $list grep -F -v...
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 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/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 # # 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 # 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 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 # 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 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/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 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 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 # 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/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 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 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 # # 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 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 # 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 # 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 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 # Copyright 2008 by Denys Vlasenko # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh test -f "$bindir/.config" && . "$bindir/.config" # testing "test name" "options" "expected result" "file input" "stdin" testing "expand" \ "expand" \ " 12345678 12345678\n" \ "" ...
Shell
#!/bin/sh # Used by both gunzip and bunzip2 tests FAILCOUNT=0 if test "${0##*/}" = "gunzip.tests"; then unpack=gunzip ext=gz elif test "${0##*/}" = "bunzip2.tests"; then unpack=bunzip2 ext=bz2 else echo "WTF? argv0='$0'" exit 1 fi bb="busybox " unset LC_ALL unset LC_MESSAGES unset LANG unset...
Shell
#!/bin/sh # unit test for uuencode to test functionality. # Copyright 2006 by Erik Hovland <erik@hovland.org> # Licensed under GPLv2, see file LICENSE in this source tree. # AUDIT: Unit tests for uuencode . ./testing.sh # testing "test name" "command(s)" "expected result" "file input" "stdin" # file input will be f...
Shell
#!/bin/sh # Usage: # runtest [applet1] [applet2...] . ./testing.sh total_failed=0 # Run one old-style test. # Tests are stored in applet/testcase shell scripts. # They are run using "sh -x -e applet/testcase". # Option -e will make testcase stop on the first failed command. run_applet_testcase() { local applet="$1"...
Shell
#!/bin/sh . ./md5sum.tests sha1sum d41337e834377140ae7f98460d71d908598ef04f
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 2010 Nokia Corporation # Written by Alexander Shishkin # Licensed under GPLv2 or later, see file LICENSE in this source tree. . ./testing.sh # testing "test name" "command(s)" "expected result" "file input" "stdin" optional FEATURE_AR_CREATE rm test.a 2>/dev/null testing "ar creates archives" ...
Shell
#!/bin/sh # SUSv3 compliant seq tests. # Copyright 2006 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 will...
Shell
#!/bin/sh # SUSv3 compliant sed tests. # Copyright 2005 by Rob Landley <rob@landley.net> # Licensed under GPLv2, see file LICENSE in this source tree. . ./testing.sh # testing "description" "commands" "result" "infile" "stdin" # Corner cases testing "sed no files (stdin)" 'sed ""' "hello\n" "" "hello\n" testing "se...
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 . ./md5sum.tests sha512sum fe413e0f177324d1353893ca0772ceba83fd41512ba63895a0eebb703ef9feac2fb4e92b2cb430b3bda41b46b0cb4ea8307190a5cc795157cfb680a9cd635d0f
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 # Copyright 2005 by Rob Landley <rob@landley.net> # Licensed under GPLv2, see file LICENSE in this source tree. # AUDIT: . ./testing.sh # testing "test name" "commands" "expected result" "file input" "stdin" # file input will be file called "input" # test can create a file "actual" instead of writing ...
Shell