From ca43bff4ec0b2f933ac58062447346adea901ca0 Mon Sep 17 00:00:00 2001 From: David Somero Date: Tue, 11 May 2010 20:01:46 +0200 Subject: network/wifi-radar: Added to 12.0 repository --- network/wifi-radar/README | 39 +++++++++++++++ network/wifi-radar/doinst.sh | 32 ++++++++++++ network/wifi-radar/rc.wifi-radar | 62 +++++++++++++++++++++++ network/wifi-radar/slack-desc | 19 ++++++++ network/wifi-radar/wifi-radar.SlackBuild | 84 ++++++++++++++++++++++++++++++++ network/wifi-radar/wifi-radar.info | 8 +++ 6 files changed, 244 insertions(+) create mode 100644 network/wifi-radar/README create mode 100644 network/wifi-radar/doinst.sh create mode 100644 network/wifi-radar/rc.wifi-radar create mode 100644 network/wifi-radar/slack-desc create mode 100644 network/wifi-radar/wifi-radar.SlackBuild create mode 100644 network/wifi-radar/wifi-radar.info diff --git a/network/wifi-radar/README b/network/wifi-radar/README new file mode 100644 index 0000000000..df36d8664b --- /dev/null +++ b/network/wifi-radar/README @@ -0,0 +1,39 @@ +WiFi Radar is a Python utility for managing WiFi profiles. It enables +you to scan for available networks and create profiles for your preferred +networks. At boot time, running WiFi Radar will automatically scan for an +available preferred network and connect to it. You can drag and drop your +preferred networks to arrange the profile priority. + +This requires pygtk, which in turn requires pygobject and pycairo, all of +which are also available at SlackBuilds.org + +This script installs a wifi-radar.sh script in /usr/bin that by default +runs /usr/sbin/wifi-radar with sudo. You can change this to use ksudo +instead by running the script thusly: + ./wifi-radar.SlackBuild KSUDO=yes + +To use wifi-radar with a normal user (with sudo) add to your /etc/sudoers: + %users ALL = NOPASSWD: /usr/sbin/wifi-radar + +Then launch wifi-radar.sh, which will handle setting up a proper environment +and running /usr/sbin/wifi-radar. + +If you want to scan and connect to one of your preferred networks at +boot, the recommended way is to add the following to /etc/rc.d/rc.local +and make sure /etc/rc.d/rc.wifi-radar is executable. + if [ -x /etc/rc.d/rc.wifi-radar ]; then + /etc/rc.d/rc.wifi-radar start + fi +And of course, to rc.local_shutdown: + if [ -x /etc/rc.d/rc.wifi-radar ]; then + /etc/rc.d/rc.wifi-radar stop + fi + +Please note that according to the manpage, wifi-radar is fairly power hungry +due to its constant scan nature. You may not wish to have it running in the +background all the time sucking battery juice. + +Make sure /etc/wifi-radar/wifi-radar.conf is only readable by root (or perhaps +the group that owns it in some cases). We install the file with mode 0600 by +default, but this was not the case in some earlier revisions, so you should +double-check it to be sure. diff --git a/network/wifi-radar/doinst.sh b/network/wifi-radar/doinst.sh new file mode 100644 index 0000000000..1074af329f --- /dev/null +++ b/network/wifi-radar/doinst.sh @@ -0,0 +1,32 @@ +config() { + NEW="$1" + OLD="$(dirname $NEW)/$(basename $NEW .new)" + # If there's no config file by that name, mv it over: + if [ ! -r $OLD ]; then + mv $NEW $OLD + elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then # toss the redundant copy + rm $NEW + fi + # Otherwise, we leave the .new copy for the admin to consider... +} + +if [ -x usr/bin/update-desktop-database ]; then + usr/bin/update-desktop-database usr/share/applications >/dev/null 2>&1 +fi + +# Keep same perms on rc.wifi-radar.new: +if [ -e etc/rc.d/rc.wifi-radar ]; then + cp -a etc/rc.d/rc.wifi-radar etc/rc.d/rc.wifi-radar.new.incoming + cat etc/rc.d/rc.wifi-radar.new > etc/rc.d/rc.wifi-radar.new.incoming + mv etc/rc.d/rc.wifi-radar.new.incoming etc/rc.d/rc.wifi-radar.new +fi + +config etc/wifi-radar/wifi-radar.conf.new +config etc/rc.d/rc.wifi-radar.new + +echo "Remember to edit /etc/wifi-radar/wifi-radar.conf to suit your needs..." +echo +echo "To use wifi-radar with a normal user (with sudo) add:" +echo "%users ALL = NOPASSWD: /usr/sbin/wifi-radar" +echo "to /etc/sudoers, then launch wifi-radar.sh" +echo diff --git a/network/wifi-radar/rc.wifi-radar b/network/wifi-radar/rc.wifi-radar new file mode 100644 index 0000000000..014d9d9bd9 --- /dev/null +++ b/network/wifi-radar/rc.wifi-radar @@ -0,0 +1,62 @@ +#!/bin/sh +# +# Start/Stop the WiFi-Radar daemon +# + +# get the wifi interface from rc.inet1.conf if it is set +. /etc/rc.d/rc.inet1.conf +INTERFACE="${IFNAME[4]}" +PIDFILE=/var/run/wifi.pid + +start() { + # use the forced interface found in rc.inet1.conf or guess it + [ ! "$INTERFACE" ] && INTERFACE="$(iwconfig 2>/dev/null | grep ESSID | head -n1 | cut -d " " -f 1)" + sed -i "s/^[ \t]*interface[ \t]*=[ \t]*.*/interface = $INTERFACE/" /etc/wifi-radar/wifi-radar.conf + + if [ -e "${PIDFILE}" ]; then + echo "Found existing ${PIDFILE}! Stopping first before starting" + stop + fi + echo "Starting WiFi-Radar: " + /usr/sbin/wifi-radar --daemon 1> /dev/null 2> /dev/null & + ps -e | grep wifi-radar | cut -d" " -f2 > ${PIDFILE} +} + +stop() { + echo "Stopping WiFi-Radar: " + if [ -e "${PIDFILE}" ]; then + kill $(cat ${PIDFILE}) 1> /dev/null 2> /dev/null + rm -f ${PIDFILE} + fi +killall wifi-radar 1> /dev/null 2> /dev/null +} + +restart() { + stop + sleep 2 + start +} + +status() { + if [ -e ${PIDFILE} ]; then + echo "The WiFi-Radar daemon is running." + else + echo "The WiFi-Radar daemon is not running" + fi +} + +# See how we were called. +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart) + restart + ;; + *) + echo $"Usage: $0 {start|stop|restart}" + ;; +esac diff --git a/network/wifi-radar/slack-desc b/network/wifi-radar/slack-desc new file mode 100644 index 0000000000..3c1b88852a --- /dev/null +++ b/network/wifi-radar/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. Line +# up the first '|' above the ':' following the base package name, and the '|' on +# the right side marks the last column you can put a character in. You must make +# exactly 11 lines for the formatting to be correct. It's also customary to +# leave one space after the ':'. + + |-----handy-ruler---------------------------------------------------| +wifi-radar: Wifi Radar (Python/PyGTK2 utility for managing WiFi profiles) +wifi-radar: +wifi-radar: WiFi Radar is a Python/PyGTK2 utility for managing WiFi profiles. +wifi-radar: It enables you to scan for available networks and create profiles +wifi-radar: for your preferred networks. At boot time, running WiFi Radar will +wifi-radar: automatically scan for an available preferred network and connect +wifi-radar: to it. +wifi-radar: +wifi-radar: +wifi-radar: +wifi-radar: diff --git a/network/wifi-radar/wifi-radar.SlackBuild b/network/wifi-radar/wifi-radar.SlackBuild new file mode 100644 index 0000000000..38e94276e2 --- /dev/null +++ b/network/wifi-radar/wifi-radar.SlackBuild @@ -0,0 +1,84 @@ +#!/bin/sh +# Slackware build script for Wifi-radar + +# Copyright 2006-2007 David Somero (dsomero@hotmail.com) +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=wifi-radar +VERSION=${VERSION:-1.9.8} +ARCH=noarch +BUILD=${BUILD:-2} +TAG=${TAG:-_SBo} + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +KSUDO=${KSUDO:-no} + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2 +cd $PRGNAM-$VERSION + +chown -R root:root . +chmod -R u+w,go+r-w,a-s . + +sed -i -e 's|etc/init.d|etc/rc.d|g' Makefile +sed -i -e 's|auto_detect||g' wifi-radar.conf + +if [ $KSUDO = "yes" ]; then + sed -i -e 's|gksudo -S|kdesu|' -e '10d' wifi-radar.desktop +else + sed -i -e 's|gksudo -S wifi-radar|wifi-radar.sh|' -e '10d' wifi-radar.desktop +fi + +make + +# Install everything manually +install -D -m 0755 wifi-radar.localized $PKG/usr/sbin/wifi-radar +install -D -m 0644 wifi-radar.1 $PKG/usr/man/man1/wifi-radar.1 +install -D -m 0644 wifi-radar.conf.5 $PKG/usr/man/man5/wifi-radar.conf.5 +install -D -m 0755 $CWD/rc.wifi-radar $PKG/etc/rc.d/rc.wifi-radar.new +install -D -m 0644 pixmaps/wifi-radar.svg $PKG/usr/share/pixmaps/wifi-radar.svg +install -D -m 0644 pixmaps/wifi-radar.png $PKG/usr/share/pixmaps/wifi-radar.png +install -D -m 0644 wifi-radar.desktop $PKG/usr/share/applications/wifi-radar.desktop +install -D -m 0644 $CWD/slack-desc $PKG/install/slack-desc +install -D -m 0744 $CWD/doinst.sh $PKG/install/doinst.sh +install -D -m 0600 wifi-radar.conf $PKG/etc/wifi-radar/wifi-radar.conf.new +install -D -m 0755 wifi-radar.sh $PKG/usr/bin/wifi-radar.sh + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a README CHANGE.LOG INSTALL VERSION TODO COPYING CREDITS \ + README.WPA-Mini-HOWTO.txt DEVELOPER_GUIDELINES $CWD/slack-desc \ + $CWD/$PRGNAM.SlackBuild $PKG/usr/doc/$PRGNAM-$VERSION + +( cd $PKG/usr/man + find . -type f -exec gzip -9 {} \; + for i in $(find . -type l) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done +) + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.tgz diff --git a/network/wifi-radar/wifi-radar.info b/network/wifi-radar/wifi-radar.info new file mode 100644 index 0000000000..e71d727bd4 --- /dev/null +++ b/network/wifi-radar/wifi-radar.info @@ -0,0 +1,8 @@ +PRGNAM="wifi-radar" +VERSION="1.9.8" +HOMEPAGE="http://wifi-radar.systemimager.org" +DOWNLOAD="http://wifi-radar.systemimager.org/pub/wifi-radar-1.9.8.tar.bz2" +MD5SUM="827cc9974298afefd143e9aaf15f95cc" +MAINTAINER="David Somero" +EMAIL="dsomero@hotmail.com " +APPROVED="Alan_Hicks" -- cgit v1.2.3