blob: 71d139f590cf4d1b8377e3d1cb6059c185de2d9e [file] [log] [blame]
developer3abe1ad2022-01-24 11:13:32 +08001#!/bin/ash
2# This script is used for wrapping atenl daemon to ated
3
4# 0 is normal mode, 1 is used for specific commands
5mode="0"
6add_quote="0"
7cmd="atenl"
developer461cb542022-04-29 18:17:44 +08008ori_inf=""
developer3abe1ad2022-01-24 11:13:32 +08009
10for i in "$@"
11do
12 if [ "$i" = "-c" ]; then
13 cmd="${cmd} -c"
14 mode="1"
15 add_quote="1"
16 elif [ "${add_quote}" = "1" ]; then
17 cmd="${cmd} \"${i}\""
18 add_quote="0"
19 else
developer9b7cdad2022-03-10 14:24:55 +080020 if [ ${i} = "ra0" ]; then
developer461cb542022-04-29 18:17:44 +080021 ori_inf=${i}
developer9b7cdad2022-03-10 14:24:55 +080022 i="phy0"
23 elif [ ${i} = "rax0" ]; then
developer461cb542022-04-29 18:17:44 +080024 ori_inf=${i}
developer9b7cdad2022-03-10 14:24:55 +080025 i="phy1"
26 fi
developer3abe1ad2022-01-24 11:13:32 +080027 cmd="${cmd} ${i}"
28 fi
29done
30
31if [ "$mode" = "0" ]; then
developer461cb542022-04-29 18:17:44 +080032 killall atenl > /dev/null 2>&1
developer3abe1ad2022-01-24 11:13:32 +080033fi
34
developer461cb542022-04-29 18:17:44 +080035eval "${cmd}" > /dev/null 2>&1 &
36if [[ ! -z "${ori_inf}" ]]; then
37 echo "if_name: ${ori_inf}"
38fi