Wiki source for getWpaPSK()


Show raw source

=== Summary ===

The function getWpaPSK() is used to return the [[WPA-PSK]] key variable. It is part of the file [[wag-profiles.sh]] which is a function library and also a wizard for setting up wireless profiles. wag-profiles.sh is used in the Network Wizard called "[[http://www.puppylinux.org/wikka/Network_Wizard/|Network Wizard]]". The function getWpaPSK() retrieves the value from the shell variable, PROFILE_KEY defined in wag-profiles.sh

=== Calling Sequence ===

to use getWpaPSK() the key must first be defined. The key is defined as follows:

**Step 1.** == Obtain Profile Data via Either A Scan, or an existing profile ==
**Step 1 (a).** == Scan for available wireless Networks ==
A scan is not necessary if the profile is already defined. However, scanning is done when using the associated start-up script [[rc.network]] (Note 1) so that on startup, the script doesn't try to connect to an unavailable network. Network Wizard comes with two different network scan methods defined within wag-profiles.sh which are shown in the following table.

|=|Wizard Function|=|start-up function|=|network utility|=|package|=|Note||
||[[buildScanWindow()]] || [[run_iw_scan()]] ||[[iwlist]] ||[[net-tools]] || ||
||[[buildPrismScanWindow()]] ||[[runPrismScan]] ||[[wlanctl-ng]] ||[[wlanctl-ng]] || ||

In the case of buildSandWindow(), the result of the scan is stored in a temporary file which is the largest of two scans.

%%ScanListFile=$(du -b /tmp/net-setup_scan*.tmp |sort -n | tail -n1 |cut -f2)%%
(line 1821 of netsetup-sh_

two scans are taken because iwlist is not guaranteed to return all available wireless networks in a single scan.


**Step 1(b)** == Loading an existing Profile ==

When a profile is obtained via a scan the results of the scan are assigned to profile variables via [[setupSannedProfile()]], which calls [[setupNewProfile()]]. This function retrieves the profile variables from the ScanListFile (e.g. /tmp/net-setup_scan1.tmp) using the function [[Get_Cell_Parameters]].

Alternatively a profile can be loaded from an existing profile file, either directly by [[sourcing_the_file]] or indirectly by using the function [[loadProfileData()]]. In either case the profile info is assigned to temporary variables which must be first assigned to the profile variables by calling the function [[assignProfileData]].

assignProfileData is called automatically in the function loadProfileData() but my be explicitly called if either the profile file is directly sourced, as it is in the startup script, or if instead the profile data is obtained by using the function Get_Cell_Parameters. For instance on start-up Get_Cell_Parameters is called directly rather then through setupScannedProfile because the profile already exists.

**Step 2.**
After the profile is loaded and assigned to the profile variables then the WPA-PSK key can be obtained via the function getWpaPSK. However, normally this function is typically called when trying to connect to a new WPA profile rather than being called directly. (see for instance [[useWPASupplicant()]]

=== Catagories ===
CategoryNetworkWizard
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki