ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/repos/FreeBSDAdmin/VPN/mpd-common.sh
Revision: 1006
Committed: 2008-05-18T17:29:24-07:00 (17 years, 1 month ago) by douglas
Content type: text/x-sh
File size: 675 byte(s)
Log Message:
Fix up some stuff.

File Contents

# User Rev Content
1 douglas 856 # MPD Interface Common
2     #
3     # Douglas Thrift
4     #
5     # $Id$
6    
7 douglas 1005 interface=$1
8     proto=$2
9     local_ip=$3
10     remote_ip=$4
11     authname=$5
12    
13     [[ $interface =~ ^ng[0-9]+$ ]] || usage
14     [[ $proto == inet ]] || usage
15 douglas 1006
16     if [[ $local_ip =~ ^([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})(/[0-9]+)?$ ]]; then
17     local_ip=${BASH_REMATCH[1]}
18     else
19     usage
20     fi
21    
22     if [[ $remote_ip =~ ^([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})(/[0-9]+)?$ ]]; then
23     remote_ip=${BASH_REMATCH[1]}
24     else
25     usage
26     fi
27    
28 douglas 1005 [[ -n $authname ]] || usage
29    
30     function key()
31     {
32     if [[ EUID -ne 0 ]]; then
33     read -er -p 'name: ' name || exit $?
34     read -er -p 'secret: ' secret || exit $?
35     else
36     read -r name secret < ~/.mpd-nsupdate.key || exit $?
37     fi
38     }

Properties

Name Value
svn:keywords Id