From 83f5e16fffe029232114ee9f54b8df41d5841912 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Wed, 25 Nov 2009 23:02:27 +0100 Subject: add update script to base-files - system update via http/ftp/ssh/file possible - add bridge script - cleanup unused files --- .../extra/etc/network/if-pre-up.d/bridge | 32 ++++++++++ package/base-files/extra/usr/sbin/update | 63 +++++++++++++++++++ package/busybox/files/bridge.pre-up | 0 package/busybox/files/ipv6 | 71 ---------------------- package/busybox/files/ipv6.up | 0 package/busybox/files/vlan.pre-up | 0 package/cfinstall/src/cfinstall | 5 +- package/dansguardian/Makefile | 6 ++ package/grub-bin/Config.in | 4 +- package/squid/Config.in | 1 + package/squid/Makefile | 13 ++++ 11 files changed, 120 insertions(+), 75 deletions(-) create mode 100644 package/base-files/extra/etc/network/if-pre-up.d/bridge create mode 100755 package/base-files/extra/usr/sbin/update delete mode 100644 package/busybox/files/bridge.pre-up delete mode 100644 package/busybox/files/ipv6 delete mode 100644 package/busybox/files/ipv6.up delete mode 100644 package/busybox/files/vlan.pre-up (limited to 'package') diff --git a/package/base-files/extra/etc/network/if-pre-up.d/bridge b/package/base-files/extra/etc/network/if-pre-up.d/bridge new file mode 100644 index 000000000..766084de1 --- /dev/null +++ b/package/base-files/extra/etc/network/if-pre-up.d/bridge @@ -0,0 +1,32 @@ +#!/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 + +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/usr/sbin/update b/package/base-files/extra/usr/sbin/update new file mode 100755 index 000000000..57e9cf268 --- /dev/null +++ b/package/base-files/extra/usr/sbin/update @@ -0,0 +1,63 @@ +#!/bin/sh + +who=$(id -u) +if [ $who -ne 0 ]; then + echo 'Exit. System update must be run as root.' + exit 1 +fi + +cd / + +mount -o remount,rw / + +check_exit() { + if [ $? -ne 0 ];then + echo "Update failed." + exit 1 + fi +} + +extract_from_file() { + tar -xzvf $1 + check_exit +} + +extract_from_ssh() { + ssh $1 "cat $2" | tar -xzvf - + check_exit +} + +extract_from_http() { + wget -O - $1 | tar -xzvf - + 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 + +echo "You should reboot now." diff --git a/package/busybox/files/bridge.pre-up b/package/busybox/files/bridge.pre-up deleted file mode 100644 index e69de29bb..000000000 diff --git a/package/busybox/files/ipv6 b/package/busybox/files/ipv6 deleted file mode 100644 index 837106519..000000000 --- a/package/busybox/files/ipv6 +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/sh - -ipv6_up() { - env | grep -q IF_IPV6_ || return 0 - - # IPV6-FLUSH - if [ "$IF_IPV6_FLUSH" == "1" ] || [ "$IF_IPV6_FLUSH" == "yes" ] || [ "$IF_IPV6_FLUSH" == "YES" ] - then - ip -6 addr flush $IFACE - logger -t IPv6 "deactivated IPv6 for interface $IFACE" - fi - # IPV6-AUTOCONF - if [ "$IF_IPV6_AUTOCONF" == "1" ] || [ "$IF_IPV6_AUTOCONF" == "yes" ] || [ "$IF_IPV6_AUTOCONF" == "YES" ] - then - echo 1 > /proc/sys/net/ipv6/conf/$IFACE/autoconf - logger -t IPv6 "autoconf enabled for $IFACE" - fi - if [ "$IF_IPV6_AUTOCONF" == "0" ] || [ "$IF_IPV6_AUTOCONF" == "no" ] || [ "$IF_IPV6_AUTOCONF" == "NO" ] - then - echo 0 > /proc/sys/net/ipv6/conf/$IFACE/autoconf - logger -t IPv6 "autoconf disabled for $IFACE" - fi - # IPV6-ACCEPT-RA - if [ "$IF_IPV6_ACCEPT_RA" == "1" ] || [ "$IF_IPV6_ACCEPT_RA" == "yes" ] || [ "$IF_IPV6_ACCEPT_RA" == "YES" ] - then - - echo 1 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra - logger -t IPv6 "accept-ra enabled for $IFACE" - fi - if [ "$IF_IPV6_ACCEPT_RA" == "0" ] || [ "$IF_IPV6_ACCEPT_RA" == "no" ] || [ "$IF_IPV6_ACCEPT_RA" == "NO" ] - then - echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_ra - logger -t IPv6 "accept-ra disabled for $IFACE" - fi - # IPV6-ACCEPT-REDIRECTS - if [ "$IF_IPV6_ACCEPT_REDIRECTS" == "1" ] || [ "$IF_IPV6_ACCEPT_REDIRECTS" == "yes" ] || [ "$IF_IPV6_ACCEPT_REDIRECTS" == "YES" ] - then - - echo 1 > /proc/sys/net/ipv6/conf/$IFACE/accept_redirects - logger -t IPv6 "accept-redirects enabled for $IFACE" - fi - if [ "$IF_IPV6_ACCEPT_REDIRECTS" == "0" ] || [ "$IF_IPV6_ACCEPT_REDIRECTS" == "no" ] || [ "$IF_IPV6_ACCEPT_REDIRECTS" == "NO" ] - then - echo 0 > /proc/sys/net/ipv6/conf/$IFACE/accept_redirects - logger -t IPv6 "accept-redirects disabled for $IFACE" - fi - # IPV6-FORWARDING - if [ "$IF_IPV6_FORWARDING" == "1" ] || [ "$IF_IPV6_FORWARDING" == "yes" ] || [ "$IF_IPV6_FORWARDING" == "YES" ] - then - - echo 1 > /proc/sys/net/ipv6/conf/$IFACE/forwarding - logger -t IPv6 "forwarding enabled for $IFACE" - fi - if [ "$IF_IPV6_FORWARDING" == "0" ] || [ "$IF_IPV6_FORWARDING" == "no" ] || [ "$IF_IPV6_FORWARDING" == "NO" ] - then - echo 0 > /proc/sys/net/ipv6/conf/$IFACE/forwarding - logger -t IPv6 "forwarding disabled for $IFACE" - fi - # IPV6-USE-TEMPADDR - if [ "$IF_IPV6_USE_TEMPADDR" == "1" ] || [ "$IF_IPV6_USE_TEMPADDR" == "yes" ] || [ "$IF_IPV6_USE_TEMPADDR" == "YES" ] - then - - echo 1 > /proc/sys/net/ipv6/conf/$IFACE/use_tempaddr - logger -t IPv6 "use_tempaddr enabled for $IFACE" - fi - if [ "$IF_IPV6_USE_TEMPADDR" == "0" ] || [ "$IF_IPV6_USE_TEMPADDR" == "no" ] || [ "$IF_IPV6_USE_TEMPADDR" == "NO" ] - then - echo 0 > /proc/sys/net/ipv6/conf/$IFACE/use_tempaddr - logger -t IPv6 "use_tempaddr disabled for $IFACE" - fi -} diff --git a/package/busybox/files/ipv6.up b/package/busybox/files/ipv6.up deleted file mode 100644 index e69de29bb..000000000 diff --git a/package/busybox/files/vlan.pre-up b/package/busybox/files/vlan.pre-up deleted file mode 100644 index e69de29bb..000000000 diff --git a/package/cfinstall/src/cfinstall b/package/cfinstall/src/cfinstall index ffb5fd6c8..0c1a61779 100644 --- a/package/cfinstall/src/cfinstall +++ b/package/cfinstall/src/cfinstall @@ -13,7 +13,7 @@ rootsize=$(($maxsize-2)) parted -s /dev/sda unit cyl mkpartfs primary ext2 0 $rootsize parted -s /dev/sda unit cyl mkpart primary fat32 $rootsize $maxsize parted -s /dev/sda set 1 boot on -sfdisk --change-id /dev/sda 2 88 +sfdisk --change-id /dev/sda 2 88 >/dev/null 2>&1 if [ $? -eq 0 ];then printf "Successfully created partition ${rootpart}\n" else @@ -46,7 +46,7 @@ menuentry "GNU/Linux (OpenADK)" { linux /boot/vmlinuz-adk root=/dev/sda1 ro init=/init panic=10 } EOF -chroot /mnt grub-install /dev/sda +chroot /mnt grub-install /dev/sda >/dev/null 2>&1 umount /mnt/proc umount /mnt/sys umount /mnt/dev @@ -59,4 +59,3 @@ mknod -m 666 /mnt/dev/tty c 5 0 umount /mnt printf "Successfully installed.\n" exit 0 - diff --git a/package/dansguardian/Makefile b/package/dansguardian/Makefile index 69d86719a..2a21584c5 100644 --- a/package/dansguardian/Makefile +++ b/package/dansguardian/Makefile @@ -23,6 +23,12 @@ include ${TOPDIR}/mk/package.mk $(eval $(call PKG_template,DANSGUARDIAN,${PKG_NAME},${PKG_VERSION}-${PKG_RELEASE},${PKG_DEPENDS},${PKG_DESCR},${PKG_SECTION})) +ifeq ($(ADK_COMPILE_DANSGUARDIAN_WITH_UCLIBCXX),y) +CONFIGURE_ENV+= CXXFLAGS="-fno-threadsafe-statics -fno-builtin -nostdinc++ \ + -I${STAGING_DIR}/usr/include/uClibc++" \ + LIBS="-nodefaultlibs -luClibc++ -lgcc -lm" +endif + CONFIGURE_STYLE:= gnu CONFIGURE_ARGS+= --enable-orig-ip \ --with-proxyuser=proxy \ diff --git a/package/grub-bin/Config.in b/package/grub-bin/Config.in index 20fc07408..75ddaaf14 100644 --- a/package/grub-bin/Config.in +++ b/package/grub-bin/Config.in @@ -4,10 +4,12 @@ config ADK_PACKAGE_GRUB_BIN depends on \ ADK_LINUX_X86_64_SHUTTLE || \ ADK_LINUX_X86_WRAP || \ - ADK_LINUX_X86_ALIX1C + ADK_LINUX_X86_ALIX1C || \ + ADK_LINUX_X86_ALIX2D select BUSYBOX_FEATURE_STAT_FORMAT default y if ADK_LINUX_X86_64_SHUTTLE default y if ADK_LINUX_X86_ALIX1C + default y if ADK_LINUX_X86_ALIX2D default y if ADK_LINUX_X86_WRAP help diff --git a/package/squid/Config.in b/package/squid/Config.in index 86813dfd6..c0cc8f818 100644 --- a/package/squid/Config.in +++ b/package/squid/Config.in @@ -26,6 +26,7 @@ config ADK_COMPILE_SQUID_WITH_STDCXX config ADK_COMPILE_SQUID_WITH_UCLIBCXX bool "Embedded uClibc++ library" select ADK_PACKAGE_UCLIBCXX + depends on ADK_BROKEN help endchoice diff --git a/package/squid/Makefile b/package/squid/Makefile index cb7a51494..80f97c032 100644 --- a/package/squid/Makefile +++ b/package/squid/Makefile @@ -78,6 +78,12 @@ $(eval $(call PKG_mod_template,SQUID_MOD_EXTERNAL_ACL_UNIX_GROUP,squid_unix_grou $(eval $(call PKG_mod_template,SQUID_MOD_NTLM_AUTH_FAKEAUTH,fakeauth_auth)) $(eval $(call PKG_mod_template,SQUID_MOD_NTLM_AUTH_SMB_AUTH,ntlm_auth)) +ifeq ($(ADK_COMPILE_SQUID_WITH_UCLIBCXX),y) +CONFIGURE_ENV+= CXXFLAGS="-fno-threadsafe-statics -fno-builtin -nostdinc++ \ + -I${STAGING_DIR}/usr/include/uClibc++" \ + LIBS="-nodefaultlibs -luClibc++ -ldl -lm" +endif + CONFIGURE_STYLE:= autotool gnu CONFIGURE_ENV+= ac_cv_sizeof_void_p=4 \ ac_cv_sizeof_short=2 \ @@ -134,6 +140,13 @@ CONFIGURE_ARGS+= --datadir=/usr/share/squid \ BUILD_STYLE:= auto INSTALL_STYLE:= auto +ifeq (${ADK_COMPILE_SQUID_WITH_UCLIBCXX},y) +# add workaround because libtool tries to link libstdc++ +post-configure: + ${SED} 's#postdeps="-lstdc.*#postdeps="-lm"#' \ + ${WRKBUILD}/libtool +endif + post-install: ${INSTALL_MODS_y} ${INSTALL_MODS_m} ${INSTALL_DIR} ${IDIR_SQUID}/etc/squid ${INSTALL_DATA} ${WRKINST}/etc/squid/mime.conf \ -- cgit v1.2.3 From 7d36caec53dbfeea4e696205ae71bdae8246a082 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Fri, 27 Nov 2009 19:28:17 +0100 Subject: minor fixes to bridgeing scripts --- package/Depends.mk | 12 +++- .../extra/etc/network/if-post-down.d/bridge | 24 ++++++++ .../extra/etc/network/if-pre-up.d/bridge | 0 package/base-files/extra/sbin/update | 66 ++++++++++++++++++++++ package/base-files/extra/usr/sbin/update | 63 --------------------- 5 files changed, 101 insertions(+), 64 deletions(-) create mode 100755 package/base-files/extra/etc/network/if-post-down.d/bridge mode change 100644 => 100755 package/base-files/extra/etc/network/if-pre-up.d/bridge create mode 100755 package/base-files/extra/sbin/update delete mode 100755 package/base-files/extra/usr/sbin/update (limited to 'package') diff --git a/package/Depends.mk b/package/Depends.mk index 277ab22da..59943eeff 100644 --- a/package/Depends.mk +++ b/package/Depends.mk @@ -19,22 +19,32 @@ cbtt-compile: mysql-compile zlib-compile collectd-compile: libpthread-compile cryptinit-compile: cryptsetup-compile cryptsetup-compile: libgcrypt-compile popt-compile e2fsprogs-compile lvm-compile + ifeq (${ADK_COMPILE_CTORRENT_WITH_UCLIBCXX},y) ctorrent-compile: uclibc++-compile endif ctorrent-compile: openssl-compile + cups-compile: zlib-compile curl-compile: openssl-compile zlib-compile -cxxtools-compile: libiconv-compile + ifeq (${ADK_COMPILE_CXXTOOLS_WITH_UCLIBCXX},y) cxxtools-compile: uclibc++-compile endif +cxxtools-compile: libiconv-compile + cyrus-sasl-compile: openssl-compile + +ifeq (${ADK_COMPILE_DANSGUARDIAN_WITH_UCLIBCXX},y) +dansguardian-compile: uclibc++-compile +endif dansguardian-compile: pcre-compile zlib-compile + ifneq (${ADK_PACKAGE_DAVFS2_FUSE}${ADK_PACKAGE_DAVFS2_BOTH},) davfs2-compile: fuse-compile endif davfs2-compile: libiconv-compile neon-compile + dbus-compile: expat-compile deco-compile: ncurses-compile dhcpv6-compile: libnl-compile ncurses-compile diff --git a/package/base-files/extra/etc/network/if-post-down.d/bridge b/package/base-files/extra/etc/network/if-post-down.d/bridge new file mode 100755 index 000000000..eda1fe3bf --- /dev/null +++ b/package/base-files/extra/etc/network/if-post-down.d/bridge @@ -0,0 +1,24 @@ +#!/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 diff --git a/package/base-files/extra/etc/network/if-pre-up.d/bridge b/package/base-files/extra/etc/network/if-pre-up.d/bridge old mode 100644 new mode 100755 diff --git a/package/base-files/extra/sbin/update b/package/base-files/extra/sbin/update new file mode 100755 index 000000000..a812bb23d --- /dev/null +++ b/package/base-files/extra/sbin/update @@ -0,0 +1,66 @@ +#!/bin/sh + +who=$(id -u) +if [ $who -ne 0 ]; then + echo 'Exit. System update must be run as root.' + exit 1 +fi + +cd / + +mount -o remount,rw / +umount /etc + +check_exit() { + if [ $? -ne 0 ];then + echo "Update failed." + exit 1 + fi +} + +extract_from_file() { + tar -xzvf $1 + check_exit +} + +extract_from_ssh() { + ssh $1 "cat $2" | tar -xzvf - + check_exit +} + +extract_from_http() { + wget -O - $1 | tar -xzvf - + 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 --bind /etc /tmp/.cfgfs/root + +echo "Check with cfgfs status if you need to merge and save any changes in /etc." +echo "You should reboot now." diff --git a/package/base-files/extra/usr/sbin/update b/package/base-files/extra/usr/sbin/update deleted file mode 100755 index 57e9cf268..000000000 --- a/package/base-files/extra/usr/sbin/update +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh - -who=$(id -u) -if [ $who -ne 0 ]; then - echo 'Exit. System update must be run as root.' - exit 1 -fi - -cd / - -mount -o remount,rw / - -check_exit() { - if [ $? -ne 0 ];then - echo "Update failed." - exit 1 - fi -} - -extract_from_file() { - tar -xzvf $1 - check_exit -} - -extract_from_ssh() { - ssh $1 "cat $2" | tar -xzvf - - check_exit -} - -extract_from_http() { - wget -O - $1 | tar -xzvf - - 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 - -echo "You should reboot now." -- cgit v1.2.3