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 --- .../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 --------------------- 4 files changed, 90 insertions(+), 63 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/base-files/extra') 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