From 2e44499238125dbecbbf17222496ebba315cc90c Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Thu, 4 Feb 2010 22:14:47 +0100 Subject: rename update to adkupdate --- package/base-files/extra/sbin/adkupdate | 75 +++++++++++++++++++++++++++++++++ package/base-files/extra/sbin/update | 75 --------------------------------- 2 files changed, 75 insertions(+), 75 deletions(-) create mode 100755 package/base-files/extra/sbin/adkupdate delete mode 100755 package/base-files/extra/sbin/update (limited to 'package/base-files') diff --git a/package/base-files/extra/sbin/adkupdate b/package/base-files/extra/sbin/adkupdate new file mode 100755 index 000000000..d41e23a0f --- /dev/null +++ b/package/base-files/extra/sbin/adkupdate @@ -0,0 +1,75 @@ +#!/bin/sh + +who=$(id -u) +if [ $who -ne 0 ]; then + echo 'Exit. System update must be run as root.' + exit 1 +fi + +if [ -x /sbin/mtd ];then + updatecmd="mtd -r write - linux" +else + updatecmd="gunzip -c | tar -xf -" +fi + +check_exit() { + if [ $? -ne 0 ];then + echo "Update failed." + exit 1 + fi +} + +prepare() { + cd / + umount -f /etc + mount -o remount,rw / +} + +extract_from_file() { + prepare + cat $1 | eval $updatecmd + check_exit +} + +extract_from_ssh() { + prepare + ssh $1 "cat $2" | eval $updatecmd + check_exit +} + +extract_from_http() { + prepare + wget -O - $1 | eval $updatecmd + check_exit +} + +case $1 in + file://*|/*) + url=$(echo $1|sed -e "s#file://##") + echo "Updating system from $1" + extract_from_file $url + ;; + ssh://*) + host=$(echo $1|sed -e "s#ssh://\(.*\):.*#\1#") + file=$(echo $1|sed -e "s#ssh://.*:\(.*\)#\1#") + echo "Updating system from $1" + extract_from_ssh $host $file + ;; + http://*|ftp://*) + echo "Updating system from $1" + extract_from_http $1 + ;; + *) + echo "No or wrong uri given. exit." + echo "Use one of the following uri:" + echo "http://myserver/myupdate.tar.gz" + echo "ssh://myuser@myserver:/my/path/myupdate.tar.gz" + echo "file:///mypath/myupdate.tar.gz" + exit 1 + ;; +esac + +sync +mount -o bind /etc /tmp/.cfgfs/root + +echo "Update sucessful. You should reboot now." diff --git a/package/base-files/extra/sbin/update b/package/base-files/extra/sbin/update deleted file mode 100755 index d41e23a0f..000000000 --- a/package/base-files/extra/sbin/update +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/sh - -who=$(id -u) -if [ $who -ne 0 ]; then - echo 'Exit. System update must be run as root.' - exit 1 -fi - -if [ -x /sbin/mtd ];then - updatecmd="mtd -r write - linux" -else - updatecmd="gunzip -c | tar -xf -" -fi - -check_exit() { - if [ $? -ne 0 ];then - echo "Update failed." - exit 1 - fi -} - -prepare() { - cd / - umount -f /etc - mount -o remount,rw / -} - -extract_from_file() { - prepare - cat $1 | eval $updatecmd - check_exit -} - -extract_from_ssh() { - prepare - ssh $1 "cat $2" | eval $updatecmd - check_exit -} - -extract_from_http() { - prepare - wget -O - $1 | eval $updatecmd - check_exit -} - -case $1 in - file://*|/*) - url=$(echo $1|sed -e "s#file://##") - echo "Updating system from $1" - extract_from_file $url - ;; - ssh://*) - host=$(echo $1|sed -e "s#ssh://\(.*\):.*#\1#") - file=$(echo $1|sed -e "s#ssh://.*:\(.*\)#\1#") - echo "Updating system from $1" - extract_from_ssh $host $file - ;; - http://*|ftp://*) - echo "Updating system from $1" - extract_from_http $1 - ;; - *) - echo "No or wrong uri given. exit." - echo "Use one of the following uri:" - echo "http://myserver/myupdate.tar.gz" - echo "ssh://myuser@myserver:/my/path/myupdate.tar.gz" - echo "file:///mypath/myupdate.tar.gz" - exit 1 - ;; -esac - -sync -mount -o bind /etc /tmp/.cfgfs/root - -echo "Update sucessful. You should reboot now." -- cgit v1.2.3 From 6daa792eab1488d013fefc5eb7e4d01f40f38687 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sun, 7 Feb 2010 20:03:20 +0100 Subject: change defaults for CONFIG/BUILD/INSTALL styles All packages need an update, so here is a very huge commit. Most of the 460 source packages use automatic style for configuration, building and installing. Make these styles default to "auto". If you have a package, which does not conform to this, just use manual style and add a do-$task make target. I added a new style named AUTOTOOL style, which is needed for some broken packages, which needs to be updated via autoconf or automake. I renamed CONFIGURE_STYLE to CONFIG_STYLE. Updates for some packages, which have newer upstream versions. Renaming of all package/*/extra directories. Use the directory src/ to provide overwrites of source files or to add the code, when no upstream package is available or used. src directory will be automatically used. --- package/base-files/Makefile | 4 +- package/base-files/extra/etc/banner | 1 - package/base-files/extra/etc/functions.sh | 79 ---------------------- package/base-files/extra/etc/group | 2 - package/base-files/extra/etc/hosts | 2 - package/base-files/extra/etc/init.d/boot | 27 -------- package/base-files/extra/etc/init.d/done | 4 -- package/base-files/extra/etc/init.d/rcK | 21 ------ package/base-files/extra/etc/init.d/rcS | 10 --- package/base-files/extra/etc/inittab | 4 -- package/base-files/extra/etc/ipkg.conf | 3 - package/base-files/extra/etc/mdev.conf | 11 --- package/base-files/extra/etc/modules | 1 - .../extra/etc/network/if-post-down.d/01-bridge | 26 ------- .../extra/etc/network/if-post-down.d/02-vlan | 10 --- .../extra/etc/network/if-pre-up.d/01-atm | 41 ----------- .../extra/etc/network/if-pre-up.d/02-vlan | 36 ---------- .../extra/etc/network/if-pre-up.d/03-bridge | 29 -------- .../base-files/extra/etc/network/if-up.d/01-bridge | 4 -- package/base-files/extra/etc/network/interfaces | 2 - package/base-files/extra/etc/passwd | 2 - package/base-files/extra/etc/profile | 12 ---- package/base-files/extra/etc/protocols | 45 ------------ package/base-files/extra/etc/rc.conf | 3 - package/base-files/extra/etc/shadow | 3 - package/base-files/extra/etc/sysctl.conf | 17 ----- package/base-files/extra/init | 22 ------ package/base-files/extra/lib/mdev/init | 21 ------ package/base-files/extra/sbin/update | 75 -------------------- .../extra/usr/share/udhcpc/default.script | 38 ----------- package/base-files/src/etc/banner | 1 + package/base-files/src/etc/functions.sh | 79 ++++++++++++++++++++++ package/base-files/src/etc/group | 2 + package/base-files/src/etc/hosts | 2 + package/base-files/src/etc/init.d/boot | 27 ++++++++ package/base-files/src/etc/init.d/done | 4 ++ package/base-files/src/etc/init.d/rcK | 21 ++++++ package/base-files/src/etc/init.d/rcS | 10 +++ package/base-files/src/etc/inittab | 4 ++ package/base-files/src/etc/ipkg.conf | 3 + package/base-files/src/etc/mdev.conf | 11 +++ package/base-files/src/etc/modules | 1 + .../src/etc/network/if-post-down.d/01-bridge | 26 +++++++ .../src/etc/network/if-post-down.d/02-vlan | 10 +++ .../base-files/src/etc/network/if-pre-up.d/01-atm | 41 +++++++++++ .../base-files/src/etc/network/if-pre-up.d/02-vlan | 36 ++++++++++ .../src/etc/network/if-pre-up.d/03-bridge | 29 ++++++++ .../base-files/src/etc/network/if-up.d/01-bridge | 4 ++ package/base-files/src/etc/network/interfaces | 2 + package/base-files/src/etc/passwd | 2 + package/base-files/src/etc/profile | 12 ++++ package/base-files/src/etc/protocols | 45 ++++++++++++ package/base-files/src/etc/rc.conf | 3 + package/base-files/src/etc/shadow | 3 + package/base-files/src/etc/sysctl.conf | 17 +++++ package/base-files/src/init | 22 ++++++ package/base-files/src/lib/mdev/init | 21 ++++++ package/base-files/src/sbin/update | 75 ++++++++++++++++++++ .../base-files/src/usr/share/udhcpc/default.script | 38 +++++++++++ 59 files changed, 554 insertions(+), 552 deletions(-) delete mode 100644 package/base-files/extra/etc/banner delete mode 100644 package/base-files/extra/etc/functions.sh delete mode 100644 package/base-files/extra/etc/group delete mode 100644 package/base-files/extra/etc/hosts delete mode 100644 package/base-files/extra/etc/init.d/boot delete mode 100644 package/base-files/extra/etc/init.d/done delete mode 100755 package/base-files/extra/etc/init.d/rcK delete mode 100755 package/base-files/extra/etc/init.d/rcS delete mode 100644 package/base-files/extra/etc/inittab delete mode 100644 package/base-files/extra/etc/ipkg.conf delete mode 100644 package/base-files/extra/etc/mdev.conf delete mode 100644 package/base-files/extra/etc/modules delete mode 100755 package/base-files/extra/etc/network/if-post-down.d/01-bridge delete mode 100755 package/base-files/extra/etc/network/if-post-down.d/02-vlan delete mode 100755 package/base-files/extra/etc/network/if-pre-up.d/01-atm delete mode 100755 package/base-files/extra/etc/network/if-pre-up.d/02-vlan delete mode 100755 package/base-files/extra/etc/network/if-pre-up.d/03-bridge delete mode 100755 package/base-files/extra/etc/network/if-up.d/01-bridge delete mode 100644 package/base-files/extra/etc/network/interfaces delete mode 100644 package/base-files/extra/etc/passwd delete mode 100644 package/base-files/extra/etc/profile delete mode 100644 package/base-files/extra/etc/protocols delete mode 100644 package/base-files/extra/etc/rc.conf delete mode 100644 package/base-files/extra/etc/shadow delete mode 100644 package/base-files/extra/etc/sysctl.conf delete mode 100755 package/base-files/extra/init delete mode 100644 package/base-files/extra/lib/mdev/init delete mode 100755 package/base-files/extra/sbin/update delete mode 100755 package/base-files/extra/usr/share/udhcpc/default.script create mode 100644 package/base-files/src/etc/banner create mode 100644 package/base-files/src/etc/functions.sh create mode 100644 package/base-files/src/etc/group create mode 100644 package/base-files/src/etc/hosts create mode 100644 package/base-files/src/etc/init.d/boot create mode 100644 package/base-files/src/etc/init.d/done create mode 100755 package/base-files/src/etc/init.d/rcK create mode 100755 package/base-files/src/etc/init.d/rcS create mode 100644 package/base-files/src/etc/inittab create mode 100644 package/base-files/src/etc/ipkg.conf create mode 100644 package/base-files/src/etc/mdev.conf create mode 100644 package/base-files/src/etc/modules create mode 100755 package/base-files/src/etc/network/if-post-down.d/01-bridge create mode 100755 package/base-files/src/etc/network/if-post-down.d/02-vlan create mode 100755 package/base-files/src/etc/network/if-pre-up.d/01-atm create mode 100755 package/base-files/src/etc/network/if-pre-up.d/02-vlan create mode 100755 package/base-files/src/etc/network/if-pre-up.d/03-bridge create mode 100755 package/base-files/src/etc/network/if-up.d/01-bridge create mode 100644 package/base-files/src/etc/network/interfaces create mode 100644 package/base-files/src/etc/passwd create mode 100644 package/base-files/src/etc/profile create mode 100644 package/base-files/src/etc/protocols create mode 100644 package/base-files/src/etc/rc.conf create mode 100644 package/base-files/src/etc/shadow create mode 100644 package/base-files/src/etc/sysctl.conf create mode 100755 package/base-files/src/init create mode 100644 package/base-files/src/lib/mdev/init create mode 100755 package/base-files/src/sbin/update create mode 100755 package/base-files/src/usr/share/udhcpc/default.script (limited to 'package/base-files') diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 92949ea13..e771a5084 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -18,11 +18,13 @@ include $(TOPDIR)/mk/package.mk $(eval $(call PKG_template,BASE_FILES,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) PKGDFLT_BASE_FILES= y if !ADK_TOOLCHAIN_ONLY + +CONFIG_STYLE:= manual BUILD_STYLE:= manual INSTALL_STYLE:= manual do-install: - $(CP) ./extra/* $(IDIR_BASE_FILES) + $(CP) ./src/* $(IDIR_BASE_FILES) $(CP) $(TOPDIR)/target/$(ADK_TARGET)/files/* $(IDIR_BASE_FILES) ifeq (${ADK_TARGET_ROOTFS_NFSROOT},y) @-rm $(IDIR_BASE_FILES)/etc/network/interfaces diff --git a/package/base-files/extra/etc/banner b/package/base-files/extra/etc/banner deleted file mode 100644 index 49dbb9685..000000000 --- a/package/base-files/extra/etc/banner +++ /dev/null @@ -1 +0,0 @@ - Linux created with OpenADK diff --git a/package/base-files/extra/etc/functions.sh b/package/base-files/extra/etc/functions.sh deleted file mode 100644 index 5d76f4843..000000000 --- a/package/base-files/extra/etc/functions.sh +++ /dev/null @@ -1,79 +0,0 @@ -# newline -N=" -" - -append() { - local var="$1" - local value="$2" - local sep="${3:- }" - - eval "export -- \"$var=\${$var:+\${$var}\${value:+\$sep}}\$value\"" -} - -load_modules() { - (sed "s,^[^#][^[:space:]]*,insmod /lib/modules/$(uname -r)/&.ko," $* | sh 2>&- || :) -} - -user_exists() { - grep -q "^$1:" $IPKG_INSTROOT/etc/passwd 2>&- -} - -group_exists() { - grep -q "^$1:" $IPKG_INSTROOT/etc/group 2>&- -} - -service_exists() { - grep -q "^$1[[:space:]]*$2" $IPKG_INSTROOT/etc/services 2>&- -} - -rcconf_exists() { - grep -q "^#*$1=" $IPKG_INSTROOT/etc/rc.conf 2>&- -} - -add_user() { - user_exists $1 || { - echo "adding user $1 to /etc/passwd" - echo "$1:x:$2:${3:-$2}:$1:${4:-/tmp}:${5:-/bin/false}" \ - >>$IPKG_INSTROOT/etc/passwd - } -} - -add_group() { - group_exists $1 || { - echo "adding group $1 to /etc/group" - echo "$1:x:$2:$3" >>$IPKG_INSTROOT/etc/group - } -} - -add_service() { - service_exists $1 $2 || { - echo "adding service $1 to /etc/services" - printf '%s\t%s\n' "$1" "$2" >>$IPKG_INSTROOT/etc/services - } -} - -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" \ - >>$IPKG_INSTROOT/etc/rc.conf - } -} - -get_next_uid() { - uid=1 - while grep "^[^:]*:[^:]*:$uid:" $IPKG_INSTROOT/etc/passwd \ - >/dev/null 2>&1; do - uid=$(($uid+1)) - done - echo $uid -} - -get_next_gid() { - gid=1 - while grep "^[^:]*:[^:]*:$gid:" $IPKG_INSTROOT/etc/group \ - >/dev/null 2>&1; do - gid=$(($gid+1)) - done - echo $gid -} diff --git a/package/base-files/extra/etc/group b/package/base-files/extra/etc/group deleted file mode 100644 index c4e77f316..000000000 --- a/package/base-files/extra/etc/group +++ /dev/null @@ -1,2 +0,0 @@ -root:x:0: -nogroup:x:65534: diff --git a/package/base-files/extra/etc/hosts b/package/base-files/extra/etc/hosts deleted file mode 100644 index 87d837fc7..000000000 --- a/package/base-files/extra/etc/hosts +++ /dev/null @@ -1,2 +0,0 @@ -::1 localhost -127.0.0.1 localhost diff --git a/package/base-files/extra/etc/init.d/boot b/package/base-files/extra/etc/init.d/boot deleted file mode 100644 index f71e46240..000000000 --- a/package/base-files/extra/etc/init.d/boot +++ /dev/null @@ -1,27 +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 /var/tmp /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 -exit 0 diff --git a/package/base-files/extra/etc/init.d/done b/package/base-files/extra/etc/init.d/done deleted file mode 100644 index e5b655bb6..000000000 --- a/package/base-files/extra/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/extra/etc/init.d/rcK b/package/base-files/extra/etc/init.d/rcK deleted file mode 100755 index e94d1a296..000000000 --- a/package/base-files/extra/etc/init.d/rcK +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -export PATH=/bin:/sbin:/usr/bin:/usr/sbin -busybox reboot -d 60 -f & # just in case… -{ - [[ -f /proc/diag/led/power ]] && echo f >/proc/diag/led/power - test -e /etc/rc.shutdown && (/bin/sh /etc/rc.shutdown) 2>&1 - 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 - [[ -f /proc/diag/led/power ]] && echo 0 >/proc/diag/led/power -} | logger -s -p 6 -t '' diff --git a/package/base-files/extra/etc/init.d/rcS b/package/base-files/extra/etc/init.d/rcS deleted file mode 100755 index fd56feebf..000000000 --- a/package/base-files/extra/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 - /bin/sh ${line%%:*} autostart 2>&1 - done - test -e /etc/init.d/boot.local && (/bin/sh /etc/init.d/boot.local) 2>&1 -} | logger -s -p 6 -t '' & diff --git a/package/base-files/extra/etc/inittab b/package/base-files/extra/etc/inittab deleted file mode 100644 index 960ea77d8..000000000 --- a/package/base-files/extra/etc/inittab +++ /dev/null @@ -1,4 +0,0 @@ -::sysinit:/etc/init.d/rcS -::shutdown:/etc/init.d/rcK -ttyS0::respawn:/sbin/getty -i -L ttyS0 115200 vt100 - diff --git a/package/base-files/extra/etc/ipkg.conf b/package/base-files/extra/etc/ipkg.conf deleted file mode 100644 index 6c9242620..000000000 --- a/package/base-files/extra/etc/ipkg.conf +++ /dev/null @@ -1,3 +0,0 @@ -src openadk http://www.openadk.org/packages/@TARGET@ -dest root / -dest ram /tmp diff --git a/package/base-files/extra/etc/mdev.conf b/package/base-files/extra/etc/mdev.conf deleted file mode 100644 index 99c910d0b..000000000 --- a/package/base-files/extra/etc/mdev.conf +++ /dev/null @@ -1,11 +0,0 @@ -tun 0:0 660 >net/tun -null 0:0 777 -zero 0:0 666 -console 0:0 0600 -kmem 0:0 000 -mem 0:0 0640 -port 0:0 0640 -ptmx 0:0 666 -tty 0:0 0666 -ttyS* 0:0 640 -.* 0:0 644 @/lib/mdev/init diff --git a/package/base-files/extra/etc/modules b/package/base-files/extra/etc/modules deleted file mode 100644 index 014f40f2b..000000000 --- a/package/base-files/extra/etc/modules +++ /dev/null @@ -1 +0,0 @@ -# add modules to load on startup here diff --git a/package/base-files/extra/etc/network/if-post-down.d/01-bridge b/package/base-files/extra/etc/network/if-post-down.d/01-bridge deleted file mode 100755 index 47f3c976b..000000000 --- a/package/base-files/extra/etc/network/if-post-down.d/01-bridge +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh - -if [ ! -x /usr/sbin/brctl ] -then - exit 0 -fi - -case "$IF_BRIDGE_PORTS" in - "") - exit 0 - ;; - none) - INTERFACES="" - ;; - *) - INTERFACES="$IF_BRIDGE_PORTS" - ;; -esac - -for IF in $INTERFACES; do - ip link set down dev $IF && brctl delif $IFACE $IF -done - -ip link set down dev $IFACE || exit 1 -brctl delbr $IFACE -exit 0 diff --git a/package/base-files/extra/etc/network/if-post-down.d/02-vlan b/package/base-files/extra/etc/network/if-post-down.d/02-vlan deleted file mode 100755 index e448a7641..000000000 --- a/package/base-files/extra/etc/network/if-post-down.d/02-vlan +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -[ -x /sbin/vconfig ] || exit 0 - -[ -e /proc/net/vlan/$IFACE ] && ( - ip link set down dev $IFACE - vconfig rem $IFACE -) - -exit 0 diff --git a/package/base-files/extra/etc/network/if-pre-up.d/01-atm b/package/base-files/extra/etc/network/if-pre-up.d/01-atm deleted file mode 100755 index 5c168c001..000000000 --- a/package/base-files/extra/etc/network/if-pre-up.d/01-atm +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh - -[ -x /usr/sbin/br2684ctl ] || exit 0 - -[ "${IFACE%%[0-9]*}" = "nas" ] || exit 0 - -[ "$IF_ATM_ENCAPS" ] || encap=0 -[ "$IF_ATM_PAYLOAD" ] || payload=1 -[ "$IF_ATM_VPI" ] || IF_ATM_VPI=1 -[ "$IF_ATM_VCI" ] || IF_ATM_VCI=32 - -[ "$IF_ATM_PAYLOAD" ] && case "$IF_ATM_PAYLOAD" in -bridged) - payload=1 - ;; -routed) - payload=0 - ;; -*) - echo "Wrong payload, use either bridged or routed" - exit 1 - ;; -esac - -[ "$IF_ATM_ENCAPS" ] && case "$IF_ATM_ENCAPS" in -llc) - encap=0 - ;; -vc) - encap=1 - ;; -*) - echo "Wrong Encapsulation use either llc or vc" - exit 1 - ;; -esac - -br2684ctl -b -c ${IFACE##*[a-z]} -e $encap -p $payload -a $IF_ATM_VPI.$IF_ATM_VCI -ifconfig nas${IFACE##*[a-z]} up - -exit 0 diff --git a/package/base-files/extra/etc/network/if-pre-up.d/02-vlan b/package/base-files/extra/etc/network/if-pre-up.d/02-vlan deleted file mode 100755 index 35b7fca59..000000000 --- a/package/base-files/extra/etc/network/if-pre-up.d/02-vlan +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -[ -x /sbin/vconfig ] || exit 0 -[ -d /proc/net/vlan ] || exit 0 - -case "$IFACE" in - vlan*) - vconfig set_name_type VLAN_PLUS_VID_NO_PAD - VLANID=`echo $IFACE|sed "s/vlan*//"` - ;; - eth*.*) - vconfig set_name_type DEV_PLUS_VID_NO_PAD - VLANID=`echo $IFACE|sed "s/eth[0-9][0-9]*\.*//g"` - IF_VLAN_RAW_DEVICE=`echo $IFACE|sed "s/\(eth[0-9][0-9]*\)\..*/\1/"` - ;; - *) - exit 0 - ;; -esac - -if [ "$IF_VLAN_RAW_DEVICE" != "" ]; then - if ! grep -q "$IF_VLAN_RAW_DEVICE" /proc/net/dev - then - echo "$IF_VLAN_RAW_DEVICE does not exist, unable to create $IFACE" - exit 1 - fi - ip link set up dev $IF_VLAN_RAW_DEVICE - vconfig add $IF_VLAN_RAW_DEVICE $VLANID - if [ "$IF_MAC_ADDRESS" != "" ] - then - ip link set $IF_VLAN_RAW_DEVICE.$VLANID address $IF_MAC_ADDRESS - fi - ip link set up dev $IF_VLAN_RAW_DEVICE.$VLANID -fi - -exit 0 diff --git a/package/base-files/extra/etc/network/if-pre-up.d/03-bridge b/package/base-files/extra/etc/network/if-pre-up.d/03-bridge deleted file mode 100755 index 41ddb2b58..000000000 --- a/package/base-files/extra/etc/network/if-pre-up.d/03-bridge +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -[ -x /usr/sbin/brctl ] || exit 0 - -case "$IF_BRIDGE_PORTS" in - "") - exit 0 - ;; - none) - INTERFACES="" - ;; - *) - INTERFACES="$IF_BRIDGE_PORTS" - ;; -esac - -brctl addbr $IFACE || exit 1 - -for IF in $INTERFACES; do - if ! grep -q $IF /proc/net/dev; then - echo "Error: interface '$IF' does not exist!" - brctl delbr $IFACE - exit 1 - fi - brctl addif $IFACE $IF - ip link set up dev $IF -done - -exit 0 diff --git a/package/base-files/extra/etc/network/if-up.d/01-bridge b/package/base-files/extra/etc/network/if-up.d/01-bridge deleted file mode 100755 index e5962f12f..000000000 --- a/package/base-files/extra/etc/network/if-up.d/01-bridge +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh - -[ "${IFACE%%[0-9]*}" = "br" ] && ip link set up dev $IFACE -exit 0 diff --git a/package/base-files/extra/etc/network/interfaces b/package/base-files/extra/etc/network/interfaces deleted file mode 100644 index f1bd92ed2..000000000 --- a/package/base-files/extra/etc/network/interfaces +++ /dev/null @@ -1,2 +0,0 @@ -auto lo -iface lo inet loopback diff --git a/package/base-files/extra/etc/passwd b/package/base-files/extra/etc/passwd deleted file mode 100644 index 32531eb92..000000000 --- a/package/base-files/extra/etc/passwd +++ /dev/null @@ -1,2 +0,0 @@ -root:x:0:0:root:/root:/bin/sh -nobody:*:65534:65534:nobody:/var:/bin/false diff --git a/package/base-files/extra/etc/profile b/package/base-files/extra/etc/profile deleted file mode 100644 index 1b8f4a6a6..000000000 --- a/package/base-files/extra/etc/profile +++ /dev/null @@ -1,12 +0,0 @@ -export PATH=/bin:/sbin:/usr/bin:/usr/sbin -export TERM=vt220 -if [[ $(id -u) = 0 ]]; then - export PS1='# ' -else - export PS1='$ ' - export HOME=/tmp -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 "$@"; } diff --git a/package/base-files/extra/etc/protocols b/package/base-files/extra/etc/protocols deleted file mode 100644 index dfe58ed22..000000000 --- a/package/base-files/extra/etc/protocols +++ /dev/null @@ -1,45 +0,0 @@ -ip 0 IP -icmp 1 ICMP -igmp 2 IGMP -ggp 3 GGP -ipencap 4 IP-ENCAP -st 5 ST -tcp 6 TCP -egp 8 EGP -igp 9 IGP -pup 12 PUP -udp 17 UDP -hmp 20 HMP -xns-idp 22 XNS-IDP -rdp 27 RDP -iso-tp4 29 ISO-TP4 -xtp 36 XTP -ddp 37 DDP -idpr-cmtp 38 IDPR-CMTP -ipv6 41 IPv6 -ipv6-route 43 IPv6-Route -ipv6-frag 44 IPv6-Frag -idrp 45 IDRP -rsvp 46 RSVP -gre 47 GRE -esp 50 IPSEC-ESP -ah 51 IPSEC-AH -skip 57 SKIP -ipv6-icmp 58 IPv6-ICMP -ipv6-nonxt 59 IPv6-NoNxt -ipv6-opts 60 IPv6-Opts -rspf 73 RSPF CPHB -vmtp 81 VMTP -eigrp 88 EIGRP -ospf 89 OSPFIGP -ax.25 93 AX.25 -ipip 94 IPIP -etherip 97 ETHERIP -encap 98 ENCAP -pim 103 PIM -ipcomp 108 IPCOMP -vrrp 112 VRRP -l2tp 115 L2TP -isis 124 ISIS -sctp 132 SCTP -fc 133 FC diff --git a/package/base-files/extra/etc/rc.conf b/package/base-files/extra/etc/rc.conf deleted file mode 100644 index 024007589..000000000 --- a/package/base-files/extra/etc/rc.conf +++ /dev/null @@ -1,3 +0,0 @@ -# set variables service=YES|NO (YES to enable, NO to disable) -# set variables service_flags="X" (NO to disable the service) -# note: for flags, X can be empty diff --git a/package/base-files/extra/etc/shadow b/package/base-files/extra/etc/shadow deleted file mode 100644 index 3683d71ea..000000000 --- a/package/base-files/extra/etc/shadow +++ /dev/null @@ -1,3 +0,0 @@ -root:$1$8sJkb6fV$46vEIu5ntmbUuljmr55zY/:14191:0::::: -admin:$1$8sJkb6fV$46vEIu5ntmbUuljmr55zY/:14191:0::::: -nobody:*:9797:0::::: diff --git a/package/base-files/extra/etc/sysctl.conf b/package/base-files/extra/etc/sysctl.conf deleted file mode 100644 index 73260cf9d..000000000 --- a/package/base-files/extra/etc/sysctl.conf +++ /dev/null @@ -1,17 +0,0 @@ -# Disables the magic-sysrq key -#kernel.sysrq = 0 -# When the kernel panics, automatically reboot in 3 seconds -#kernel.panic = 3 -# Enable packet forwarding -#net.ipv4.ip_forward = 1 -# Disables IP dynaddr -#net.ipv4.ip_dynaddr = 0 -# Disable ECN -#net.ipv4.tcp_ecn = 0 -# Enables source route verification -net.ipv4.conf.default.rp_filter = 1 -# Enable reverse path -net.ipv4.conf.all.rp_filter = 1 -# Enable SYN cookies -#net.ipv4.tcp_syncookies = 1 - diff --git a/package/base-files/extra/init b/package/base-files/extra/init deleted file mode 100755 index 618547693..000000000 --- a/package/base-files/extra/init +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -echo "System initialization ..." -export PATH=/bin:/sbin:/usr/bin:/usr/sbin -mount -nt proc proc /proc -mount -o nosuid,nodev,noexec -t sysfs sysfs /sys -[ ! -f /etc/notmpfs ] && { - size=$(awk '/MemTotal:/ { if ($2 > 16000) { print 4096 } else { print 2048 }}' /proc/meminfo) - mount none /tmp -t tmpfs -o size=${size}k - mount none /tmp -t tmpfs -o remount,nosuid,nodev,mode=1777 -} -mount -o nosuid,size=128k,mode=0755 -t tmpfs mdev /dev -mkdir /dev/pts /dev/shm -mount -o nosuid,noexec -t devpts devpts /dev/pts -exec 0<>/dev/console >&0 2>&0 -echo >/dev/mdev.seq -echo "/sbin/mdev" >/proc/sys/kernel/hotplug -mdev -s -mount -o remount,rw / -cat /etc/.rnd >/dev/urandom 2>&1 -[ -f /etc/fstab ] && mount -a -[ -x /sbin/cfgfs ] && { cfgfs setup; mount -o remount,ro /;} -exec /sbin/init diff --git a/package/base-files/extra/lib/mdev/init b/package/base-files/extra/lib/mdev/init deleted file mode 100644 index d2ae13e9c..000000000 --- a/package/base-files/extra/lib/mdev/init +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -if [ "$ACTION" == "add" ];then - if [ "$DEVPATH" == "/bus/usb" ];then - mount -t usbfs usbfs /proc/bus/usb - fi -fi -if [ "$SUBSYSTEM" == "firmware" ];then - logger "Firmware load for $FIRMWARE requested" - if [ "$ACTION" == "add" ];then - if [ -e "/lib/firmware/$FIRMWARE" ];then - logger "Firmware loading ..." - echo 1 > /sys$DEVPATH/loading - cat "/lib/firmware/$FIRMWARE" > /sys$DEVPATH/data - echo 0 > /sys$DEVPATH/loading - logger "finished." - else - logger "Firmware file $FIRMWARE not found" - echo -1 > /sys$DEVPATH/loading - fi - fi -fi diff --git a/package/base-files/extra/sbin/update b/package/base-files/extra/sbin/update deleted file mode 100755 index d41e23a0f..000000000 --- a/package/base-files/extra/sbin/update +++ /dev/null @@ -1,75 +0,0 @@ -#!/bin/sh - -who=$(id -u) -if [ $who -ne 0 ]; then - echo 'Exit. System update must be run as root.' - exit 1 -fi - -if [ -x /sbin/mtd ];then - updatecmd="mtd -r write - linux" -else - updatecmd="gunzip -c | tar -xf -" -fi - -check_exit() { - if [ $? -ne 0 ];then - echo "Update failed." - exit 1 - fi -} - -prepare() { - cd / - umount -f /etc - mount -o remount,rw / -} - -extract_from_file() { - prepare - cat $1 | eval $updatecmd - check_exit -} - -extract_from_ssh() { - prepare - ssh $1 "cat $2" | eval $updatecmd - check_exit -} - -extract_from_http() { - prepare - wget -O - $1 | eval $updatecmd - check_exit -} - -case $1 in - file://*|/*) - url=$(echo $1|sed -e "s#file://##") - echo "Updating system from $1" - extract_from_file $url - ;; - ssh://*) - host=$(echo $1|sed -e "s#ssh://\(.*\):.*#\1#") - file=$(echo $1|sed -e "s#ssh://.*:\(.*\)#\1#") - echo "Updating system from $1" - extract_from_ssh $host $file - ;; - http://*|ftp://*) - echo "Updating system from $1" - extract_from_http $1 - ;; - *) - echo "No or wrong uri given. exit." - echo "Use one of the following uri:" - echo "http://myserver/myupdate.tar.gz" - echo "ssh://myuser@myserver:/my/path/myupdate.tar.gz" - echo "file:///mypath/myupdate.tar.gz" - exit 1 - ;; -esac - -sync -mount -o bind /etc /tmp/.cfgfs/root - -echo "Update sucessful. You should reboot now." diff --git a/package/base-files/extra/usr/share/udhcpc/default.script b/package/base-files/extra/usr/share/udhcpc/default.script deleted file mode 100755 index 02e4a7a3c..000000000 --- a/package/base-files/extra/usr/share/udhcpc/default.script +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -if [[ -z $1 ]]; then - echo "Error: should be run by udhcpc" - exit 1 -fi - -RESOLV_CONF=/tmp/resolv.conf - -case $1 in -(deconfig) - ip addr flush $interface - ;; -(renew|bound) - ip addr add $ip/${mask:-24} brd + dev $interface - - if [[ -n $router ]]; then - echo "deleting routers" - while ip route del default >&- 2>&-; do :; done - - for i in $router; do - echo "adding router $i" - ip route add to default via $i - done - fi - - echo -n >$RESOLV_CONF - ${domain:+echo search $domain} >>$RESOLV_CONF - for i in $dns; do - echo "adding dns $i" - echo "nameserver $i" >>$RESOLV_CONF - done - - # user rules - [ -f /etc/udhcpc.user ] && . /etc/udhcpc.user -;; -esac - -exit $? diff --git a/package/base-files/src/etc/banner b/package/base-files/src/etc/banner new file mode 100644 index 000000000..49dbb9685 --- /dev/null +++ b/package/base-files/src/etc/banner @@ -0,0 +1 @@ + Linux created with OpenADK diff --git a/package/base-files/src/etc/functions.sh b/package/base-files/src/etc/functions.sh new file mode 100644 index 000000000..5d76f4843 --- /dev/null +++ b/package/base-files/src/etc/functions.sh @@ -0,0 +1,79 @@ +# newline +N=" +" + +append() { + local var="$1" + local value="$2" + local sep="${3:- }" + + eval "export -- \"$var=\${$var:+\${$var}\${value:+\$sep}}\$value\"" +} + +load_modules() { + (sed "s,^[^#][^[:space:]]*,insmod /lib/modules/$(uname -r)/&.ko," $* | sh 2>&- || :) +} + +user_exists() { + grep -q "^$1:" $IPKG_INSTROOT/etc/passwd 2>&- +} + +group_exists() { + grep -q "^$1:" $IPKG_INSTROOT/etc/group 2>&- +} + +service_exists() { + grep -q "^$1[[:space:]]*$2" $IPKG_INSTROOT/etc/services 2>&- +} + +rcconf_exists() { + grep -q "^#*$1=" $IPKG_INSTROOT/etc/rc.conf 2>&- +} + +add_user() { + user_exists $1 || { + echo "adding user $1 to /etc/passwd" + echo "$1:x:$2:${3:-$2}:$1:${4:-/tmp}:${5:-/bin/false}" \ + >>$IPKG_INSTROOT/etc/passwd + } +} + +add_group() { + group_exists $1 || { + echo "adding group $1 to /etc/group" + echo "$1:x:$2:$3" >>$IPKG_INSTROOT/etc/group + } +} + +add_service() { + service_exists $1 $2 || { + echo "adding service $1 to /etc/services" + printf '%s\t%s\n' "$1" "$2" >>$IPKG_INSTROOT/etc/services + } +} + +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" \ + >>$IPKG_INSTROOT/etc/rc.conf + } +} + +get_next_uid() { + uid=1 + while grep "^[^:]*:[^:]*:$uid:" $IPKG_INSTROOT/etc/passwd \ + >/dev/null 2>&1; do + uid=$(($uid+1)) + done + echo $uid +} + +get_next_gid() { + gid=1 + while grep "^[^:]*:[^:]*:$gid:" $IPKG_INSTROOT/etc/group \ + >/dev/null 2>&1; do + gid=$(($gid+1)) + done + echo $gid +} diff --git a/package/base-files/src/etc/group b/package/base-files/src/etc/group new file mode 100644 index 000000000..c4e77f316 --- /dev/null +++ b/package/base-files/src/etc/group @@ -0,0 +1,2 @@ +root:x:0: +nogroup:x:65534: diff --git a/package/base-files/src/etc/hosts b/package/base-files/src/etc/hosts new file mode 100644 index 000000000..87d837fc7 --- /dev/null +++ b/package/base-files/src/etc/hosts @@ -0,0 +1,2 @@ +::1 localhost +127.0.0.1 localhost diff --git a/package/base-files/src/etc/init.d/boot b/package/base-files/src/etc/init.d/boot new file mode 100644 index 000000000..f71e46240 --- /dev/null +++ b/package/base-files/src/etc/init.d/boot @@ -0,0 +1,27 @@ +#!/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 /var/tmp /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 +exit 0 diff --git a/package/base-files/src/etc/init.d/done b/package/base-files/src/etc/init.d/done new file mode 100644 index 000000000..e5b655bb6 --- /dev/null +++ b/package/base-files/src/etc/init.d/done @@ -0,0 +1,4 @@ +#!/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 new file mode 100755 index 000000000..e94d1a296 --- /dev/null +++ b/package/base-files/src/etc/init.d/rcK @@ -0,0 +1,21 @@ +#!/bin/sh +export PATH=/bin:/sbin:/usr/bin:/usr/sbin +busybox reboot -d 60 -f & # just in case… +{ + [[ -f /proc/diag/led/power ]] && echo f >/proc/diag/led/power + test -e /etc/rc.shutdown && (/bin/sh /etc/rc.shutdown) 2>&1 + 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 + [[ -f /proc/diag/led/power ]] && echo 0 >/proc/diag/led/power +} | 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 new file mode 100755 index 000000000..fd56feebf --- /dev/null +++ b/package/base-files/src/etc/init.d/rcS @@ -0,0 +1,10 @@ +#!/bin/sh +export PATH=/bin:/sbin:/usr/bin:/usr/sbin +{ + grep '^#INIT ' /etc/init.d/* | \ + sort -nk2 | \ + while read line; do + /bin/sh ${line%%:*} autostart 2>&1 + done + test -e /etc/init.d/boot.local && (/bin/sh /etc/init.d/boot.local) 2>&1 +} | logger -s -p 6 -t '' & diff --git a/package/base-files/src/etc/inittab b/package/base-files/src/etc/inittab new file mode 100644 index 000000000..960ea77d8 --- /dev/null +++ b/package/base-files/src/etc/inittab @@ -0,0 +1,4 @@ +::sysinit:/etc/init.d/rcS +::shutdown:/etc/init.d/rcK +ttyS0::respawn:/sbin/getty -i -L ttyS0 115200 vt100 + diff --git a/package/base-files/src/etc/ipkg.conf b/package/base-files/src/etc/ipkg.conf new file mode 100644 index 000000000..6c9242620 --- /dev/null +++ b/package/base-files/src/etc/ipkg.conf @@ -0,0 +1,3 @@ +src openadk http://www.openadk.org/packages/@TARGET@ +dest root / +dest ram /tmp diff --git a/package/base-files/src/etc/mdev.conf b/package/base-files/src/etc/mdev.conf new file mode 100644 index 000000000..99c910d0b --- /dev/null +++ b/package/base-files/src/etc/mdev.conf @@ -0,0 +1,11 @@ +tun 0:0 660 >net/tun +null 0:0 777 +zero 0:0 666 +console 0:0 0600 +kmem 0:0 000 +mem 0:0 0640 +port 0:0 0640 +ptmx 0:0 666 +tty 0:0 0666 +ttyS* 0:0 640 +.* 0:0 644 @/lib/mdev/init diff --git a/package/base-files/src/etc/modules b/package/base-files/src/etc/modules new file mode 100644 index 000000000..014f40f2b --- /dev/null +++ b/package/base-files/src/etc/modules @@ -0,0 +1 @@ +# add modules to load on startup here diff --git a/package/base-files/src/etc/network/if-post-down.d/01-bridge b/package/base-files/src/etc/network/if-post-down.d/01-bridge new file mode 100755 index 000000000..47f3c976b --- /dev/null +++ b/package/base-files/src/etc/network/if-post-down.d/01-bridge @@ -0,0 +1,26 @@ +#!/bin/sh + +if [ ! -x /usr/sbin/brctl ] +then + exit 0 +fi + +case "$IF_BRIDGE_PORTS" in + "") + exit 0 + ;; + none) + INTERFACES="" + ;; + *) + INTERFACES="$IF_BRIDGE_PORTS" + ;; +esac + +for IF in $INTERFACES; do + ip link set down dev $IF && brctl delif $IFACE $IF +done + +ip link set down dev $IFACE || exit 1 +brctl delbr $IFACE +exit 0 diff --git a/package/base-files/src/etc/network/if-post-down.d/02-vlan b/package/base-files/src/etc/network/if-post-down.d/02-vlan new file mode 100755 index 000000000..e448a7641 --- /dev/null +++ b/package/base-files/src/etc/network/if-post-down.d/02-vlan @@ -0,0 +1,10 @@ +#!/bin/sh + +[ -x /sbin/vconfig ] || exit 0 + +[ -e /proc/net/vlan/$IFACE ] && ( + ip link set down dev $IFACE + vconfig rem $IFACE +) + +exit 0 diff --git a/package/base-files/src/etc/network/if-pre-up.d/01-atm b/package/base-files/src/etc/network/if-pre-up.d/01-atm new file mode 100755 index 000000000..5c168c001 --- /dev/null +++ b/package/base-files/src/etc/network/if-pre-up.d/01-atm @@ -0,0 +1,41 @@ +#!/bin/sh + +[ -x /usr/sbin/br2684ctl ] || exit 0 + +[ "${IFACE%%[0-9]*}" = "nas" ] || exit 0 + +[ "$IF_ATM_ENCAPS" ] || encap=0 +[ "$IF_ATM_PAYLOAD" ] || payload=1 +[ "$IF_ATM_VPI" ] || IF_ATM_VPI=1 +[ "$IF_ATM_VCI" ] || IF_ATM_VCI=32 + +[ "$IF_ATM_PAYLOAD" ] && case "$IF_ATM_PAYLOAD" in +bridged) + payload=1 + ;; +routed) + payload=0 + ;; +*) + echo "Wrong payload, use either bridged or routed" + exit 1 + ;; +esac + +[ "$IF_ATM_ENCAPS" ] && case "$IF_ATM_ENCAPS" in +llc) + encap=0 + ;; +vc) + encap=1 + ;; +*) + echo "Wrong Encapsulation use either llc or vc" + exit 1 + ;; +esac + +br2684ctl -b -c ${IFACE##*[a-z]} -e $encap -p $payload -a $IF_ATM_VPI.$IF_ATM_VCI +ifconfig nas${IFACE##*[a-z]} up + +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 new file mode 100755 index 000000000..35b7fca59 --- /dev/null +++ b/package/base-files/src/etc/network/if-pre-up.d/02-vlan @@ -0,0 +1,36 @@ +#!/bin/sh + +[ -x /sbin/vconfig ] || exit 0 +[ -d /proc/net/vlan ] || exit 0 + +case "$IFACE" in + vlan*) + vconfig set_name_type VLAN_PLUS_VID_NO_PAD + VLANID=`echo $IFACE|sed "s/vlan*//"` + ;; + eth*.*) + vconfig set_name_type DEV_PLUS_VID_NO_PAD + VLANID=`echo $IFACE|sed "s/eth[0-9][0-9]*\.*//g"` + IF_VLAN_RAW_DEVICE=`echo $IFACE|sed "s/\(eth[0-9][0-9]*\)\..*/\1/"` + ;; + *) + exit 0 + ;; +esac + +if [ "$IF_VLAN_RAW_DEVICE" != "" ]; then + if ! grep -q "$IF_VLAN_RAW_DEVICE" /proc/net/dev + then + echo "$IF_VLAN_RAW_DEVICE does not exist, unable to create $IFACE" + exit 1 + fi + ip link set up dev $IF_VLAN_RAW_DEVICE + vconfig add $IF_VLAN_RAW_DEVICE $VLANID + if [ "$IF_MAC_ADDRESS" != "" ] + then + ip link set $IF_VLAN_RAW_DEVICE.$VLANID address $IF_MAC_ADDRESS + fi + ip link set up dev $IF_VLAN_RAW_DEVICE.$VLANID +fi + +exit 0 diff --git a/package/base-files/src/etc/network/if-pre-up.d/03-bridge b/package/base-files/src/etc/network/if-pre-up.d/03-bridge new file mode 100755 index 000000000..41ddb2b58 --- /dev/null +++ b/package/base-files/src/etc/network/if-pre-up.d/03-bridge @@ -0,0 +1,29 @@ +#!/bin/sh + +[ -x /usr/sbin/brctl ] || exit 0 + +case "$IF_BRIDGE_PORTS" in + "") + exit 0 + ;; + none) + INTERFACES="" + ;; + *) + INTERFACES="$IF_BRIDGE_PORTS" + ;; +esac + +brctl addbr $IFACE || exit 1 + +for IF in $INTERFACES; do + if ! grep -q $IF /proc/net/dev; then + echo "Error: interface '$IF' does not exist!" + brctl delbr $IFACE + exit 1 + fi + brctl addif $IFACE $IF + ip link set up dev $IF +done + +exit 0 diff --git a/package/base-files/src/etc/network/if-up.d/01-bridge b/package/base-files/src/etc/network/if-up.d/01-bridge new file mode 100755 index 000000000..e5962f12f --- /dev/null +++ b/package/base-files/src/etc/network/if-up.d/01-bridge @@ -0,0 +1,4 @@ +#!/bin/sh + +[ "${IFACE%%[0-9]*}" = "br" ] && ip link set up dev $IFACE +exit 0 diff --git a/package/base-files/src/etc/network/interfaces b/package/base-files/src/etc/network/interfaces new file mode 100644 index 000000000..f1bd92ed2 --- /dev/null +++ b/package/base-files/src/etc/network/interfaces @@ -0,0 +1,2 @@ +auto lo +iface lo inet loopback diff --git a/package/base-files/src/etc/passwd b/package/base-files/src/etc/passwd new file mode 100644 index 000000000..32531eb92 --- /dev/null +++ b/package/base-files/src/etc/passwd @@ -0,0 +1,2 @@ +root:x:0:0:root:/root:/bin/sh +nobody:*:65534:65534:nobody:/var:/bin/false diff --git a/package/base-files/src/etc/profile b/package/base-files/src/etc/profile new file mode 100644 index 000000000..1b8f4a6a6 --- /dev/null +++ b/package/base-files/src/etc/profile @@ -0,0 +1,12 @@ +export PATH=/bin:/sbin:/usr/bin:/usr/sbin +export TERM=vt220 +if [[ $(id -u) = 0 ]]; then + export PS1='# ' +else + export PS1='$ ' + export HOME=/tmp +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 "$@"; } diff --git a/package/base-files/src/etc/protocols b/package/base-files/src/etc/protocols new file mode 100644 index 000000000..dfe58ed22 --- /dev/null +++ b/package/base-files/src/etc/protocols @@ -0,0 +1,45 @@ +ip 0 IP +icmp 1 ICMP +igmp 2 IGMP +ggp 3 GGP +ipencap 4 IP-ENCAP +st 5 ST +tcp 6 TCP +egp 8 EGP +igp 9 IGP +pup 12 PUP +udp 17 UDP +hmp 20 HMP +xns-idp 22 XNS-IDP +rdp 27 RDP +iso-tp4 29 ISO-TP4 +xtp 36 XTP +ddp 37 DDP +idpr-cmtp 38 IDPR-CMTP +ipv6 41 IPv6 +ipv6-route 43 IPv6-Route +ipv6-frag 44 IPv6-Frag +idrp 45 IDRP +rsvp 46 RSVP +gre 47 GRE +esp 50 IPSEC-ESP +ah 51 IPSEC-AH +skip 57 SKIP +ipv6-icmp 58 IPv6-ICMP +ipv6-nonxt 59 IPv6-NoNxt +ipv6-opts 60 IPv6-Opts +rspf 73 RSPF CPHB +vmtp 81 VMTP +eigrp 88 EIGRP +ospf 89 OSPFIGP +ax.25 93 AX.25 +ipip 94 IPIP +etherip 97 ETHERIP +encap 98 ENCAP +pim 103 PIM +ipcomp 108 IPCOMP +vrrp 112 VRRP +l2tp 115 L2TP +isis 124 ISIS +sctp 132 SCTP +fc 133 FC diff --git a/package/base-files/src/etc/rc.conf b/package/base-files/src/etc/rc.conf new file mode 100644 index 000000000..024007589 --- /dev/null +++ b/package/base-files/src/etc/rc.conf @@ -0,0 +1,3 @@ +# set variables service=YES|NO (YES to enable, NO to disable) +# set variables service_flags="X" (NO to disable the service) +# note: for flags, X can be empty diff --git a/package/base-files/src/etc/shadow b/package/base-files/src/etc/shadow new file mode 100644 index 000000000..3683d71ea --- /dev/null +++ b/package/base-files/src/etc/shadow @@ -0,0 +1,3 @@ +root:$1$8sJkb6fV$46vEIu5ntmbUuljmr55zY/:14191:0::::: +admin:$1$8sJkb6fV$46vEIu5ntmbUuljmr55zY/:14191:0::::: +nobody:*:9797:0::::: diff --git a/package/base-files/src/etc/sysctl.conf b/package/base-files/src/etc/sysctl.conf new file mode 100644 index 000000000..73260cf9d --- /dev/null +++ b/package/base-files/src/etc/sysctl.conf @@ -0,0 +1,17 @@ +# Disables the magic-sysrq key +#kernel.sysrq = 0 +# When the kernel panics, automatically reboot in 3 seconds +#kernel.panic = 3 +# Enable packet forwarding +#net.ipv4.ip_forward = 1 +# Disables IP dynaddr +#net.ipv4.ip_dynaddr = 0 +# Disable ECN +#net.ipv4.tcp_ecn = 0 +# Enables source route verification +net.ipv4.conf.default.rp_filter = 1 +# Enable reverse path +net.ipv4.conf.all.rp_filter = 1 +# Enable SYN cookies +#net.ipv4.tcp_syncookies = 1 + diff --git a/package/base-files/src/init b/package/base-files/src/init new file mode 100755 index 000000000..618547693 --- /dev/null +++ b/package/base-files/src/init @@ -0,0 +1,22 @@ +#!/bin/sh +echo "System initialization ..." +export PATH=/bin:/sbin:/usr/bin:/usr/sbin +mount -nt proc proc /proc +mount -o nosuid,nodev,noexec -t sysfs sysfs /sys +[ ! -f /etc/notmpfs ] && { + size=$(awk '/MemTotal:/ { if ($2 > 16000) { print 4096 } else { print 2048 }}' /proc/meminfo) + mount none /tmp -t tmpfs -o size=${size}k + mount none /tmp -t tmpfs -o remount,nosuid,nodev,mode=1777 +} +mount -o nosuid,size=128k,mode=0755 -t tmpfs mdev /dev +mkdir /dev/pts /dev/shm +mount -o nosuid,noexec -t devpts devpts /dev/pts +exec 0<>/dev/console >&0 2>&0 +echo >/dev/mdev.seq +echo "/sbin/mdev" >/proc/sys/kernel/hotplug +mdev -s +mount -o remount,rw / +cat /etc/.rnd >/dev/urandom 2>&1 +[ -f /etc/fstab ] && mount -a +[ -x /sbin/cfgfs ] && { cfgfs setup; mount -o remount,ro /;} +exec /sbin/init diff --git a/package/base-files/src/lib/mdev/init b/package/base-files/src/lib/mdev/init new file mode 100644 index 000000000..d2ae13e9c --- /dev/null +++ b/package/base-files/src/lib/mdev/init @@ -0,0 +1,21 @@ +#!/bin/sh +if [ "$ACTION" == "add" ];then + if [ "$DEVPATH" == "/bus/usb" ];then + mount -t usbfs usbfs /proc/bus/usb + fi +fi +if [ "$SUBSYSTEM" == "firmware" ];then + logger "Firmware load for $FIRMWARE requested" + if [ "$ACTION" == "add" ];then + if [ -e "/lib/firmware/$FIRMWARE" ];then + logger "Firmware loading ..." + echo 1 > /sys$DEVPATH/loading + cat "/lib/firmware/$FIRMWARE" > /sys$DEVPATH/data + echo 0 > /sys$DEVPATH/loading + logger "finished." + else + logger "Firmware file $FIRMWARE not found" + echo -1 > /sys$DEVPATH/loading + fi + fi +fi diff --git a/package/base-files/src/sbin/update b/package/base-files/src/sbin/update new file mode 100755 index 000000000..d41e23a0f --- /dev/null +++ b/package/base-files/src/sbin/update @@ -0,0 +1,75 @@ +#!/bin/sh + +who=$(id -u) +if [ $who -ne 0 ]; then + echo 'Exit. System update must be run as root.' + exit 1 +fi + +if [ -x /sbin/mtd ];then + updatecmd="mtd -r write - linux" +else + updatecmd="gunzip -c | tar -xf -" +fi + +check_exit() { + if [ $? -ne 0 ];then + echo "Update failed." + exit 1 + fi +} + +prepare() { + cd / + umount -f /etc + mount -o remount,rw / +} + +extract_from_file() { + prepare + cat $1 | eval $updatecmd + check_exit +} + +extract_from_ssh() { + prepare + ssh $1 "cat $2" | eval $updatecmd + check_exit +} + +extract_from_http() { + prepare + wget -O - $1 | eval $updatecmd + check_exit +} + +case $1 in + file://*|/*) + url=$(echo $1|sed -e "s#file://##") + echo "Updating system from $1" + extract_from_file $url + ;; + ssh://*) + host=$(echo $1|sed -e "s#ssh://\(.*\):.*#\1#") + file=$(echo $1|sed -e "s#ssh://.*:\(.*\)#\1#") + echo "Updating system from $1" + extract_from_ssh $host $file + ;; + http://*|ftp://*) + echo "Updating system from $1" + extract_from_http $1 + ;; + *) + echo "No or wrong uri given. exit." + echo "Use one of the following uri:" + echo "http://myserver/myupdate.tar.gz" + echo "ssh://myuser@myserver:/my/path/myupdate.tar.gz" + echo "file:///mypath/myupdate.tar.gz" + exit 1 + ;; +esac + +sync +mount -o bind /etc /tmp/.cfgfs/root + +echo "Update sucessful. You should reboot now." diff --git a/package/base-files/src/usr/share/udhcpc/default.script b/package/base-files/src/usr/share/udhcpc/default.script new file mode 100755 index 000000000..02e4a7a3c --- /dev/null +++ b/package/base-files/src/usr/share/udhcpc/default.script @@ -0,0 +1,38 @@ +#!/bin/sh +if [[ -z $1 ]]; then + echo "Error: should be run by udhcpc" + exit 1 +fi + +RESOLV_CONF=/tmp/resolv.conf + +case $1 in +(deconfig) + ip addr flush $interface + ;; +(renew|bound) + ip addr add $ip/${mask:-24} brd + dev $interface + + if [[ -n $router ]]; then + echo "deleting routers" + while ip route del default >&- 2>&-; do :; done + + for i in $router; do + echo "adding router $i" + ip route add to default via $i + done + fi + + echo -n >$RESOLV_CONF + ${domain:+echo search $domain} >>$RESOLV_CONF + for i in $dns; do + echo "adding dns $i" + echo "nameserver $i" >>$RESOLV_CONF + done + + # user rules + [ -f /etc/udhcpc.user ] && . /etc/udhcpc.user +;; +esac + +exit $? -- cgit v1.2.3 From 10997d993a55465525b026b9404f5809687e9e3c Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sun, 7 Feb 2010 20:15:25 +0100 Subject: implement adkupdate and adkinstall for rb532 boards --- package/base-files/extra/sbin/adkupdate | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'package/base-files') diff --git a/package/base-files/extra/sbin/adkupdate b/package/base-files/extra/sbin/adkupdate index d41e23a0f..db1dfb73a 100755 --- a/package/base-files/extra/sbin/adkupdate +++ b/package/base-files/extra/sbin/adkupdate @@ -12,6 +12,8 @@ else updatecmd="gunzip -c | tar -xf -" fi +system=$(awk '/system type/ { print $5 }' /proc/cpuinfo 2>/dev/null) + check_exit() { if [ $? -ne 0 ];then echo "Update failed." @@ -23,6 +25,9 @@ prepare() { cd / umount -f /etc mount -o remount,rw / + if [ "$system" == "RB532" ];then + mount -t yaffs2 /dev/mtdblock0 /boot + fi } extract_from_file() { -- cgit v1.2.3 From 8cc108e32a53b2109208865b24fb1733ea49c2ee Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sun, 7 Feb 2010 21:37:36 +0100 Subject: umount /boot after update --- package/base-files/src/sbin/adkupdate | 3 +++ 1 file changed, 3 insertions(+) (limited to 'package/base-files') diff --git a/package/base-files/src/sbin/adkupdate b/package/base-files/src/sbin/adkupdate index db1dfb73a..6c2f58006 100755 --- a/package/base-files/src/sbin/adkupdate +++ b/package/base-files/src/sbin/adkupdate @@ -76,5 +76,8 @@ esac sync mount -o bind /etc /tmp/.cfgfs/root +if [ "$system" == "RB532" ];then + umount -f /boot +fi echo "Update sucessful. You should reboot now." -- cgit v1.2.3