X7ROOT File Manager
Current Path:
/var/VMOptimizationToolsLinux
var
/
VMOptimizationToolsLinux
/
๐
..
๐
LinuxUpdate.XML
(645 B)
๐
SangforVMSTool
(3.11 KB)
๐
SangforVMSTool.service
(194 B)
๐
action_common.sh
(13.34 KB)
๐
busybox_cmd_ln.sh
(2.24 KB)
๐
collect_test_data.sh
(1.16 KB)
๐
common_config.sh
(278 B)
๐
data_test_tool.sh
(12.59 KB)
๐
debian_vmconfig.sh
(10.74 KB)
๐
guest_system_config.sh
(1.82 KB)
๐
log.sh
(1.36 KB)
๐
mod_test.sh
(3.69 KB)
๐
mod_test1.sh
(914 B)
๐
net_common.sh
(915 B)
๐
redhat_vmconfig.sh
(11.14 KB)
๐
sangfor_guest_datareport
(21.66 KB)
๐
sangfor_heartalive.sh
(2.37 KB)
๐
sangfor_module_update
(28.11 KB)
๐
sangfor_set_network.sh
(504 B)
๐
sangfor_sfping
(3.85 KB)
๐
sangfor_sshkey_gen
(1.29 KB)
๐
sangfor_update_ipc_callback
(5.29 KB)
๐
sangfor_vm_proxyd
(3.45 KB)
๐
sangfor_vm_proxyd_r
(4.4 KB)
๐
sangfor_vm_proxyd_w
(1.32 KB)
๐
sangfor_vmconfig
(2.4 KB)
๐
sangfor_vmconfig_common
(27.99 KB)
๐
sangfor_vmconfig_ipc_callback
(4.75 KB)
๐
sangfor_watchdog
(3.95 KB)
๐
sfping.c
(15.68 KB)
๐
sfping.pl
(6.15 KB)
๐
startall
(1.78 KB)
๐
stopall
(1.11 KB)
๐
suse_vmconfig.sh
(6.19 KB)
๐
tools_x64
๐
tools_x86
๐
uni_test.sh
(2.59 KB)
๐
update_common_func
(4.35 KB)
๐
update_common_header
(4.86 KB)
๐
update_config
(2.89 KB)
๐
update_install
(28.84 KB)
๐
virtio_nic_attr_set.sh
(2.42 KB)
๐
virtio_nic_compat.sh
(5.28 KB)
๐
vm_ip_recover.sh
(16.66 KB)
๐
vm_ipc.sh
(9.06 KB)
๐
vmconfig_common_func
(10.76 KB)
๐
vmconfig_common_header
(3.37 KB)
๐
vmconfig_config
(805 B)
๐
vmtools-install.sh
(31.16 KB)
๐
watch_test.sh
(313 B)
๐
watchdog.sh
(1.39 KB)
๐
x64
๐
x86
Editing: suse_vmconfig.sh
#!/bin/bash shell_dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) . "${shell_dir}/vmconfig_common_func" # set default route config # param $1: gateway # return 0(success),1(fail) suse_set_default_route() { local gateway=$1 test -z "$gateway" && return #delete first sed -i "/^\s*default/d" $g_suse_routes_config_file echo "default $gateway - -" >> $g_suse_routes_config_file } # add dns to global config file # param $1: dns # return 0(success),1(fail) suse_config_dns() { local dns=$1 local new_dns_list="" test -z "$dns" && return 1 log_debug "add dns $dns" orig_dns_list=`get_value_from_config "$g_suse_netconfig_file" "NETCONFIG_DNS_STATIC_SERVERS"` for i in $orig_dns_list do if [ x"$dns" == x"$i" ];then return 0 fi done cur_dns_num=`echo $orig_dns_list | awk '{print NF}'` # linuxๆๅคงๆฏๆ3ไธชdns if [ $cur_dns_num -ge 3 ];then valid_dns=`echo "$orig_dns_list" | awk '{print $2 " " $3}'` new_dns_list="$valid_dns $dns" else new_dns_list=" $orig_dns_list $dns" fi new_config="NETCONFIG_DNS_STATIC_SERVERS=\"$new_dns_list\"" sed -i "s/^\s*NETCONFIG_DNS_STATIC_SERVERS.*/$new_config/" $g_suse_netconfig_file echo $new_config return 0 } suse_clear_dns_config() { new_config="NETCONFIG_DNS_STATIC_SERVERS=\"\"" sed -i "s/^\s*NETCONFIG_DNS_STATIC_SERVERS.*/$new_config/" $g_suse_netconfig_file } # suse series system generate network config # param $1: ifname,eg:eth0 # param $2: protocol,eg:dhcp|static # param $3: ip,eg:192.168.100.100 # param $4: net mask,eg:255.255.255.0 # param $5: gateway,eg:192.168.100.1 # param $6: primary dns,eg:192.168.100.1 # param $7: secondary dns,eg:8.8.8.8 # return 0(success),1(fail) suse_gen_network_cfg_file() { local ifname=$1 local protocol=$2 local ipaddr=$3 local netmask=$4 local gateway=$5 local dns1=$6 local dns2=$7 local cfg_file="" test -z "$ifname" && return 1 if [ x"$protocol" != x"$PROTO_STATIC" ] && [ x"$protocol" != x"$PROTO_DHCP" ];then log_error "error,invalid proto $protocol" return 1 fi log_info "config:{$ifname,$protocol,$ipaddr,$netmask,$gateway,$dns1,$dns2}" cfg_file="$g_suse_network_cfg_dir/ifcfg-$ifname" echo "BOOTPROTO=$protocol" > $cfg_file is_valid_inet_address $ipaddr if [ $? -eq 0 ];then echo "IPADDR=$ipaddr" >> $cfg_file fi is_valid_inet_address $netmask if [ $? -eq 0 ];then echo "NETMASK=$netmask" >> $cfg_file fi is_valid_inet_address $gateway if [ $? -eq 0 ];then suse_set_default_route "$gateway" fi is_valid_inet_address $dns1 if [ $? -eq 0 ];then suse_config_dns "$dns1" fi is_valid_inet_address $dns2 if [ $? -eq 0 ];then suse_config_dns "$dns2" fi echo "STARTMODE='auto'" >> $cfg_file #ๅ ณ้ญ็ฉ็้พ่ทฏๆฃๆต๏ผ็ฝๅกๆญๅผๆ ๅตไธไฟ่ฏ่ฎพ็ฝฎipๆๅ echo "LINK_REQUIRED='no'" >> $cfg_file return 0 } suse_network_cfg_handle() { local ifname=$1 local ipaddr=$2 local netmask=$3 local gateway=$4 local dns1=$5 local dns2=$6 local protocol=$PROTO_STATIC if test -z $ifname;then log_error "ifname is needed" return 1 fi # ๅฆๆๆฒกๆ้ ็ฝฎip๏ผ่ทๅๆฅๅฃๅฝๅ็้ ็ฝฎ if test -z "$ipaddr";then config_file=${g_suse_network_cfg_dir}/ifcfg-$ifname if test -z "$config_file";then log_warn "ifname:$ifname config file is not exist" protocol=$PROTO_DHCP else protocol=`get_value_from_config "$config_file" "BOOTPROTO"` if test -z "$protocol";then protocol=$PROTO_STATIC fi ipaddr=`get_value_from_config "$config_file" "IPADDR"` netmask=`get_value_from_config "$config_file" "NETMASK"` fi log_info "[config]origin proto:$protocol,ip:$ipaddr,netmask:$netmask,gateway:$gateway" fi # ้ ็ฝฎไธญๅฏ่ฝ่ทๅไธๅฐip๏ผ้่ฟๅฝไปค่ทๅ if [ x"$PROTO_STATIC" == x"$protocol" ];then if test -z "$ipaddr" || test -z "$netmask";then log_warn "$ifname get config from cmd" ipaddr=`get_if_ip $ifname` netmask=`get_if_mask $ifname` if test -z "$ipaddr" || test -z "$netmask";then log_warn "$ifname get ip info failed,use default proto (dhcp)" protocol=$PROTO_DHCP else protocol=$PROTO_STATIC fi gateway=`get_if_gateway $ifname` log_info "[cmd]origin proto:$protocol,ip:$ipaddr,netmask:$netmask,gateway:$gateway" fi fi suse_gen_network_cfg_file "$ifname" "$protocol" "$ipaddr" "$netmask" "$gateway" "$dns1" "$dns2" ip a flush dev "$ifname" >/dev/null 2>&1 return 0 } # suse series system generate dns config # param $1: primary dns,eg:192.168.100.1 # param $2: secondary dns,eg:8.8.8.8 # return 0(success),1(fail) suse_gen_dns_cfg_file() { #่พๅ ฅๅๆฐ local dns1=$1 local dns2=$2 if test -z "$dns1";then log_error "primary dns($dns1) is needed" return 1 fi #ๅคๆญๆฏๅฆๅๆณdns is_valid_inet_address $dns1 dns1_ret=$? if [ -n "$dns2" ];then is_valid_inet_address $dns2 dns2_ret=$? else dns2_ret=0 fi if [ $dns1_ret -eq 0 ] && [ $dns2_ret -eq 0 ];then #ไฟฎๆน้ ็ฝฎๆไปถไธญ็dns suse_config_dns $dns1 if [ -n "$dns2" ];then suse_config_dns $dns2 fi else log_error "dns is invalid! dns1:$dns1, dns2:$dns2" return 1 fi return 0 } # suse series system generate dns config without restart network # param $1: interfaces,ไผ ็ฉบๅญ็ฌฆไธฒ๏ผ็จไบๅ ไฝ # param $2: primary dns,eg:192.168.100.1 # param $3: secondary dns,eg:8.8.8.8 # return 0(success),1(fail) suse_dns_cfg_handle() { local ifaces=$1 local dns1=$2 local dns2=$3 log_info "suse_dns_cfg_handle params: major dns:$dns1, minor dns:$dns2" if test -z "$dns1";then log_error "primary dns($dns1) is needed" return 1 fi #ไฟๅญๅฐ้ ็ฝฎๆไปถไธญ suse_gen_dns_cfg_file "$dns1" "$dns2" #็ญ็ๆ netconfig update -f return 0 }
Upload File
Create Folder