]> git.ipfire.org Git - people/stevee/network.git/blame - src/header-port
Use autotools.
[people/stevee/network.git] / src / header-port
CommitLineData
5b20e43a
MT
1#!/bin/bash
2###############################################################################
3# #
4# IPFire.org - A linux based firewall #
1848564d 5# Copyright (C) 2010 Michael Tremer & Christian Schmidt #
5b20e43a
MT
6# #
7# This program is free software: you can redistribute it and/or modify #
8# it under the terms of the GNU General Public License as published by #
9# the Free Software Foundation, either version 3 of the License, or #
10# (at your option) any later version. #
11# #
12# This program is distributed in the hope that it will be useful, #
13# but WITHOUT ANY WARRANTY; without even the implied warranty of #
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15# GNU General Public License for more details. #
16# #
17# You should have received a copy of the GNU General Public License #
18# along with this program. If not, see <http://www.gnu.org/licenses/>. #
19# #
20###############################################################################
21
98f4dae6 22INFO_SETTINGS="HOOK PORT_PARENTS PORT_CHILDREN"
1848564d 23
2eaf16f3
MT
24# This function is called after a device has been plugged
25# into the system and got its correct name.
26# The function is intended to create child ports and things
27# like that.
2181765d 28function hook_hotplug() {
2eaf16f3
MT
29 exit ${EXIT_OK}
30}
31
32# This function gets called when a device is plugged in
33# to determine the right name.
34# The first argument is the port which should be tested
35# against the second argument which is the device that
36# has been plugged in.
2181765d 37function hook_hotplug_rename() {
2eaf16f3 38 exit ${EXIT_FALSE}
8895cf8f
MT
39}
40
c2441156
SS
41function hook_add() {
42 cmd_not_implemented
43}
44
2181765d
MT
45function hook_info() {
46 local port="${1}"
98f4dae6 47 assert isset port
2181765d 48 shift
98f4dae6 49
2181765d 50 config_read "$(port_file ${port})"
98f4dae6 51
2181765d 52 local key val
98f4dae6
MT
53 for key in PORT_PARENTS PORT_CHILDREN; do
54 val="${key}_VAR"
55 val=${!val}
56 eval "${key}=\"${!val}\""
57 done
58
59 for key in ${INFO_SETTINGS}; do
60 echo "${key}=\"${!key}\""
61 done
62
63 exit ${ERROR_OK}
64}
fe8e6d69 65
2181765d
MT
66function hook_status() {
67 local port="${1}"
fe8e6d69
MT
68 assert isset port
69
2181765d 70 cli_device_headline "${port}" --long
fe8e6d69
MT
71 exit ${EXIT_OK}
72}