Hmm, I'm afraid Gmail might reformat it, so it's attached too. >From 7d2b4d3a401d952164776bb94954bb0801b240fb Mon Sep 17 00:00:00 2001 From: Kai Hendry <[email protected]> Date: Mon, 20 Apr 2009 20:20:18 +0100 Subject: [PATCH] wlan and lang helpers
cleanup of wlan --- debian/changelog | 7 ++++++ debian/control | 1 + debian/rules | 4 ++- scripts/chinese | 19 +++++++++++++++++ scripts/iptables | 21 ------------------- scripts/japanese | 19 +++++++++++++++++ scripts/korean | 19 +++++++++++++++++ scripts/wlan | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 126 insertions(+), 22 deletions(-) create mode 100755 scripts/chinese delete mode 100755 scripts/iptables create mode 100755 scripts/japanese create mode 100755 scripts/korean create mode 100755 scripts/wlan diff --git a/debian/changelog b/debian/changelog index 1cb39b5..9589351 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +live-initscripts (0+nmu1) lenny; urgency=low + + * Non-maintainer upload. + * CJK and wlan helper + + -- Kai Hendry <[email protected]> Mon, 20 Apr 2009 20:23:31 +0100 + live-initscripts (0) UNRELEASED; urgency=low * Initial release. diff --git a/debian/control b/debian/control index 7bf546c..8494e84 100644 --- a/debian/control +++ b/debian/control @@ -11,6 +11,7 @@ Vcs-Git: git://git.debian.net/git/debian-live/live-initscripts.git Package: live-initscripts Architecture: all +Recommends: iptables Description: Debian Live init scripts live-initscripts is part of the Debian Live project. It is a collection of scripts that runs during init time. diff --git a/debian/rules b/debian/rules index 188d4ec..8bacb32 100755 --- a/debian/rules +++ b/debian/rules @@ -37,7 +37,9 @@ binary-indep: build install dh_installdocs dh_install dh_installinit --name apt-upgrade --onlyscripts --no-restart-on-upgrade --no-start -- start 99 2 6 . - dh_installinit --name iptables --onlyscripts --no-restart-on-upgrade --no-start -- start 99 2 6 . + dh_installinit --name korean --onlyscripts --no-restart-on-upgrade --no-start -- start 99 2 6 . + dh_installinit --name chinese --onlyscripts --no-restart-on-upgrade --no-start -- start 99 2 6 . + dh_installinit --name japanese --onlyscripts --no-restart-on-upgrade --no-start -- start 99 2 6 . dh_compress dh_fixperms dh_installdeb diff --git a/scripts/chinese b/scripts/chinese new file mode 100755 index 0000000..5bd9ae8 --- /dev/null +++ b/scripts/chinese @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +grep -qs boot=live /proc/cmdline || exit 0 +grep -qs "locale=zh_CN.UTF-8" /proc/cmdline || exit 0 + +case "${1}" in + start) + NOTTY="-q -y -o DPkg::Options::=--force-confdef" + DEBIAN_FRONTEND="noninteractive" + export DEBIAN_FRONTEND + + PKGS="scim-chinese scim-tables-zh scim-uim xfonts-intl-chinese ttf-arphic-ukai ttf-arphic-uming xfonts-wqy" + + logger "Setting up $0" + apt-get -q=2 update && apt-get ${NOTTY} install $PKGS + ;; +esac diff --git a/scripts/iptables b/scripts/iptables deleted file mode 100755 index f379751..0000000 --- a/scripts/iptables +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -set -e - -grep -qs boot=live /proc/cmdline || exit 0 -grep -qs " firewall" /proc/cmdline || exit 0 - -case "${1}" in - start) - logger "Setting up iptables" - echo 1 > /proc/sys/net/ipv4/ip_forward - - iptables -N block - - iptables -A block -m state --state ESTABLISHED,RELATED -j ACCEPT - iptables -A block -m state --state NEW -i ! eth0 -j ACCEPT - iptables -A block -j DROP - iptables -A INPUT -j block - iptables -A FORWARD -j block - ;; -esac diff --git a/scripts/japanese b/scripts/japanese new file mode 100755 index 0000000..f4ff8f0 --- /dev/null +++ b/scripts/japanese @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +grep -qs boot=live /proc/cmdline || exit 0 +grep -qs "locale=ja_JP.UTF-8" /proc/cmdline || exit 0 + +case "${1}" in + start) + NOTTY="-q -y -o DPkg::Options::=--force-confdef" + DEBIAN_FRONTEND="noninteractive" + export DEBIAN_FRONTEND + + PKGS="ttf-vlgothic scim-anthy scim-uim scim-skk scim-prime scim-canna scim-tables-ja" + + logger "Setting up $0" + apt-get -q=2 update && apt-get ${NOTTY} install $PKGS + ;; +esac diff --git a/scripts/korean b/scripts/korean new file mode 100755 index 0000000..19fc0d5 --- /dev/null +++ b/scripts/korean @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +grep -qs boot=live /proc/cmdline || exit 0 +grep -qs "locale=ko_KR.UTF-8" /proc/cmdline || exit 0 + +case "${1}" in + start) + NOTTY="-q -y -o DPkg::Options::=--force-confdef" + DEBIAN_FRONTEND="noninteractive" + export DEBIAN_FRONTEND + + PKGS="scim-hangul scim-tables-ko scim-uim ttf-unfonts ttf-alee xfonts-baekmuk" + + logger "Setting up $0" + apt-get -q=2 update && apt-get ${NOTTY} install $PKGS + ;; +esac diff --git a/scripts/wlan b/scripts/wlan new file mode 100755 index 0000000..723d2e7 --- /dev/null +++ b/scripts/wlan @@ -0,0 +1,58 @@ +#! /bin/sh +set -e + +grep -qs boot=live /proc/cmdline || exit 0 +grep -qs "wlan=" /proc/cmdline || exit 0 + +logger "Setting up $0" + +for x in $(cat /proc/cmdline); do + case $x in + wlan=*) + WLAN="${x//wlan=}" + essid="${WLAN%%,*}" # hack to allow for spaces in essid + key="$(echo ${WLAN} | cut -f2 -d ',')" + ;; + esac +done + +for iface in wlan0 eth1 +do + /sbin/ifconfig $iface || continue # if the device does not exist, skip! + ping -c 1 google.com &> /dev/null && break # ok, do not mess around if the Internet works + + if test $(cat /etc/network/interfaces | grep "^iface $iface" | wc -l) -eq 1 + then + if test "$essid" + then + echo ESSID: "$essid" + iwconfig $iface essid "$essid" + else + echo "No ESSID set (will try connect to any open network)" + iwconfig $iface essid any + fi + + if test $key + then + echo KEY: $key + iwconfig $iface key $key + +cat >> /etc/wpa_supplicant/wpa_supplicant.conf <<END +network={ +ssid="$essid" +key_mgmt=WPA-PSK +psk="$key" +} +END + + else + echo No KEY set + iwconfig $iface key off + fi + + ifup $iface 2> /dev/stdout + + else + echo "No /etc/network/interfaces: $iface" + fi +done -- 1.6.2.3
From 7d2b4d3a401d952164776bb94954bb0801b240fb Mon Sep 17 00:00:00 2001 From: Kai Hendry <[email protected]> Date: Mon, 20 Apr 2009 20:20:18 +0100 Subject: [PATCH] wlan and lang helpers cleanup of wlan --- debian/changelog | 7 ++++++ debian/control | 1 + debian/rules | 4 ++- scripts/chinese | 19 +++++++++++++++++ scripts/iptables | 21 ------------------- scripts/japanese | 19 +++++++++++++++++ scripts/korean | 19 +++++++++++++++++ scripts/wlan | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 126 insertions(+), 22 deletions(-) create mode 100755 scripts/chinese delete mode 100755 scripts/iptables create mode 100755 scripts/japanese create mode 100755 scripts/korean create mode 100755 scripts/wlan diff --git a/debian/changelog b/debian/changelog index 1cb39b5..9589351 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +live-initscripts (0+nmu1) lenny; urgency=low + + * Non-maintainer upload. + * CJK and wlan helper + + -- Kai Hendry <[email protected]> Mon, 20 Apr 2009 20:23:31 +0100 + live-initscripts (0) UNRELEASED; urgency=low * Initial release. diff --git a/debian/control b/debian/control index 7bf546c..8494e84 100644 --- a/debian/control +++ b/debian/control @@ -11,6 +11,7 @@ Vcs-Git: git://git.debian.net/git/debian-live/live-initscripts.git Package: live-initscripts Architecture: all +Recommends: iptables Description: Debian Live init scripts live-initscripts is part of the Debian Live project. It is a collection of scripts that runs during init time. diff --git a/debian/rules b/debian/rules index 188d4ec..8bacb32 100755 --- a/debian/rules +++ b/debian/rules @@ -37,7 +37,9 @@ binary-indep: build install dh_installdocs dh_install dh_installinit --name apt-upgrade --onlyscripts --no-restart-on-upgrade --no-start -- start 99 2 6 . - dh_installinit --name iptables --onlyscripts --no-restart-on-upgrade --no-start -- start 99 2 6 . + dh_installinit --name korean --onlyscripts --no-restart-on-upgrade --no-start -- start 99 2 6 . + dh_installinit --name chinese --onlyscripts --no-restart-on-upgrade --no-start -- start 99 2 6 . + dh_installinit --name japanese --onlyscripts --no-restart-on-upgrade --no-start -- start 99 2 6 . dh_compress dh_fixperms dh_installdeb diff --git a/scripts/chinese b/scripts/chinese new file mode 100755 index 0000000..5bd9ae8 --- /dev/null +++ b/scripts/chinese @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +grep -qs boot=live /proc/cmdline || exit 0 +grep -qs "locale=zh_CN.UTF-8" /proc/cmdline || exit 0 + +case "${1}" in + start) + NOTTY="-q -y -o DPkg::Options::=--force-confdef" + DEBIAN_FRONTEND="noninteractive" + export DEBIAN_FRONTEND + + PKGS="scim-chinese scim-tables-zh scim-uim xfonts-intl-chinese ttf-arphic-ukai ttf-arphic-uming xfonts-wqy" + + logger "Setting up $0" + apt-get -q=2 update && apt-get ${NOTTY} install $PKGS + ;; +esac diff --git a/scripts/iptables b/scripts/iptables deleted file mode 100755 index f379751..0000000 --- a/scripts/iptables +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -set -e - -grep -qs boot=live /proc/cmdline || exit 0 -grep -qs " firewall" /proc/cmdline || exit 0 - -case "${1}" in - start) - logger "Setting up iptables" - echo 1 > /proc/sys/net/ipv4/ip_forward - - iptables -N block - - iptables -A block -m state --state ESTABLISHED,RELATED -j ACCEPT - iptables -A block -m state --state NEW -i ! eth0 -j ACCEPT - iptables -A block -j DROP - iptables -A INPUT -j block - iptables -A FORWARD -j block - ;; -esac diff --git a/scripts/japanese b/scripts/japanese new file mode 100755 index 0000000..f4ff8f0 --- /dev/null +++ b/scripts/japanese @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +grep -qs boot=live /proc/cmdline || exit 0 +grep -qs "locale=ja_JP.UTF-8" /proc/cmdline || exit 0 + +case "${1}" in + start) + NOTTY="-q -y -o DPkg::Options::=--force-confdef" + DEBIAN_FRONTEND="noninteractive" + export DEBIAN_FRONTEND + + PKGS="ttf-vlgothic scim-anthy scim-uim scim-skk scim-prime scim-canna scim-tables-ja" + + logger "Setting up $0" + apt-get -q=2 update && apt-get ${NOTTY} install $PKGS + ;; +esac diff --git a/scripts/korean b/scripts/korean new file mode 100755 index 0000000..19fc0d5 --- /dev/null +++ b/scripts/korean @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +grep -qs boot=live /proc/cmdline || exit 0 +grep -qs "locale=ko_KR.UTF-8" /proc/cmdline || exit 0 + +case "${1}" in + start) + NOTTY="-q -y -o DPkg::Options::=--force-confdef" + DEBIAN_FRONTEND="noninteractive" + export DEBIAN_FRONTEND + + PKGS="scim-hangul scim-tables-ko scim-uim ttf-unfonts ttf-alee xfonts-baekmuk" + + logger "Setting up $0" + apt-get -q=2 update && apt-get ${NOTTY} install $PKGS + ;; +esac diff --git a/scripts/wlan b/scripts/wlan new file mode 100755 index 0000000..723d2e7 --- /dev/null +++ b/scripts/wlan @@ -0,0 +1,58 @@ +#! /bin/sh +set -e + +grep -qs boot=live /proc/cmdline || exit 0 +grep -qs "wlan=" /proc/cmdline || exit 0 + +logger "Setting up $0" + +for x in $(cat /proc/cmdline); do + case $x in + wlan=*) + WLAN="${x//wlan=}" + essid="${WLAN%%,*}" # hack to allow for spaces in essid + key="$(echo ${WLAN} | cut -f2 -d ',')" + ;; + esac +done + +for iface in wlan0 eth1 +do + /sbin/ifconfig $iface || continue # if the device does not exist, skip! + ping -c 1 google.com &> /dev/null && break # ok, do not mess around if the Internet works + + if test $(cat /etc/network/interfaces | grep "^iface $iface" | wc -l) -eq 1 + then + if test "$essid" + then + echo ESSID: "$essid" + iwconfig $iface essid "$essid" + else + echo "No ESSID set (will try connect to any open network)" + iwconfig $iface essid any + fi + + if test $key + then + echo KEY: $key + iwconfig $iface key $key + +cat >> /etc/wpa_supplicant/wpa_supplicant.conf <<END +network={ +ssid="$essid" +key_mgmt=WPA-PSK +psk="$key" +} +END + + else + echo No KEY set + iwconfig $iface key off + fi + + ifup $iface 2> /dev/stdout + + else + echo "No /etc/network/interfaces: $iface" + fi +done -- 1.6.2.3
