blob: b38ff67341a2080ffbd509e07d4cbf5ebcd4db50 [file] [log] [blame]
xf.li86118912025-03-19 20:07:27 -07001#!/bin/sh
2
3path_sh=`nv get path_sh`
4. $path_sh/global.sh
5echo "Info: config-parents $1 $2 $3 start" >> $test_log
6
7device()
8{
9 fname=$path_conf"/children_device_file"
10 fbak=$path_conf"/children_device_file_bak"
11
12 if [ "x$1" = "x" ]; then
13 echo "insufficient arguments.."
14 elif [ "x$2" = "x" ]; then
15 sed -e "/$1/d" $fname > $fbak
16 cat $fbak > $fname
17 rm -f $fbak
18 else # $1 mac, $2 hostname
19 sed -e "/$1/d" $fname > $fbak
20 echo "$1 $2" >> $fbak
21 cat $fbak > $fname
22 rm -f $fbak
23 fi
24}
25white_site()
26{
27 fname=${path_conf}/white_site_file
28 fbak=${path_conf}/white_site_file_bak
29 if [ "x$1" = "x" ]; then
30 echo "no action"
31 elif [ "x$1" = "x-A" ]; then
32 if [ "x$2" = "x" ]; then
33 echo "no site to add"
34 else #s2:site s3:name
35 #sed -i "s%$2.*%%" $fname
36 #sed -i "/^$/d" $fname
37 echo "$2,$3" >> $fname
38 #cat $fbak > $fname
39 #rm -f $fbak
40 fi
41 elif [ "x$1" = "x-D" ]; then
42 if [ "x$2" = "x" ]; then
43 echo "no site to delete"
44 else #s2:ids
45 ids=$2
46 if [ -n "$ids" ]; then
47 echo $ids|grep ",$"
48 if [ 0 -eq $? ]; then
49 echo "_____1"
50 echo $ids|sed 's/\(,\)/d;/g'|sed 's%^\(.*\)%sed -i "\1"%'|sed "s,$, $fname,"|sh
51 else
52 echo "______2"
53 echo $ids|sed 's/\(,\)/d;/g'|sed 's%^\(.*\)%sed -i "\1d"%'|sed "s,$, $fname," |sh
54 fi
55 fi
56 fi
57 else # $1 mac, $2 hostname
58 echo "error action"
59 fi
60}
61
62if [ "$1" = "white_site" ]; then
63 white_site $2 $3 $4
64elif [ "$1" = "device" ]; then
65 device $2 $3
66fi