Maemo debianization.
[wpasupplicant] / debian / wpa_gui / netdev_wrapper
1 #!/bin/sh -e
2
3 # Wrapper script to determine if user is a member of the netdev group or not
4 # and exec wpa_gui with or without root privileges.
5 #
6 # Copyright: Copyright (c) 2008, Kel Modderman <kel@otaku42.de>
7 # License:   GPL-2
8
9 WPAGUI=/usr/sbin/wpa_gui
10
11 if id -Gn | grep -q -w netdev; then
12         # caller is a member of the netdev group, if instructions in
13         # README.Debian were followed to setup wpa-roam they will find
14         # wpa_gui quite useful
15         exec $WPAGUI "$@"
16 elif which su-to-root >/dev/null; then
17         # caller is not a member of netdev group, and thus most
18         # likely requires root for wpa_gui to be useful
19         exec su-to-root -X -c $WPAGUI "$@"
20 else
21         # not a member of netdev group and not able to su-to-root, just
22         # exec it and hope for the best ...
23         exec $WPAGUI "$@"
24 fi