From df2efb4f69a37668b76bfd4f86290b060b24c563 Mon Sep 17 00:00:00 2001 From: luqiuwen Date: Fri, 6 Sep 2019 16:52:23 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9B=86=E6=88=90TUN=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E9=80=82=E9=85=8D=E6=9C=8D=E5=8A=A1=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script/CMakeLists.txt | 3 +++ script/service/tfe-env-tun-mode.service | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 script/service/tfe-env-tun-mode.service diff --git a/script/CMakeLists.txt b/script/CMakeLists.txt index b269bf2..791e1d5 100644 --- a/script/CMakeLists.txt +++ b/script/CMakeLists.txt @@ -1,4 +1,7 @@ +install(PROGRAMS user/r2_tfe DESTINATION ./ COMPONENT Program) +install(PROGRAMS user/r3_tfe DESTINATION ./ COMPONENT Program) install(FILES sysctl/80-tfe.conf DESTINATION /etc/sysctl.d/ COMPONENT Program) install(FILES service/tfe.service DESTINATION /usr/lib/systemd/system/ COMPONENT Program) +install(FILES service/tfe-env-tun-mode.service DESTINATION /usr/lib/systemd/system/ COMPONENT Program) install(FILES service/tfe-env.service DESTINATION /usr/lib/systemd/system/ COMPONENT Program) install(FILES service/tfe-env-config DESTINATION /etc/sysconfig/ COMPONENT Profile) diff --git a/script/service/tfe-env-tun-mode.service b/script/service/tfe-env-tun-mode.service new file mode 100644 index 0000000..4136894 --- /dev/null +++ b/script/service/tfe-env-tun-mode.service @@ -0,0 +1,24 @@ +[Unit] +Description=Tango Frontend Engine - Running Environment Setup +Requires=tfe-env.service +Before=tfe-env.service + +[Service] +EnvironmentFile=/etc/sysconfig/tfe-env-config +Type=oneshot +RemainAfterExit=yes + +# all works are done in execstartpre, this is only a fake target +ExecStart=/bin/true +ExecStop=/bin/true + +# start +ExecStartPost=/usr/sbin/ip tuntap add dev ${TFE_DEVICE_DATA_INCOMING} mode tap +ExecStartPost=/usr/sbin/ifconfig ${TFE_DEVICE_DATA_INCOMING} up + +# stop +ExecStopPost=/usr/bin/systemctl stop tfe-env +ExecStopPost=/usr/sbin/ip tuntap del dev ${TFE_DEVICE_DATA_INCOMING} mode tap + +[Install] +WantedBy=multi-user.target