#!/bin/bash

# only for VMs

_install() {
    if [[ $VMFLAG = 0 ]];then
        return 0
    fi
    if [[ $VMFLAG = 1 && `echo $HOSTIP|grep -c '^100.'` -eq 0 ]]; then
        #虚拟机ipv6
        sed "s/net\.ipv6\.conf\.all\.disable_ipv6.*/net\.ipv6\.conf\.all\.disable_ipv6 = 0/" -i /etc/sysctl.conf
        sed "s/net\.ipv6\.conf\.default\.disable_ipv6.*/net\.ipv6\.conf\.default\.disable_ipv6 = 0/" -i /etc/sysctl.conf
        sysctl -p >/dev/null
        ifdown sit6to4
        ifup sit6to4
    fi
    return 0
}

_check() {
    _check="PASS"

    if [[ $VMFLAG = 0 ]];then
        return 0
    fi

    if [[ $(grep -c /dev/vdb /proc/mounts) -ne 1 ]];then
        _check="FAIL"
        PRINT_ERR "[ERROR] Datadisk not mount."
    fi
}
