developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 1 | #!/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 |
| 5 | mode="0" |
| 6 | add_quote="0" |
| 7 | cmd="atenl" |
developer | 461cb54 | 2022-04-29 18:17:44 +0800 | [diff] [blame] | 8 | ori_inf="" |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 9 | |
| 10 | for i in "$@" |
| 11 | do |
| 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 |
developer | 93dadcc | 2022-07-13 10:25:35 +0800 | [diff] [blame] | 20 | if [ ${i} = "ra0" ] || [ ${i} = "rax0" ]; then |
developer | 461cb54 | 2022-04-29 18:17:44 +0800 | [diff] [blame] | 21 | ori_inf=${i} |
developer | 9b7cdad | 2022-03-10 14:24:55 +0800 | [diff] [blame] | 22 | i="phy0" |
developer | 9b7cdad | 2022-03-10 14:24:55 +0800 | [diff] [blame] | 23 | fi |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 24 | cmd="${cmd} ${i}" |
| 25 | fi |
| 26 | done |
| 27 | |
| 28 | if [ "$mode" = "0" ]; then |
developer | 461cb54 | 2022-04-29 18:17:44 +0800 | [diff] [blame] | 29 | killall atenl > /dev/null 2>&1 |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 30 | fi |
| 31 | |
developer | 5698c9c | 2022-05-30 16:40:23 +0800 | [diff] [blame] | 32 | eval "${cmd}" |
developer | 461cb54 | 2022-04-29 18:17:44 +0800 | [diff] [blame] | 33 | if [[ ! -z "${ori_inf}" ]]; then |
| 34 | echo "if_name: ${ori_inf}" |
| 35 | fi |