]>
git.ipfire.org Git - people/stevee/network.git/blob - functions.ports
5 echo "${CONFIG_DIR}/ports"
13 echo "$(port_dir)/${port}"
16 function port_exists
() {
19 [ -f "${CONFIG_DIR}/ports/${port}" ]
22 function port_get_hook
() {
27 config_get_hook $
(port_file
${port})
30 function port_is_attached
() {
37 for zone
in $
(zones_get_all
); do
40 assert zone_exists
${zone}
42 if listmatch
${port} $
(zone_get_ports
${zone}); then
51 function port_create
() {
55 #if port_exists ${port}; then
56 # error "Port '${port}' does already exist."
57 # return ${EXIT_ERROR}
63 if ! hook_exists port
${hook}; then
64 error
"Port hook '${hook}' does not exist."
68 #port_edit ${port} ${hook} $@
70 #if [ $? -ne ${EXIT_OK} ]; then
71 # port_destroy ${port}
74 hook_exec port
${hook} create $@
77 function port_destroy
() {
82 port_exists
${port} ||
return ${EXIT_OK}
84 local attached_zone
=$
(port_is_attached
${port})
86 if [ -n "${attached_zone}" ]; then
87 error
"Cannot destroy port '${port}' which is attached to zone '${attached_zone}'."
93 rm -f $
(port_file
${port})
96 function port_remove
() {
100 function port_edit
() {
104 # XXX? Compatibility function
105 function port_show
() {
113 function port_down
() {
117 function port_status
() {
121 function port_cmd
() {
129 local hook
=$
(port_get_hook
${port})
133 hook_exec port
${hook} ${cmd} ${port} $@
136 function ports_get
() {
138 for port
in $
(port_dir
)/*; do
139 port
=$
(basename ${port})
140 if port_exists
${port}; then