kopia lustrzana https://github.com/cyoung/stratux
Added the hostpad.user creation code here
rodzic
345350df82
commit
1b73935838
|
@ -1,5 +1,46 @@
|
|||
#!/bin/bash
|
||||
|
||||
##### Script for setting up new file structure for hostapd settings
|
||||
##### Look for hostapd.user and if found do nothing.
|
||||
##### If not assume because of previous version and convert to new file structure
|
||||
|
||||
#User settings for hostapd.conf and hostapd-edimax.conf
|
||||
DAEMON_USER_PREF=/etc/hostapd/hostapd.user
|
||||
|
||||
if [ ! -f $DAEMON_USER_PREF ]; then
|
||||
DAEMON_CONF=/etc/hostapd/hostapd.conf
|
||||
DAEMON_CONF_EDIMAX=/etc/hostapd/hostapd-edimax.conf
|
||||
HOSTAPD_VALUES=('ssid=' 'channel=' 'auth_algs=' 'wpa=' 'wpa_passphrase=' 'wpa_key_mgmt=' 'wpa_pairwise=' 'rsn_pairwise=')
|
||||
HOSTAPD_VALUES_RM=('#auth_algs=' '#wpa=' '#wpa_passphrase=' '#wpa_key_mgmt=' '#wpa_pairwise=' '#rsn_pairwise=')
|
||||
|
||||
for i in "${HOSTAPD_VALUES[@]}"
|
||||
do
|
||||
if grep -q "^$i" $DAEMON_CONF
|
||||
then
|
||||
grep "^$i" $DAEMON_CONF >> $DAEMON_USER_PREF
|
||||
sed -i '/^'"$i"'/d' $DAEMON_CONF
|
||||
sed -i '/^'"$i"'/d' $DAEMON_CONF_EDIMAX
|
||||
fi
|
||||
done
|
||||
for i in "${HOSTAPD_VALUES_RM[@]}"
|
||||
do
|
||||
if grep -q "^$i" $DAEMON_CONF
|
||||
then
|
||||
sed -i '/^'"$i"'/d' $DAEMON_CONF
|
||||
sed -i '/^'"$i"'/d' $DAEMON_CONF_EDIMAX
|
||||
fi
|
||||
done
|
||||
sleep 1
|
||||
#make sure there is time to get the file written before checking for it again
|
||||
# If once the code above runs and there is still no hostapd.user file then something is wrong and we will just create the file with basic settings.
|
||||
# Any more then this they somebody was messing with things and its not our fault things are this bad
|
||||
if [ ! -f $DAEMON_USER_PREF ]; then
|
||||
echo "ssid=stratux" >> $DAEMON_USER_PREF
|
||||
echo "channel=1" >> $DAEMON_USER_PREF
|
||||
fi
|
||||
fi
|
||||
##### End hostapd settings structure script
|
||||
|
||||
# Preliminaries. Kill off old services.
|
||||
/usr/bin/killall -9 hostapd hostapd-edimax
|
||||
/usr/sbin/service isc-dhcp-server stop
|
||||
|
@ -8,9 +49,6 @@
|
|||
DAEMON_CONF=/etc/hostapd/hostapd.conf
|
||||
DAEMON_SBIN=/usr/sbin/hostapd
|
||||
|
||||
#User settings for hostapd.conf and hostapd-edimax.conf
|
||||
DAEMON_USER_PREF=/etc/hostapd/hostapd.user
|
||||
|
||||
# Temporary hostapd.conf built by combining
|
||||
# non-editable /etc/hostapd/hostapd.conf or hostapd-edimax.conf
|
||||
# and the user configurable /etc/hostapd/hostapd.conf
|
||||
|
|
Ładowanie…
Reference in New Issue