mirror of
https://github.com/teddysun/across.git
synced 2025-01-31 12:19:35 +08:00
Update comments
Signed-off-by: Teddysun <i@teddysun.com>
This commit is contained in:
parent
cc2c69a074
commit
84a7b0ad27
6
bench.sh
6
bench.sh
@ -81,7 +81,7 @@ io_test() {
|
|||||||
calc_disk() {
|
calc_disk() {
|
||||||
local total_size=0
|
local total_size=0
|
||||||
local array=$@
|
local array=$@
|
||||||
for size in ${array[@]}
|
for size in "${array[@]}"
|
||||||
do
|
do
|
||||||
[ "${size}" == "0" ] && size_t=0 || size_t=`echo ${size:0:${#size}-1}`
|
[ "${size}" == "0" ] && size_t=0 || size_t=`echo ${size:0:${#size}-1}`
|
||||||
[ "`echo ${size:(-1)}`" == "K" ] && size=0
|
[ "`echo ${size:(-1)}`" == "K" ] && size=0
|
||||||
@ -109,8 +109,8 @@ kern=$( uname -r )
|
|||||||
ipv6=$( wget -qO- -t1 -T2 ipv6.icanhazip.com )
|
ipv6=$( wget -qO- -t1 -T2 ipv6.icanhazip.com )
|
||||||
disk_size1=($( LANG=C df -hPl | grep -wvE '\-|none|tmpfs|devtmpfs|by-uuid|chroot|Filesystem' | awk '{print $2}' ))
|
disk_size1=($( LANG=C df -hPl | grep -wvE '\-|none|tmpfs|devtmpfs|by-uuid|chroot|Filesystem' | awk '{print $2}' ))
|
||||||
disk_size2=($( LANG=C df -hPl | grep -wvE '\-|none|tmpfs|devtmpfs|by-uuid|chroot|Filesystem' | awk '{print $3}' ))
|
disk_size2=($( LANG=C df -hPl | grep -wvE '\-|none|tmpfs|devtmpfs|by-uuid|chroot|Filesystem' | awk '{print $3}' ))
|
||||||
disk_total_size=$( calc_disk ${disk_size1[@]} )
|
disk_total_size=$( calc_disk "${disk_size1[@]}" )
|
||||||
disk_used_size=$( calc_disk ${disk_size2[@]} )
|
disk_used_size=$( calc_disk "${disk_size2[@]}" )
|
||||||
|
|
||||||
clear
|
clear
|
||||||
next
|
next
|
||||||
|
41
kms.sh
41
kms.sh
@ -19,17 +19,17 @@ cur_dir=$(pwd)
|
|||||||
|
|
||||||
if [ -f /etc/redhat-release ]; then
|
if [ -f /etc/redhat-release ]; then
|
||||||
release="centos"
|
release="centos"
|
||||||
elif cat /etc/issue | grep -Eqi "debian"; then
|
elif grep -Eqi "debian" /etc/issue; then
|
||||||
release="debian"
|
release="debian"
|
||||||
elif cat /etc/issue | grep -Eqi "ubuntu"; then
|
elif grep -Eqi "ubuntu" /etc/issue; then
|
||||||
release="ubuntu"
|
release="ubuntu"
|
||||||
elif cat /etc/issue | grep -Eqi "centos|red hat|redhat"; then
|
elif grep -Eqi "centos|red hat|redhat" /etc/issue; then
|
||||||
release="centos"
|
release="centos"
|
||||||
elif cat /proc/version | grep -Eqi "debian"; then
|
elif grep -Eqi "debian" /proc/version; then
|
||||||
release="debian"
|
release="debian"
|
||||||
elif cat /proc/version | grep -Eqi "ubuntu"; then
|
elif grep -Eqi "ubuntu" /proc/version; then
|
||||||
release="ubuntu"
|
release="ubuntu"
|
||||||
elif cat /proc/version | grep -Eqi "centos|red hat|redhat"; then
|
elif grep -Eqi "centos|red hat|redhat" /proc/version; then
|
||||||
release="centos"
|
release="centos"
|
||||||
else
|
else
|
||||||
release=""
|
release=""
|
||||||
@ -37,19 +37,19 @@ fi
|
|||||||
|
|
||||||
boot_start(){
|
boot_start(){
|
||||||
if [[ x"${release}" == x"debian" || x"${release}" == x"ubuntu" ]]; then
|
if [[ x"${release}" == x"debian" || x"${release}" == x"ubuntu" ]]; then
|
||||||
update-rc.d -f ${1} defaults
|
update-rc.d -f "${1}" defaults
|
||||||
elif [[ x"${release}" == x"centos" ]]; then
|
elif [[ x"${release}" == x"centos" ]]; then
|
||||||
chkconfig --add ${1}
|
chkconfig --add "${1}"
|
||||||
chkconfig ${1} on
|
chkconfig "${1}" on
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
boot_stop(){
|
boot_stop(){
|
||||||
if [[ x"${release}" == x"debian" || x"${release}" == x"ubuntu" ]]; then
|
if [[ x"${release}" == x"debian" || x"${release}" == x"ubuntu" ]]; then
|
||||||
update-rc.d -f ${1} remove
|
update-rc.d -f "${1}" remove
|
||||||
elif [[ x"${release}" == x"centos" ]]; then
|
elif [[ x"${release}" == x"centos" ]]; then
|
||||||
chkconfig ${1} off
|
chkconfig "${1}" off
|
||||||
chkconfig --del ${1}
|
chkconfig --del "${1}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,13 +85,13 @@ get_opsy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get_char() {
|
get_char() {
|
||||||
SAVEDSTTY=`stty -g`
|
SAVEDSTTY=$(stty -g)
|
||||||
stty -echo
|
stty -echo
|
||||||
stty cbreak
|
stty cbreak
|
||||||
dd if=/dev/tty bs=1 count=1 2> /dev/null
|
dd if=/dev/tty bs=1 count=1 2> /dev/null
|
||||||
stty -raw
|
stty -raw
|
||||||
stty echo
|
stty echo
|
||||||
stty $SAVEDSTTY
|
stty "$SAVEDSTTY"
|
||||||
}
|
}
|
||||||
|
|
||||||
set_firewall() {
|
set_firewall() {
|
||||||
@ -157,7 +157,7 @@ install_main() {
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd ${cur_dir}
|
cd "${cur_dir}" || exit
|
||||||
git clone https://github.com/teddysun/vlmcsd.git > /dev/null 2>&1
|
git clone https://github.com/teddysun/vlmcsd.git > /dev/null 2>&1
|
||||||
[ -d vlmcsd ] && cd vlmcsd || echo -e "[${red}Error:${plain}] Failed to git clone vlmcsd."
|
[ -d vlmcsd ] && cd vlmcsd || echo -e "[${red}Error:${plain}] Failed to git clone vlmcsd."
|
||||||
make
|
make
|
||||||
@ -176,7 +176,7 @@ install_main() {
|
|||||||
if [[ x"${release}" == x"centos" ]]; then
|
if [[ x"${release}" == x"centos" ]]; then
|
||||||
set_firewall
|
set_firewall
|
||||||
fi
|
fi
|
||||||
cd ${cur_dir}
|
cd "${cur_dir}" || exit
|
||||||
rm -rf vlmcsd
|
rm -rf vlmcsd
|
||||||
echo
|
echo
|
||||||
echo "Install KMS Server success"
|
echo "Install KMS Server success"
|
||||||
@ -187,7 +187,7 @@ install_main() {
|
|||||||
|
|
||||||
|
|
||||||
install_kms() {
|
install_kms() {
|
||||||
install_main 2>&1 | tee ${cur_dir}/install_kms.log
|
install_main 2>&1 | tee "${cur_dir}"/install_kms.log
|
||||||
}
|
}
|
||||||
|
|
||||||
# Uninstall KMS Server
|
# Uninstall KMS Server
|
||||||
@ -195,7 +195,7 @@ uninstall_kms() {
|
|||||||
printf "Are you sure uninstall KMS Server? (y/n) "
|
printf "Are you sure uninstall KMS Server? (y/n) "
|
||||||
printf "\n"
|
printf "\n"
|
||||||
read -p "(Default: n):" answer
|
read -p "(Default: n):" answer
|
||||||
[ -z ${answer} ] && answer="n"
|
[ -z "${answer}" ] && answer="n"
|
||||||
if [ "${answer}" == "y" ] || [ "${answer}" == "Y" ]; then
|
if [ "${answer}" == "y" ] || [ "${answer}" == "Y" ]; then
|
||||||
/etc/init.d/kms status > /dev/null 2>&1
|
/etc/init.d/kms status > /dev/null 2>&1
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
@ -216,14 +216,13 @@ uninstall_kms() {
|
|||||||
|
|
||||||
# Initialization step
|
# Initialization step
|
||||||
action=$1
|
action=$1
|
||||||
[ -z $1 ] && action=install
|
[ -z "$1" ] && action=install
|
||||||
case "$action" in
|
case "$action" in
|
||||||
install|uninstall)
|
install|uninstall)
|
||||||
${action}_kms
|
${action}_kms
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Arguments error! [${action}]"
|
echo "Arguments error! [${action}]"
|
||||||
echo "Usage: `basename $0` [install|uninstall]"
|
echo "Usage: $(basename $0) [install|uninstall]"
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user