diff options
Diffstat (limited to 'package/base-files/src/etc')
22 files changed, 96 insertions, 198 deletions
diff --git a/package/base-files/src/etc/banner b/package/base-files/src/etc/banner index 1ac725fd1..06cb2e4e3 100644 --- a/package/base-files/src/etc/banner +++ b/package/base-files/src/etc/banner @@ -4,5 +4,6 @@ | |_| | |_) | __/ | | |/ ___ \| |_| | . \ \___/| .__/ \___|_| |_/_/ \_\____/|_|\_\ |_| - Linux created with OpenADK + +Linux Embedded Appliance created with OpenADK diff --git a/package/base-files/src/etc/functions.sh b/package/base-files/src/etc/functions.sh index 5d76f4843..8b2b3d665 100644 --- a/package/base-files/src/etc/functions.sh +++ b/package/base-files/src/etc/functions.sh @@ -11,7 +11,9 @@ append() { } load_modules() { - (sed "s,^[^#][^[:space:]]*,insmod /lib/modules/$(uname -r)/&.ko," $* | sh 2>&- || :) + if [ -d /lib/modules/$(uname -r) ]; then + (sed "s,^[^#][^[:space:]]*,insmod /lib/modules/$(uname -r)/&.ko," $* | sh 2>&- || :) + fi } user_exists() { @@ -53,9 +55,9 @@ add_service() { } add_rcconf() { - rcconf_exists ${2-$1} || { - echo "adding service ${2-$1} to /etc/rc.conf" - printf '%s="%s"\t\t# %s\n' "${2:-$1}" "${3:-NO}" "$1" \ + rcconf_exists $1 || { + echo "adding service $1 to /etc/rc.conf" + printf '%s="%s"\n' "${1}" "${2:-NO}" \ >>$IPKG_INSTROOT/etc/rc.conf } } diff --git a/package/base-files/src/etc/group b/package/base-files/src/etc/group index bbf6c0603..51d78238c 100644 --- a/package/base-files/src/etc/group +++ b/package/base-files/src/etc/group @@ -1,4 +1,9 @@ root:x:0: -video:x:1: -audio:x:2: +daemon:x:1: +bin:x:2: +sys:x:3: +adm:x:4: +tty:x:5: +video:x:6: +audio:x:7: nogroup:x:65534: diff --git a/package/base-files/src/etc/init.d/boot b/package/base-files/src/etc/init.d/boot deleted file mode 100644 index e30360142..000000000 --- a/package/base-files/src/etc/init.d/boot +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/sh -#INIT 10 -[[ $1 = autostart ]] || exit 0 - -. /etc/functions.sh - -mkdir -p /var/log -mkdir -p /var/run -touch /var/log/lastlog -touch /var/log/wtmp -ln -s /tmp /var/tmp - -echo 0 > /proc/sys/kernel/printk - -HOSTNAME= -[[ -s /etc/hostname ]] && HOSTNAME=$(cat /etc/hostname) -HOSTNAME=${HOSTNAME%%.*} -echo ${HOSTNAME:=linux} >/proc/sys/kernel/hostname - -chown 0:0 /tmp; chmod 1777 /tmp - -load_modules /etc/modules -for f in /etc/modules.d/*; do - [[ -e $f ]] && load_modules /etc/modules.d/* - break -done -# settle down, after module load -sleep 2 -# any lvm volumes to activate? -[ -x /usr/sbin/lvm ] && { lvm vgscan; lvm vgchange -ay;} -# check and mount all filesystems not / -[ -f /etc/fstab ] && { fsck -p >/dev/null; mount -a; swapon -a;} -exit 0 diff --git a/package/base-files/src/etc/init.d/done b/package/base-files/src/etc/init.d/done deleted file mode 100644 index e5b655bb6..000000000 --- a/package/base-files/src/etc/init.d/done +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -#INIT 98 -[[ $1 = autostart ]] && sysctl -p >&- -exit 0 diff --git a/package/base-files/src/etc/init.d/rcK b/package/base-files/src/etc/init.d/rcK deleted file mode 100755 index 9d0e06440..000000000 --- a/package/base-files/src/etc/init.d/rcK +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -export PATH=/bin:/sbin:/usr/bin:/usr/sbin -{ - grep '^#INIT ' /etc/init.d/* | \ - sort -rnk2 | \ - while read line; do - shebang=$(sed -n '1s/^#![ ]*//p' ${line%%:*}) - case $shebang in - *[\ \ ]*) shebang=\'$(echo X"$shebang" | sed \ - -e 's/^X//' -e "s/'/'\\\\''/g" \ - -e 's/^\([^ ][^ ]*\)[ ]*$/\1/' \ - -e 's/^\([^ ][^ ]*\)[ ][ ]*\(..*\)$/\1 \2/' \ - -e 's/^\([^ ][^ ]*\) /\1'\'' '\''/')\' ;; - esac - ${shebang:-/bin/sh} ${line%%:*} autostop 2>&1 - done - test -e /etc/rc.shutdown && (/bin/sh /etc/rc.shutdown) 2>&1 -} | logger -s -p 6 -t '' diff --git a/package/base-files/src/etc/init.d/rcS b/package/base-files/src/etc/init.d/rcS deleted file mode 100755 index 55c86729c..000000000 --- a/package/base-files/src/etc/init.d/rcS +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -export PATH=/bin:/sbin:/usr/bin:/usr/sbin -{ - grep '^#INIT ' /etc/init.d/* | \ - sort -nk2 | \ - while read line; do - sh ${line%%:*} autostart 2>&1 - done - test -e /etc/init.d/boot.local && (/bin/sh /etc/init.d/boot.local) 2>&1 -} | logger -p 6 -t '' & diff --git a/package/base-files/src/etc/inittab b/package/base-files/src/etc/inittab deleted file mode 100644 index 79e69d931..000000000 --- a/package/base-files/src/etc/inittab +++ /dev/null @@ -1,2 +0,0 @@ -::sysinit:/etc/init.d/rcS -::shutdown:/etc/init.d/rcK diff --git a/package/base-files/src/etc/ipkg.conf b/package/base-files/src/etc/ipkg.conf deleted file mode 100644 index cef6d2845..000000000 --- a/package/base-files/src/etc/ipkg.conf +++ /dev/null @@ -1,3 +0,0 @@ -src @VENDOR@ http://@HOST@/@SYSTEM@_@ARCH@_@LIBC@/packages -dest root / -dest ram /tmp diff --git a/package/base-files/src/etc/mdev.conf b/package/base-files/src/etc/mdev.conf deleted file mode 100644 index 4cc06251a..000000000 --- a/package/base-files/src/etc/mdev.conf +++ /dev/null @@ -1,20 +0,0 @@ -null 0:0 777 -zero 0:0 666 -u?random 0:0 644 -console 0:0 600 -ptmx 0:0 666 -tty 0:0 666 -tty[0-9]* 0:0 666 -ttyS* 0:0 640 -rtc0 root:root 660 @ln -sf /dev/rtc0 /dev/rtc -device-mapper 0:0 660 @test -d /dev/mapper || mkdir /dev/mapper -tun 0:0 660 >net/tun -fb0 root:video 660 -audio root:audio 660 >snd/audio -dsp root:audio 660 >snd/dsp -timer root:audio 660 >snd/timer -controlC0 root:audio 660 >snd/controlC0 -pcmC0D0c root:audio 660 >snd/pcmC0D0c -pcmC0D0p root:audio 660 >snd/pcmC0D0p -msr0 root:root 660 @(mkdir -p /dev/cpu/0 && ln -sf /dev/msr0 /dev/cpu/0/msr) -.* 0:0 644 @/lib/mdev/init diff --git a/package/base-files/src/etc/modules b/package/base-files/src/etc/modules deleted file mode 100644 index 014f40f2b..000000000 --- a/package/base-files/src/etc/modules +++ /dev/null @@ -1 +0,0 @@ -# add modules to load on startup here diff --git a/package/base-files/src/etc/network/if-post-down.d/03-wireless b/package/base-files/src/etc/network/if-post-down.d/03-wireless index 86e0c73e1..a32e58781 100755 --- a/package/base-files/src/etc/network/if-post-down.d/03-wireless +++ b/package/base-files/src/etc/network/if-post-down.d/03-wireless @@ -1,5 +1,4 @@ -#!/bin/sh -set -e +#!/bin/sh [ "${IFACE%%[0-9]*}" = "wlan" ] || exit 0 @@ -11,7 +10,7 @@ case "$IF_WIRELESS_MODE" in sta) [ "$IF_WIRELESS_SECURITY" != "none" ] && { logger -t wireless "Killing wpa_supplicant" - pkill wpa_supplicant + kill -9 $(cat /var/run/wpa_supplicant.pid) } ;; *) diff --git a/package/base-files/src/etc/network/if-post-down.d/04-bonding b/package/base-files/src/etc/network/if-post-down.d/04-bonding new file mode 100755 index 000000000..0b9c9f362 --- /dev/null +++ b/package/base-files/src/etc/network/if-post-down.d/04-bonding @@ -0,0 +1,20 @@ +#!/bin/sh + +case "$IF_BOND_PORTS" in +"") + exit 0 + ;; +none) + INTERFACES="" + ;; +*) + INTERFACES="$IF_BOND_PORTS" + ;; +esac + +for IF in $INTERFACES; do + ip link set $IF nomaster + ip link set $IF down +done +ip link del $IFACE +exit 0 diff --git a/package/base-files/src/etc/network/if-pre-up.d/02-vlan b/package/base-files/src/etc/network/if-pre-up.d/02-vlan index 26b33ca80..f153df564 100755 --- a/package/base-files/src/etc/network/if-pre-up.d/02-vlan +++ b/package/base-files/src/etc/network/if-pre-up.d/02-vlan @@ -1,13 +1,7 @@ #!/bin/sh -which vconfig || { - echo "vconfig executable not found, aborting" - exit 0 -} -[ -d /proc/net/vlan ] || { - echo "no kernel support for 802.1q found, aborting" - exit 0 -} +which vconfig >/dev/null || exit 0 +[ -d /proc/net/vlan ] || exit 0 case "$IFACE" in vlan*) diff --git a/package/base-files/src/etc/network/if-pre-up.d/04-wireless b/package/base-files/src/etc/network/if-pre-up.d/04-wireless index ebcec5a12..ef070c5bc 100755 --- a/package/base-files/src/etc/network/if-pre-up.d/04-wireless +++ b/package/base-files/src/etc/network/if-pre-up.d/04-wireless @@ -1,18 +1,17 @@ #!/bin/sh -set -e [ "${IFACE%%[0-9]*}" = "wlan" ] || exit 0 [ "$IF_WIRELESS_SSID" ] || exit 1 -[ "$IF_WIRELESS_CHANNEL" ] || exit 1 [ "$IF_WIRELESS_HWMODE" ] || IF_WIRELESS_HWMODE=g [ "$IF_WIRELESS_EXTENSION" ] || IF_WIRELESS_EXTENSION=0 -rfkill unblock wlan 2>/dev/null +[ -x /usr/sbin/rfkill ] && rfkill unblock wlan 2>/dev/null wpa=0 wpa1=0 wpa2=0 +pairwise="" case "$IF_WIRELESS_SECURITY" in none) @@ -24,10 +23,12 @@ case "$IF_WIRELESS_SECURITY" in wpa) sec=1 wpa1=1 + pairwise=TKIP ;; wpa2) sec=1 wpa2=1 + pairwise=CCMP ;; wpa+wpa2) sec=1 @@ -38,6 +39,8 @@ case "$IF_WIRELESS_SECURITY" in ;; esac +[ "$IF_WIRELESS_PAIRWISE" ] || IF_WIRELESS_PAIRWISE=$pairwise + case "$IF_WIRELESS_MODE" in ap) logger -t hostap "Creating hostapd configuration" @@ -56,14 +59,14 @@ case "$IF_WIRELESS_MODE" in logger -t hostap "using WPA for security" echo "wpa=1" >> /tmp/hostapd.conf echo "wpa_key_mgmt=WPA-PSK" >> /tmp/hostapd.conf - echo "wpa_pairwise=TKIP" >> /tmp/hostapd.conf + echo "wpa_pairwise=$IF_WIRELESS_PAIRWISE" >> /tmp/hostapd.conf echo "wpa_passphrase=$IF_WIRELESS_PASSPHRASE" >> /tmp/hostapd.conf } [ $wpa2 -eq 1 ] && { logger -t hostap "using WPA2 for security" echo "wpa=2" >> /tmp/hostapd.conf echo "wpa_key_mgmt=WPA-PSK" >> /tmp/hostapd.conf - echo "rsn_pairwise=CCMP" >> /tmp/hostapd.conf + echo "rsn_pairwise=$IF_WIRELESS_PAIRWISE" >> /tmp/hostapd.conf echo "wpa_passphrase=$IF_WIRELESS_PASSPHRASE" >> /tmp/hostapd.conf } [ $wpa -eq 1 ] && { @@ -74,8 +77,12 @@ case "$IF_WIRELESS_MODE" in echo "rsn_pairwise=CCMP" >> /tmp/hostapd.conf echo "wpa_passphrase=$IF_WIRELESS_PASSPHRASE" >> /tmp/hostapd.conf } + [ -f /etc/hostapd.conf.post ] && \ + cat /etc/hostapd.conf.post >> /tmp/hostapd.conf ;; sta) + # need to wait for wlan drivers to settle down + sleep 1 ip link set up dev ${IFACE} [ $IF_WIRELESS_EXTENSION -eq 1 ] && { [ -x /usr/sbin/iwconfig ] || { @@ -90,8 +97,11 @@ case "$IF_WIRELESS_MODE" in exit 1 } driver=nl80211 - iw dev ${IFACE} set channel $IF_WIRELESS_CHANNEL - iw dev ${IFACE} connect $IF_WIRELESS_SSID + [ $sec -eq 2 ] && { + iw dev ${IFACE} connect "$IF_WIRELESS_SSID" key d:0:$IF_WIRELESS_PASSPHRASE + } || { + iw dev ${IFACE} connect "$IF_WIRELESS_SSID" 2>/dev/null + } } [ $wpa2 -eq 1 ] && { [ -x /usr/sbin/wpa_supplicant ] || { @@ -105,7 +115,7 @@ case "$IF_WIRELESS_MODE" in echo " psk=\"$IF_WIRELESS_PASSPHRASE\"" >> /tmp/wpa_supplicant.conf echo " priority=5" >> /tmp/wpa_supplicant.conf echo "}" >> /tmp/wpa_supplicant.conf - wpa_supplicant -B -D${driver} -i${IFACE} -c/tmp/wpa_supplicant.conf + wpa_supplicant -B -D${driver} -i${IFACE} -P/var/run/wpa_supplicant.pid -c/tmp/wpa_supplicant.conf } ;; *) diff --git a/package/base-files/src/etc/network/if-pre-up.d/05-bonding b/package/base-files/src/etc/network/if-pre-up.d/05-bonding new file mode 100755 index 000000000..489a2fcad --- /dev/null +++ b/package/base-files/src/etc/network/if-pre-up.d/05-bonding @@ -0,0 +1,37 @@ +#!/bin/sh + +INTERFACES="" +BONDOPTS="" +for var in $(env | grep '^IF_BOND_'); do + val="${var#*=}" + opt="${var%%=*}" + if [ "$opt" == "IF_BOND_PORTS" ]; then + case "$val" in + none) + INTERFACES="" + ;; + *) + INTERFACES="$val" + ;; + esac + continue + fi + opt="$(tr '[A-Z]' '[a-z]' <<< ${opt#IF_BOND_})" + BONDOPTS+=" $opt" + [ -n "$val" ] && BONDOPTS+=" $val" +done + +[ -n "$INTERFACES" ] || exit 0 + +ip link add $IFACE type bond ${BONDOPTS} || exit 1 +for IF in $INTERFACES; do + if ! grep -q $IF /proc/net/dev; then + echo "Error: interface '$IF' does not exist!" + ip link del $IFACE + exit 1 + fi + ip link set $IF master $IFACE + ip link set $IF up +done + +exit 0 diff --git a/package/base-files/src/etc/network/if-up.d/02-wireless b/package/base-files/src/etc/network/if-up.d/02-wireless index cd9d2af3f..1ec73fed2 100755 --- a/package/base-files/src/etc/network/if-up.d/02-wireless +++ b/package/base-files/src/etc/network/if-up.d/02-wireless @@ -1,5 +1,4 @@ #!/bin/sh -set -e [ "${IFACE%%[0-9]*}" = "wlan" ] || exit 0 diff --git a/package/base-files/src/etc/network/interfaces b/package/base-files/src/etc/network/interfaces deleted file mode 100644 index dbde94b80..000000000 --- a/package/base-files/src/etc/network/interfaces +++ /dev/null @@ -1,59 +0,0 @@ -auto lo -iface lo inet loopback - -auto eth0 -iface eth0 inet dhcp - -## static network configuration -#auto eth0 -#iface eth0 inet static -# address 192.168.1.1 -# netmask 255.255.255.0 -# broadcast + -# gateway 192.168.1.254 -## - -## bridge configuration -#auto br0 -#iface br0 inet static -# address 192.168.99.1 -# netmask 255.255.255.0 -# broadcast + -# bridge-ports eth0 eth1 -## - -## pppoe configuration -#auto ppp0 -#iface ppp0 inet ppp -# use-template pppoe -# provider isp -# ppp-mtu 1412 -# ppp-username foo -# ppp-password bar -# ppp-device eth1 -## - -## wireless client configuration -#auto wlan0 -#iface wlan0 inet dhcp -# wireless-ssid myap -# wireless-channel 11 -# wireless-mode sta -# wireless-security wpa2 -# wireless-passphrase xxxxxx -## - -## wireless accesspoint configuration -#auto wlan0 -#iface wlan0 inet static -# address 192.168.40.10 -# netmask 255.255.255.0 -# broadcast + -# wireless-ssid myap -# wireless-channel 8 -# wireless-mode ap -# wireless-security wpa2 -# wireless-passphrase xxxxxx -## - -# for more special cases see: http://www.openadk.org/doku.php?id=network diff --git a/package/base-files/src/etc/passwd b/package/base-files/src/etc/passwd index 32531eb92..30e0c23f9 100644 --- a/package/base-files/src/etc/passwd +++ b/package/base-files/src/etc/passwd @@ -1,2 +1,4 @@ root:x:0:0:root:/root:/bin/sh +daemon:x:1:1:daemon::/bin/false +bin:x:2:2:bin::/bin/false nobody:*:65534:65534:nobody:/var:/bin/false diff --git a/package/base-files/src/etc/profile b/package/base-files/src/etc/profile deleted file mode 100644 index 96f03b980..000000000 --- a/package/base-files/src/etc/profile +++ /dev/null @@ -1,15 +0,0 @@ -export PATH=/bin:/sbin:/usr/bin:/usr/sbin -export TERM=linux -export EDITOR=/bin/vi -if [[ $(id -u) = 0 ]]; then - export PS1='`whoami`@`hostname`:`pwd` # ' -else - export PS1='`whoami`@`hostname`:`pwd` $ ' -fi -cat /etc/banner 2>&- -[ -x /usr/bin/vim ] && alias vi=vim || alias vim=vi -[ -x /usr/bin/arp ] || arp() { cat /proc/net/arp; } -[ -x /usr/bin/ldd ] || ldd() { LD_TRACE_LOADED_OBJECTS=1 "$@"; } -alias l='ls -lF' -alias la='ls -A' -alias ll='ls -alF' diff --git a/package/base-files/src/etc/rc.shutdown b/package/base-files/src/etc/rc.shutdown deleted file mode 100644 index 8716dc59e..000000000 --- a/package/base-files/src/etc/rc.shutdown +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -cd / -sync -for i in $(grep -v ^# /etc/fstab 2>/dev/null|awk '{ print $2 }');do - umount $i 2>/dev/null -done diff --git a/package/base-files/src/etc/services b/package/base-files/src/etc/services new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/package/base-files/src/etc/services |
