diff options
Diffstat (limited to 'package/base-files/files/etc')
20 files changed, 502 insertions, 0 deletions
diff --git a/package/base-files/files/etc/banner b/package/base-files/files/etc/banner new file mode 100644 index 0000000000..c2fbc12680 --- /dev/null +++ b/package/base-files/files/etc/banner @@ -0,0 +1,10 @@ + _______ ________ __ + | |.-----.-----.-----.| | | |.----.| |_ + | - || _ | -__| || | | || _|| _| + |_______|| __|_____|__|__||________||__| |____| + |__| W I R E L E S S F R E E D O M + KAMIKAZE (bleeding edge, $R) ------------------- + * 10 oz Vodka Shake well with ice and strain + * 10 oz Triple sec mixture into 10 shot glasses. + * 10 oz lime juice Salute! + --------------------------------------------------- diff --git a/package/base-files/files/etc/config/network b/package/base-files/files/etc/config/network new file mode 100644 index 0000000000..1d5ded3728 --- /dev/null +++ b/package/base-files/files/etc/config/network @@ -0,0 +1,13 @@ +# Copyright (C) 2006 OpenWrt.org + +config interface loopback + option ifname lo + option proto static + option ipaddr 127.0.0.1 + option netmask 255.0.0.0 + +config interface lan + option ifname eth0 + option proto static + option ipaddr 192.168.1.1 + option netmask 255.255.255.0 diff --git a/package/base-files/files/etc/functions.sh b/package/base-files/files/etc/functions.sh new file mode 100755 index 0000000000..bf412df6d5 --- /dev/null +++ b/package/base-files/files/etc/functions.sh @@ -0,0 +1,149 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org +# Copyright (C) 2006 Fokus Fraunhofer <carsten.tittel@fokus.fraunhofer.de> + +alias debug=${DEBUG:-:} + +# newline +readonly N=" +" + +_C=0 + +hotplug_dev() { + env -i ACTION=$1 INTERFACE=$2 /sbin/hotplug net +} + +append() { + local var="$1" + local value="$2" + local sep="${3:- }" + + eval "export -n -- \"$var=\${$var:+\${$var}\${value:+\$sep}}\$value\"" +} + +reset_cb() { + config_cb() { return 0; } + option_cb() { return 0; } +} +reset_cb + +config () { + local cfgtype="$1" + local name="$2" + + _C=$((_C + 1)) + name="${name:-cfg${_C}}" + config_cb "$cfgtype" "$name" + CONFIG_SECTION="$name" + export -n "CONFIG_${CONFIG_SECTION}_TYPE=$cfgtype" +} + +option () { + local varname="$1"; shift + local value="$*" + + export -n "CONFIG_${CONFIG_SECTION}_${varname}=$value" + option_cb "$varname" "$*" +} + +config_rename() { + local OLD="$1" + local NEW="$2" + local oldvar + local newvar + + [ "$OLD" -a "$NEW" ] || return + for oldvar in `set | grep ^CONFIG_${OLD}_ | \ + sed -e 's/\(.*\)=.*$/\1/'` ; do + newvar="CONFIG_${NEW}_${oldvar##CONFIG_${OLD}_}" + eval "export -n \"$newvar=\${$oldvar}\"" + unset "$oldvar" + done + + [ "$CONFIG_SECTION" = "$OLD" ] && CONFIG_SECTION="$NEW" +} + +config_unset() { + config_set "$1" "$2" "" +} + +config_clear() { + local SECTION="$1" + local oldvar + + for oldvar in `set | grep ^CONFIG_${SECTION}_ | \ + sed -e 's/\(.*\)=.*$/\1/'` ; do + unset $oldvar + done +} + +config_load() { + local file="/etc/config/$1" + _C=0 + CONFIG_SECTION= + + [ -e "$file" ] && { + . $file + } || return 1 + + ${CONFIG_SECTION:+config_cb} +} + +config_get() { + case "$3" in + "") eval "echo \"\${CONFIG_${1}_${2}}\"";; + *) eval "export -n -- \"$1=\${CONFIG_${2}_${3}}\"";; + esac +} + +config_set() { + local section="$1" + local option="$2" + local value="$3" + export -n "CONFIG_${section}_${option}=$value" +} + +load_modules() { + sed 's/^[^#]/insmod &/' $* | ash 2>&- || : +} + +include() { + local file + + for file in $(ls $1/*.sh 2>/dev/null); do + . $file + done +} + +find_mtd_part() { + local PART="$(grep "\"$1\"" /proc/mtd | awk -F: '{print $1}')" + + PART="${PART##mtd}" + echo "${PART:+/dev/mtdblock/$PART}" +} + +strtok() { # <string> { <variable> [<separator>] ... } + local tmp + local val="$1" + local count=0 + + shift + + while [ $# -gt 1 ]; do + tmp="${val%%$2*}" + + [ "$tmp" = "$val" ] && break + + val="${val#$tmp$2}" + + export -n "$1=$tmp"; count=$((count+1)) + shift 2 + done + + if [ $# -gt 0 -a "$val" ]; then + export -n "$1=$val"; count=$((count+1)) + fi + + return $count +} diff --git a/package/base-files/files/etc/group b/package/base-files/files/etc/group new file mode 100644 index 0000000000..c4e77f316a --- /dev/null +++ b/package/base-files/files/etc/group @@ -0,0 +1,2 @@ +root:x:0: +nogroup:x:65534: diff --git a/package/base-files/files/etc/hosts b/package/base-files/files/etc/hosts new file mode 100644 index 0000000000..ce138ec1e6 --- /dev/null +++ b/package/base-files/files/etc/hosts @@ -0,0 +1 @@ +127.0.0.1 localhost OpenWrt diff --git a/package/base-files/files/etc/hotplug.d/block/01-mount b/package/base-files/files/etc/hotplug.d/block/01-mount new file mode 100755 index 0000000000..db8ccdabd6 --- /dev/null +++ b/package/base-files/files/etc/hotplug.d/block/01-mount @@ -0,0 +1,26 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +DEV=${DEVPATH##*/} +{ +echo "ACTION=$ACTION DEVPATH=$DEVPATH $0 $*" +case "$ACTION" in +add) + echo -ne "waiting for $DEV" + while [ ! -b /dev/$DEV ]; do { + echo -ne "." + sleep 1 + time=$((time+1)); [ $time -gt 10 ] && break + }; done + + [ ${DEV%%[0-9]} != ${DEV} ] && { + mkdir -p /tmp/$DEV + mount /dev/$DEV /tmp/$DEV -t auto -o sync + } + ;; +remove) + umount /tmp/$DEV && rmdir /tmp/$DEV + rm -f /dev/$DEV /tmp/$DEV + ;; +esac +} 2>&1 | logger diff --git a/package/base-files/files/etc/hotplug.d/net/10-net b/package/base-files/files/etc/hotplug.d/net/10-net new file mode 100644 index 0000000000..9b72338ce8 --- /dev/null +++ b/package/base-files/files/etc/hotplug.d/net/10-net @@ -0,0 +1,35 @@ +# Copyright (C) 2006 OpenWrt.org + +include /lib/network + +addif() { + scan_interfaces + local cfg="$(find_config "$INTERFACE")" + + # check the autoload setting + config_get auto "$cfg" auto + case "$auto" in + 1|on|enabled) setup_interface "$INTERFACE";; + esac + + + # find all vlan configurations for this interface and set them up as well + for ifc in $interfaces; do + config_get iftype "$ifc" type + config_get ifs "$ifc" device + for dev in $ifs; do + [ "${dev%%\.*}" = "$INTERFACE" -a "$dev" != "$INTERFACE" ] && { + add_vlan "$dev" + } + done + done +} + +case "$ACTION" in + add|register) + case "$PHYSDEVDRIVER" in + natsemi) sleep 1;; + esac + addif + ;; +esac diff --git a/package/base-files/files/etc/hotplug.d/usb/01-ln b/package/base-files/files/etc/hotplug.d/usb/01-ln new file mode 100755 index 0000000000..f9eda02988 --- /dev/null +++ b/package/base-files/files/etc/hotplug.d/usb/01-ln @@ -0,0 +1,33 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +case "$ACTION" in +add) + [ -f /sys/${DEVPATH}/idVendor -a "$(cat /sys/${DEVPATH}/idVendor)" -ne "0000" ] && { + cd /sys/${DEVPATH} + + NUM=${DEVPATH##*/} + HOST=$(find ${NUM}:*/host* -type d) + HOST=${HOST##*/host} + + echo -ne "waiting for disk" + + while [ ! -d "/dev/scsi/host${HOST}/bus0/target0/lun0" ]; do { + echo -ne "." + sleep 1; + time=$((time+1)); [ $time -gt 10 ] && break + }; done + echo + + cd /sys/bus/scsi/devices/${HOST}\:0\:0\:0 + for BLOCK in block:* ; do { + cd ${BLOCK} + BLOCK=${BLOCK##block\:} + ln -sf /dev/scsi/host${HOST}/bus0/target0/lun0/disc /dev/${BLOCK} + for DEV in ${BLOCK}*; do { + ln -sf /dev/scsi/host${HOST}/bus0/target0/lun0/part${DEV##$BLOCK} /dev/$DEV + }; done + }; done + } 2>&1 | logger + ;; +esac diff --git a/package/base-files/files/etc/init.d/boot b/package/base-files/files/etc/init.d/boot new file mode 100755 index 0000000000..c583652347 --- /dev/null +++ b/package/base-files/files/etc/init.d/boot @@ -0,0 +1,26 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +START=10 +start() { + [ -f /proc/mounts ] || /sbin/mount_root + [ -f /proc/jffs2_bbc ] && echo "S" > /proc/jffs2_bbc + vconfig set_name_type DEV_PLUS_VID_NO_PAD + + HOSTNAME=${wan_hostname%%.*} + echo ${HOSTNAME:=OpenWrt}>/proc/sys/kernel/hostname + + mkdir -p /var/run + mkdir -p /var/log + mkdir -p /var/lock + touch /var/log/wtmp + touch /var/log/lastlog + [ "$FAILSAFE" = "true" ] && touch /tmp/.failsafe + + # manually trigger hotplug before loading modules + for iface in $(awk -F: '/:/ {print $1}' /proc/net/dev); do + /usr/bin/env -i ACTION=add INTERFACE="$iface" /sbin/hotplug net + done + + load_modules /etc/modules.d/* +} diff --git a/package/base-files/files/etc/init.d/network b/package/base-files/files/etc/init.d/network new file mode 100755 index 0000000000..45d5311a7a --- /dev/null +++ b/package/base-files/files/etc/init.d/network @@ -0,0 +1,14 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006 OpenWrt.org + +START=40 +start() { + setup_switch() { return 0; } + + include /lib/network + setup_switch + [ -e /etc/config/wireless ] || \ + /sbin/wifi detect > /etc/config/wireless + /sbin/wifi up +} + diff --git a/package/base-files/files/etc/init.d/rcS b/package/base-files/files/etc/init.d/rcS new file mode 100755 index 0000000000..fe21d0398c --- /dev/null +++ b/package/base-files/files/etc/init.d/rcS @@ -0,0 +1,19 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +${FAILSAFE:+exit} + +# FIXME: add logging configuration +#[ -f /etc/config/network ] && . /etc/config/network +#eval $(ipcalc "$log_ipaddr") +#[ "$log_ipaddr" = "$IP" ] || log_ipaddr="" +syslogd -C 16 #${log_ipaddr:+-L -R $log_ipaddr} +klogd + +( + for i in /etc/rc.d/S*; do + $i boot 2>&1 + done + + sysctl -p >&- +) | logger -s -p 6 -t '' & diff --git a/package/base-files/files/etc/inittab b/package/base-files/files/etc/inittab new file mode 100644 index 0000000000..39e134cb16 --- /dev/null +++ b/package/base-files/files/etc/inittab @@ -0,0 +1,3 @@ +::sysinit:/etc/init.d/rcS +tts/0::askfirst:/bin/ash --login +#tts/1::askfirst:/bin/ash --login diff --git a/package/base-files/files/etc/ipkg.conf b/package/base-files/files/etc/ipkg.conf new file mode 100644 index 0000000000..2931d2cf80 --- /dev/null +++ b/package/base-files/files/etc/ipkg.conf @@ -0,0 +1,3 @@ +src snapshots http://openwrt.org/downloads/snapshots/$S/packages +dest root / +dest ram /tmp diff --git a/package/base-files/files/etc/passwd b/package/base-files/files/etc/passwd new file mode 100644 index 0000000000..3b660a0d4e --- /dev/null +++ b/package/base-files/files/etc/passwd @@ -0,0 +1,2 @@ +root:!:0:0:root:/tmp:/bin/ash +nobody:*:65534:65534:nobody:/var:/bin/false diff --git a/package/base-files/files/etc/profile b/package/base-files/files/etc/profile new file mode 100644 index 0000000000..ae514b0924 --- /dev/null +++ b/package/base-files/files/etc/profile @@ -0,0 +1,12 @@ +#!/bin/sh +[ -f /etc/banner ] && cat /etc/banner + +export PATH=/bin:/sbin:/usr/bin:/usr/sbin +export PS1='\u@\h:\w\$ ' + +alias more=less +[ -x /usr/bin/vim ] || alias vim=vi + +arp() { cat /proc/net/arp; } +ldd() { LD_TRACE_LOADED_OBJECTS=1 $*; } +reboot() { ifdown wan 2>&1 >/dev/null ; /sbin/reboot; } diff --git a/package/base-files/files/etc/protocols b/package/base-files/files/etc/protocols new file mode 100644 index 0000000000..53fecb6d3c --- /dev/null +++ b/package/base-files/files/etc/protocols @@ -0,0 +1,56 @@ +# Internet (IP) protocols +# +# Updated from http://www.iana.org/assignments/protocol-numbers and other +# sources. +# New protocols will be added on request if they have been officially +# assigned by IANA and are not historical. +# If you need a huge list of used numbers please install the nmap package. + +ip 0 IP # internet protocol, pseudo protocol number +#hopopt 0 HOPOPT # IPv6 Hop-by-Hop Option [RFC1883] +icmp 1 ICMP # internet control message protocol +igmp 2 IGMP # Internet Group Management +ggp 3 GGP # gateway-gateway protocol +ipencap 4 IP-ENCAP # IP encapsulated in IP (officially ``IP'') +st 5 ST # ST datagram mode +tcp 6 TCP # transmission control protocol +egp 8 EGP # exterior gateway protocol +igp 9 IGP # any private interior gateway (Cisco) +pup 12 PUP # PARC universal packet protocol +udp 17 UDP # user datagram protocol +hmp 20 HMP # host monitoring protocol +xns-idp 22 XNS-IDP # Xerox NS IDP +rdp 27 RDP # "reliable datagram" protocol +iso-tp4 29 ISO-TP4 # ISO Transport Protocol class 4 [RFC905] +xtp 36 XTP # Xpress Transfer Protocol +ddp 37 DDP # Datagram Delivery Protocol +idpr-cmtp 38 IDPR-CMTP # IDPR Control Message Transport +ipv6 41 IPv6 # Internet Protocol, version 6 +ipv6-route 43 IPv6-Route # Routing Header for IPv6 +ipv6-frag 44 IPv6-Frag # Fragment Header for IPv6 +idrp 45 IDRP # Inter-Domain Routing Protocol +rsvp 46 RSVP # Reservation Protocol +gre 47 GRE # General Routing Encapsulation +esp 50 IPSEC-ESP # Encap Security Payload [RFC2046] +ah 51 IPSEC-AH # Authentication Header [RFC2402] +skip 57 SKIP # SKIP +ipv6-icmp 58 IPv6-ICMP # ICMP for IPv6 +ipv6-nonxt 59 IPv6-NoNxt # No Next Header for IPv6 +ipv6-opts 60 IPv6-Opts # Destination Options for IPv6 +rspf 73 RSPF CPHB # Radio Shortest Path First (officially CPHB) +vmtp 81 VMTP # Versatile Message Transport +eigrp 88 EIGRP # Enhanced Interior Routing Protocol (Cisco) +ospf 89 OSPFIGP # Open Shortest Path First IGP +ax.25 93 AX.25 # AX.25 frames +ipip 94 IPIP # IP-within-IP Encapsulation Protocol +etherip 97 ETHERIP # Ethernet-within-IP Encapsulation [RFC3378] +encap 98 ENCAP # Yet Another IP encapsulation [RFC1241] +# 99 # any private encryption scheme +pim 103 PIM # Protocol Independent Multicast +ipcomp 108 IPCOMP # IP Payload Compression Protocol +vrrp 112 VRRP # Virtual Router Redundancy Protocol +l2tp 115 L2TP # Layer Two Tunneling Protocol [RFC2661] +isis 124 ISIS # IS-IS over IPv4 +sctp 132 SCTP # Stream Control Transmission Protocol +fc 133 FC # Fibre Channel + diff --git a/package/base-files/files/etc/rc.common b/package/base-files/files/etc/rc.common new file mode 100755 index 0000000000..7180b0f7fa --- /dev/null +++ b/package/base-files/files/etc/rc.common @@ -0,0 +1,83 @@ +#!/bin/sh +# Copyright (C) 2006 OpenWrt.org + +. $IPKG_INSTROOT/etc/functions.sh + +START=50 + +start() { + return 0 +} + +stop() { + return 0 +} + +reload() { + return 1 +} + +restart() { + stop + start +} + +boot() { + start +} + +shutdown() { + return 0 +} + +disable() { + name="$(basename "${initscript}")" + rm -f "$IPKG_INSTROOT"/etc/rc.d/S??$name +} + +enable() { + name="$(basename "${initscript}")" + disable + ln -s "/etc/init.d/$name" "$IPKG_INSTROOT/etc/rc.d/S${START}${name##S[0-9][0-9]}" +} + +depends() { + return 0 +} + +help() { + cat <<EOF +Syntax: $initscript [command] + +Available commands: + start Start the service + stop Stop the service + restart Restart the service + reload Reload configuration files (or restart if that fails) + enable Enable service autostart + disable Disable service autostart +$EXTRA_HELP +EOF +} + +initscript="$1" +action="$2" + +. "$initscript" + +cmds= +for cmd in $EXTRA_COMMANDS; do + cmds="${cmds:+$cmds$N}$cmd) $cmd;;" +done +eval "case \"\$action\" in + start) start;; + stop) stop;; + reload) reload || restart;; + restart) restart;; + boot) boot;; + shutdown) shutdown;; + enable) enable;; + disable) disable;; + $cmds + *) help;; +esac" diff --git a/package/base-files/files/etc/resolv.conf b/package/base-files/files/etc/resolv.conf new file mode 100644 index 0000000000..9617eacda7 --- /dev/null +++ b/package/base-files/files/etc/resolv.conf @@ -0,0 +1,2 @@ +nameserver 127.0.0.1 +search lan diff --git a/package/base-files/files/etc/shells b/package/base-files/files/etc/shells new file mode 100644 index 0000000000..006aa38ced --- /dev/null +++ b/package/base-files/files/etc/shells @@ -0,0 +1 @@ +/bin/ash diff --git a/package/base-files/files/etc/sysctl.conf b/package/base-files/files/etc/sysctl.conf new file mode 100644 index 0000000000..e60038cf35 --- /dev/null +++ b/package/base-files/files/etc/sysctl.conf @@ -0,0 +1,12 @@ +kernel.panic=3 +net.ipv4.conf.default.arp_ignore=1 +net.ipv4.conf.all.arp_ignore=1 +net.ipv4.ip_forward=1 +net.ipv4.icmp_echo_ignore_broadcasts=1 +net.ipv4.icmp_ignore_bogus_error_responses=1 +net.ipv4.tcp_fin_timeout=30 +net.ipv4.tcp_keepalive_time=120 +net.ipv4.tcp_syncookies=1 +net.ipv4.tcp_timestamps=0 +net.ipv4.ip_conntrack_tcp_timeouts="300 43200 120 60 120 120 10 60 30 120" +net.ipv4.ip_conntrack_udp_timeouts="60 180" |