Re: Get uuid of connection



On Wed, 2010-07-21 at 16:41 +0100, Arlen Nascimento wrote:
> Ok, i could add a connection, but it is a system connection.
> As far as i noted, in order to this connection I created be detected
> by the scripts i'm using, it has to be a user connection.
> How to create a user connection in the command line? 

Here's how I do it...

#!/bin/bash

CONNECTIONNO=1

while gconftool-2
--dir-exists /system/networking/connections/$CONNECTIONNO; do
      CONNECTIONNO=$((CONNECTIONNO+1))
done
echo Connection number $((CONNECTIONNO))
TIMESTAMP=`date +%s`
UUID=`cat /proc/sys/kernel/random/uuid`

gconftool-2 --load - <<EOF
<gconfentryfile>
  <entrylist base="/system/networking/connections/$CONNECTIONNO">
    <entry>
      <key>connection/id</key>
      <value>
        <string>My VPN connection</string>
      </value>
    </entry>
    <entry>
      <key>connection/name</key>
      <value>
        <string>connection</string>
      </value>
    </entry>
    <entry>
      <key>connection/timestamp</key>
      <value>
        <string>$TIMESTAMP</string>
      </value>
    </entry>
    <entry>
      <key>connection/type</key>
      <value>
        <string>vpn</string>
      </value>
    </entry>
    <entry>
      <key>connection/uuid</key>
      <value>
        <string>$UUID</string>
      </value>
    </entry>
    <entry>
      <key>ipv4/addresses</key>
      <value>
        <list type="int">
        </list>
      </value>
    </entry>
    <entry>
      <key>ipv4/dns</key>
      <value>
        <list type="int">
        </list>
      </value>
    </entry>
    <entry>
      <key>ipv4/method</key>
      <value>
        <string>auto</string>
      </value>
    </entry>
    <entry>
      <key>ipv4/name</key>
      <value>
        <string>ipv4</string>
      </value>
    </entry>
    <entry>
      <key>ipv4/routes</key>
      <value>
        <list type="int">
        </list>
      </value>
    </entry>
    <entry>
      <key>vpn/authtype</key>
      <value>
        <string>password</string>
      </value>
    </entry>
    <entry>
      <key>vpn/autoconnect</key>
      <value>
        <string>yes</string>
      </value>
    </entry>
    <entry>
      <key>vpn/gateway</key>
      <value>
        <string>vpn.example.edu</string>
      </value>
    </entry>
    <entry>
      <key>vpn/lasthost</key>
      <value>
        <string>vpn.example.edu</string>
      </value>
    </entry>
    <entry>
      <key>vpn/service-type</key>
      <value>
        <string>org.freedesktop.NetworkManager.openconnect</string>
      </value>
    </entry>
  </entrylist>
</gconfentryfile>
EOF

-- 
dwmw2



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]