summaryrefslogtreecommitdiff
path: root/etc/default/vyatta.in
blob: 06ce797731f2e88a9aff4cd9596a7be6e8ac8385 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# declare configured Vyatta shell environment variables

# first set vars per args of the "source /etc/default/vyatta VAR=FOO"
_vyatta_extglob=$(shopt -p extglob)
shopt -s extglob
for arg ; do
    [[ $arg == *=* ]] && \
	eval declare -x $arg
done
eval $_vyatta_extglob
unset _vyatta_extglob

{
  # These declarations must go within braces in order to be able to silence
  # readonly variable errors.

    for var in prefix exec_prefix datarootdir ; do
	eval test -n \"\$$var\" \&\& _vyatta_save_$var=\$$var
    done

    prefix=@prefix@
    exec_prefix=@exec_prefix@
    datarootdir=@datarootdir@

    if test -z "$vyatta_prefix" ; then
	if test -n "@prefix@" ; then
	    declare -x -r vyatta_prefix=@prefix@
            declare -x -r vyos_prefix=@prefix@
	else
	    declare -x -r vyatta_prefix=/opt/vyatta
            declare -x -r vyos_prefix=/opt/vyatta
	fi
    fi
    if test -z "$vyatta_exec_prefix" ; then
	if test -n "@exec_prefix@" ; then
	    declare -x -r vyatta_prefix=@exec_prefix@
            declare -x -r vyos_prefix=@exec_prefix@
	else
	    declare -x -r vyatta_prefix=$vyatta_prefix
            declare -x -r vyos_prefix=$vyatta_prefix
	fi
    fi
    if test -z "$vyatta_datarootdir" ; then
	if test -n "@datarootdir@" ; then
	    declare -x -r vyatta_datarootdir=@datarootdir@
            declare -x -r vyos_datarootdir=@datarootdir@
	else
	    declare -x -r vyatta_datarootdir=$vyatta_prefix/share
            declare -x -r vyos_datarootdir=$vyatta_prefix/share
	fi
    fi
    if test -z "$vyatta_bindir" ; then
	if test -n "@bindir@" ; then
	    declare -x -r vyatta_bindir=@bindir@
	else
	    declare -x -r vyatta_bindir=$vyatta_exec_prefix/bin
	fi
    fi
    if test -z "$vyatta_sbindir" ; then
	if test -n "@sbindir@" ; then
	    declare -x -r vyatta_sbindir=@sbindir@
	else
	    declare -x -r vyatta_sbindir=$vyatta_exec_prefix/sbin
	fi
    fi
    if test -z "$vyatta_libdir" ; then
	if test -n "@libdir@" ; then
	    declare -x -r vyatta_libdir=@libdir@
            declare -x -r vyos_libdir=@libdir@
	else
	    declare -x -r vyatta_libdir=$vyatta_exec_prefix/lib
            declare -x -r vyos_libdir=$vyatta_exec_prefix/lib
	fi
    fi
    if test -z "$vyatta_libexecdir" ; then
	if test -n "@libexecdir@" ; then
	    declare -x -r vyatta_libexecdir=@libexecdir@
	else
	    declare -x -r vyatta_libexecdir=$vyatta_exec_prefix/libexec
	fi
    fi
    if test -z "$vyatta_datadir" ; then
	if test -n "@datadir@" ; then
	    declare -x -r vyatta_datadir=@datadir@
            declare -x -r vyos_datadir=@datadir@
	else
	    declare -x -r vyatta_datadir=$vyatta_datarootdir
            declare -x -r vyos_datadir=$vyatta_datarootdir
	fi
    fi
    if test -z "$vyatta_htmldir" ; then
	if test -n "@htmldir@" ; then
	    declare -x -r vyatta_htmldir=@htmldir@
	else
	    declare -x -r vyatta_htmldir=$vyatta_datarootdir/html
	fi
    fi
    if test -z "$vyatta_infodir" ; then
	if test -n "@infodir@" ; then
	    declare -x -r vyatta_infodir=@infodir@
	else
	    declare -x -r vyatta_infodir=$vyatta_datarootdir/info
	fi
    fi
    if test -z "$vyatta_mandir" ; then
	if test -n "@mandir@" ; then
	    declare -x -r vyatta_htmldir=@mandir@
	else
	    declare -x -r vyatta_htmldir=$vyatta_datarootdir/man
	fi
    fi
    if test -z "$vyatta_localedir" ; then
	if test -n "@localedir@" ; then
	    declare -x -r vyatta_localedir=@localedir@
	else
	    declare -x -r vyatta_localedir=$vyatta_datarootdir/locale
	fi
    fi
    if test -z "$vyatta_localstatedir" ; then
	if test -n "@localstatedir@" ; then
	    declare -x -r vyatta_localstatedir=@localstatedir@
	else
	    declare -x -r vyatta_localstatedir=$vyatta_prefix/var
	fi
    fi
    if test -z "$vyatta_sharedstatedir" ; then
	if test -n "@sharedstatedir@" ; then
	    declare -x -r vyatta_sharedstatedir=@sharedstatedir@
	else
	    declare -x -r vyatta_sharedstatedir=$vyatta_prefix/com
	fi
    fi
    if test -z "$vyatta_sysconfdir" ; then
	if test -n "@sysconfdir@" ; then
	    declare -x -r vyatta_sysconfdir=@sysconfdir@
	else
	    declare -x -r vyatta_sysconfdir=$vyatta_prefix/etc
	fi
    fi

    if test -z "$vyatta_op_templates" ; then
	declare -x -r vyatta_op_templates=$vyatta_datadir/vyatta-op/templates
        declare -x -r vyos_op_templates=$vyatta_datadir/vyatta-op/templates
    fi
    if test -z "$vyatta_cfg_templates" ; then
	declare -x -r vyatta_cfg_templates=$vyatta_datadir/vyatta-cfg/templates
        declare -x -r vyos_cfg_templates=$vyatta_datadir/vyatta-cfg/templates
    fi
    if test -z "$vyatta_configdir" ; then
	declare -x -r vyatta_configdir=$vyatta_prefix/config
        declare -x -r vyos_configdir=$vyatta_prefix/config
    fi

    for var in prefix exec_prefix datarootdir ; do
	eval test -n \"\$_vyatta_save_$var\" \&\& $var=\$_vyatta_save_$var
    done

    # It's not like we do, or should support installing VyOS at a different prefix
    declare -x -r vyos_libexec_dir=/usr/libexec/vyos
    declare -x -r vyos_bin_dir=/usr/bin
    declare -x -r vyos_sbin_dir=/usr/sbin

    if test -z "$vyos_conf_scripts_dir" ; then
        declare -x -r vyos_conf_scripts_dir=$vyos_libexec_dir/conf_mode
    fi

    if test -z "$vyos_op_scripts_dir" ; then
        declare -x -r vyos_op_scripts_dir=$vyos_libexec_dir/op_mode
    fi

    if test -z "$vyos_completion__dir" ; then
        declare -x -r vyos_completion_dir=$vyos_libexec_dir/completion
    fi

    if test -z "$vyos_validators_dir" ; then
        declare -x -r vyos_validators_dir=$vyos_libexec_dir/validators
    fi

    if test -z "$VRF" ; then
        VRF=$(ip vrf identify)
        [ -n "$VRF" ] && declare -x -r VRF="${VRF}"
    fi
    if test -z "$NETNS" ; then
        NETNS=$(ip netns identify)
        [ -n "$NETNS" ] && declare -x -r NETNS="${NETNS}"
    fi


} 2>/dev/null || :

[ -r /etc/default/vyatta-cfg ] && source /etc/default/vyatta-cfg

[ -r /etc/default/vyatta-local-env ] && source /etc/default/vyatta-local-env

###  Local Variables:
###  mode: shell-script
###  End: