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 | 9b7cdad | 2022-03-10 14:24:55 +0800 | [diff] [blame] | 20 | if [ ${i} = "ra0" ]; 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" |
| 23 | elif [ ${i} = "rax0" ]; then |
developer | 461cb54 | 2022-04-29 18:17:44 +0800 | [diff] [blame] | 24 | ori_inf=${i} |
developer | 9b7cdad | 2022-03-10 14:24:55 +0800 | [diff] [blame] | 25 | i="phy1" |
| 26 | fi |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 27 | cmd="${cmd} ${i}" |
| 28 | fi |
| 29 | done |
| 30 | |
| 31 | if [ "$mode" = "0" ]; then |
developer | 461cb54 | 2022-04-29 18:17:44 +0800 | [diff] [blame] | 32 | killall atenl > /dev/null 2>&1 |
developer | 3abe1ad | 2022-01-24 11:13:32 +0800 | [diff] [blame] | 33 | fi |
| 34 | |
developer | 461cb54 | 2022-04-29 18:17:44 +0800 | [diff] [blame] | 35 | eval "${cmd}" > /dev/null 2>&1 & |
| 36 | if [[ ! -z "${ori_inf}" ]]; then |
| 37 | echo "if_name: ${ori_inf}" |
| 38 | fi |