diff options
| -rwxr-xr-x | bin/connmenu | 137 |
1 files changed, 69 insertions, 68 deletions
diff --git a/bin/connmenu b/bin/connmenu index d09a3d1..a5b9970 100755 --- a/bin/connmenu +++ b/bin/connmenu @@ -77,7 +77,7 @@ get_service_state() { create_dmenu() { [[ -f $SCAN_RESULT ]] || exit 1 - echo 'setup vpn pptp' + # echo 'setup vpn pptp' local order=1 local name local service_id @@ -124,25 +124,25 @@ trap '{ notify-send connman "an error occured" -c error -i "$(iconez -sn wifi-al get_services index="$(create_dmenu | dmenu -l 10 -i -p ' select wifi service' | sed 's/^ *//g' | cut -d ' ' -f 1)" -if [[ "$index" == setup ]]; then - # create vpn mode - dmenu_ask 'name this PPTP VPN' name - name="${name// /_}" - dmenu_ask 'please provide VPN domain' domain - dmenu_ask 'please provide identity' identity - dmenu_ask 'please provide password' password --password - cat >"$VPN_STORAGE_PATH/$name.config" <<-EOF - [provider_$name] - Type = PPTP - Name = $name - Host = $(dig +short A "$domain" | sort -n | head -n1) - Domain = $domain - PPTP.User = $identity - PPTP.Password = $password - EOF - notifysend "VPN $name is created" - exit 0 -fi +# if [[ "$index" == setup ]]; then +# # create vpn mode +# dmenu_ask 'name this PPTP VPN' name +# name="${name// /_}" +# dmenu_ask 'please provide VPN domain' domain +# dmenu_ask 'please provide identity' identity +# dmenu_ask 'please provide password' password --password +# cat >"$VPN_STORAGE_PATH/$name.config" <<-EOF +# [provider_$name] +# Type = PPTP +# Name = $name +# Host = $(dig +short A "$domain" | sort -n | head -n1) +# Domain = $domain +# PPTP.User = $identity +# PPTP.Password = $password +# EOF +# notifysend "VPN $name is created" +# exit 0 +# fi service_id="$(index_to_service "$index")" [[ "$service_id" ]] || exit 1 @@ -162,53 +162,54 @@ fi security="$(get_service_security "$service_id")" # create service file for encryption -if [[ "$security" =~ ^(ieee8021x|psk|wep)$ ]]; then - config_file="$STORAGE_PATH/$name-$security.config" - if [[ -f "$config_file" && no != "$(echo -e 'yes\nno' | dmenu -p ' use previous profile?')" ]]; then - echo "use old profile: $config_file" - else - dmenu_ask 'please provide password' password --password - case "$security" in - ieee8021x) - dmenu_ask 'please provide identity' identity - case "$(echo -e 'PEAP/MSCHAPV2\nTTLS/PAP' | dmenu -p ' please specify EAP type')" in - PEAP/MSCHAPV2) - eap=peap - phase2=MSCHAPV2 - ;; - TTLS/PAP) - eap=ttls - phase2=PAP - ;; - *) - ( - notifyicon=wifi-alert - notifysend 'invalid EAP' - ) - exit 1 - ;; - esac - cat >"$config_file" <<-EOF - [service_$service_id] - Type = wifi - Name = $name - EAP = $eap - Phase2 = $phase2 - Identity = $identity - Passphrase = $password - EOF - ;; - psk | wep) - cat >"$config_file" <<-EOF - [service_$service_id] - Type = wifi - Name = $name - Passphrase = $password - EOF - ;; - esac - chmod 600 "$config_file" - fi +if [[ ! "$name" =~ ^\* ]] && [[ "$security" =~ ^(ieee8021x|psk|wep)$ ]]; then + notifysend 'setting up connection not implemented' -c error + # config_file="$STORAGE_PATH/$name-$security.config" + # if [[ -f "$config_file" && no != "$(echo -e 'yes\nno' | dmenu -p ' use previous profile?')" ]]; then + # echo "use old profile: $config_file" + # else + # dmenu_ask 'please provide password' password --password + # case "$security" in + # ieee8021x) + # dmenu_ask 'please provide identity' identity + # case "$(echo -e 'PEAP/MSCHAPV2\nTTLS/PAP' | dmenu -p ' please specify EAP type')" in + # PEAP/MSCHAPV2) + # eap=peap + # phase2=MSCHAPV2 + # ;; + # TTLS/PAP) + # eap=ttls + # phase2=PAP + # ;; + # *) + # ( + # notifyicon=wifi-alert + # notifysend 'invalid EAP' -c error + # ) + # exit 1 + # ;; + # esac + # cat >"$config_file" <<-EOF + # [service_$service_id] + # Type = wifi + # Name = $name + # EAP = $eap + # Phase2 = $phase2 + # Identity = $identity + # Passphrase = $password + # EOF + # ;; + # psk | wep) + # cat >"$config_file" <<-EOF + # [service_$service_id] + # Type = wifi + # Name = $name + # Passphrase = $password + # EOF + # ;; + # esac + # chmod 600 "$config_file" + # fi fi connman_msg="$(timeout 10 connmanctl connect "$service_id" 2>&1 | head -n 1)" @@ -222,6 +223,6 @@ else [[ "$connman_msg" ]] && error_msg="$(cut -d ' ' -f 3- <<<"$connman_msg")" ( notifyicon=wifi-cancel - notifysend "cannot connect to $name ($error_msg)" + notifysend "cannot connect to $name ($error_msg)" -c error ) fi |