SPECS: wlan-ui.spec - tweaks & fixes; added config file and some m...

radek radek at pld-linux.org
Mon Jul 24 15:29:50 CEST 2006


Author: radek                        Date: Mon Jul 24 13:29:50 2006 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- tweaks & fixes; added config file and some magic

---- Files affected:
SPECS:
   wlan-ui.spec (1.1 -> 1.2) 

---- Diffs:

================================================================
Index: SPECS/wlan-ui.spec
diff -u SPECS/wlan-ui.spec:1.1 SPECS/wlan-ui.spec:1.2
--- SPECS/wlan-ui.spec:1.1	Mon Jul 24 14:03:36 2006
+++ SPECS/wlan-ui.spec	Mon Jul 24 15:29:44 2006
@@ -2,7 +2,6 @@
 #
 # TODO:
 # - .desktop
-# - sudo / gnomesu support
 #
 %include	/usr/lib/rpm/macros.perl
 Summary:	wlan-ui - UI for selecting and connecting to WLAN access points (APs)
@@ -14,12 +13,14 @@
 Group:		Applications/Networking
 Source0:	http://dl.sourceforge.net/wlan-ui/%{name}.pl
 # Source0-md5:	73f1082f42b0068d68dcc7af11574019
+Patch0:		%{name}-rt2x00.patch
 URL:		http://wlan-ui.sourceforge.net/
 BuildRequires:	perl-tools-pod
 BuildRequires:	rpm-perlprov >= 4.1-13
 Requires:	dhcpcd
 Requires:	module-init-tools
 Requires:	net-tools
+Requires:	pci-database
 Requires:	procps
 Requires:	wireless-tools
 BuildArch:	noarch
@@ -31,12 +32,20 @@
 
 #%description -l pl
 
+%prep
+%setup -q -c -T
+cp %{SOURCE0} .
+%patch0 -p0
+
+%build
+pod2man -s 1 %{SOURCE0} >%{name}.1
+
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1}
+install -d $RPM_BUILD_ROOT{%{_bindir},%{_mandir}/man1,%{_sysconfdir}}
 
-install      %{SOURCE0}  $RPM_BUILD_ROOT%{_bindir}/
-pod2man -s 1 %{SOURCE0} >$RPM_BUILD_ROOT%{_mandir}/man1/%{name}.1
+install *.pl $RPM_BUILD_ROOT%{_bindir}
+install *.1  $RPM_BUILD_ROOT%{_mandir}/man1
 
 cat <<'EOF' >$RPM_BUILD_ROOT%{_bindir}/%{name}
 #!/bin/sh
@@ -62,23 +71,71 @@
 
 if [ "`id -u`" -gt 0 ]; then
 	if (try_sudo $command); then
-		exec sudo $command
+		exec sudo $command "$@"
 	elif (try_gnomesu $command); then
-		exec gnomesu $command
+		exec gnomesu $command "$@"
 	else
-		exec $command
+		exec $command "$@"
 	fi
 else
-	exec $command
+	exec $command "$@"
 fi
 EOF
 
+cat <<'EOF' >$RPM_BUILD_ROOT%{_sysconfdir}/%{name}rc
+# configuration for %{name}
+
+# Wireless driver module to load
+#$MODULE = 'ipw2200';
+$MODULE = undef; 
+
+# Module parameters
+$MODULEPARAMS = '';
+
+# Wireless network device - e.g. 'wlan0'.
+# If not defined we use /proc/net/wireless to find the device
+$DEVICE = undef;
+
+# Commands for manipulating wlan module etc
+# We will find unspecified commands from the path
+$CMDS = {
+  'lsmod',    '/sbin/lsmod',
+  'modprobe', '/sbin/modprobe',
+  'load',     undef,              # modprobe used by default
+  'unload',   undef,              # modprobe -r used by default
+  'iwconfig', '/sbin/iwconfig',
+  'iwlist',   '/sbin/iwlist',
+  'ifconfig', '/sbin/ifconfig',
+  'ps',       undef,
+  'dhcpcd',   '/sbin/dhcpcd',
+  'pcidev',   '/usr/bin/pcidev',
+};
+
+$MODULE ||= try_to_find_module();    # fallback
+
+sub try_to_find_module {
+  if (defined $CMDS->{pcidev} && -x $CMDS->{pcidev}) {
+    for (grep /wireless|wlan|802\S*11/i, `$CMDS->{pcidev} net`) {
+      chomp;
+      next unless /^\S+\s+(\S+)\s+(.+?)\s*$/;
+      my ($module, $device) = ($1, $2);
+      warn "$0: using module '$1' for device '$2'\n";
+      return $1;
+    }
+  }
+  undef;
+}
+
+# vim: filetype=perl
+EOF
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
 %files
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_bindir}/*
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*
 %{_mandir}/man1/*
 
 %define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
@@ -87,6 +144,8 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.2  2006/07/24 13:29:44  radek
+- tweaks & fixes; added config file and some magic
+
 Revision 1.1  2006/07/24 12:03:36  radek
 - new
-
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/wlan-ui.spec?r1=1.1&r2=1.2&f=u



More information about the pld-cvs-commit mailing list