mirror of
https://github.com/juewuy/ShellCrash.git
synced 2024-11-16 03:32:34 +08:00
~修复目录空间大小检测失败的bug
This commit is contained in:
parent
3ddb69e44e
commit
46fd3ffb85
|
@ -11,7 +11,7 @@ echo "** by Juewuy **"
|
|||
echo "***********************************************"
|
||||
#内置工具
|
||||
dir_avail(){
|
||||
df -h $1 |awk '{ for(i=1;i<=NF;i++){ if(NR==1){ arr[i]=$i; }else{ arr[i]=arr[i]" "$i; } } } END{ for(i=1;i<=NF;i++){ print arr[i]; } }' |grep Ava |awk '{print $2}'
|
||||
df $2 $1 |awk '{ for(i=1;i<=NF;i++){ if(NR==1){ arr[i]=$i; }else{ arr[i]=arr[i]" "$i; } } } END{ for(i=1;i<=NF;i++){ print arr[i]; } }' |grep Ava |awk '{print $2}'
|
||||
}
|
||||
setconfig(){
|
||||
configpath=$clashdir/mark
|
||||
|
@ -168,7 +168,7 @@ fi
|
|||
if [ ! -w $dir ];then
|
||||
$echo "\033[31m没有$dir目录写入权限!请重新设置!\033[0m" && sleep 1 && setdir
|
||||
else
|
||||
$echo "目标目录\033[32m$dir\033[0m空间剩余:$(dir_avail $dir)"
|
||||
$echo "目标目录\033[32m$dir\033[0m空间剩余:$(dir_avail $dir -h)"
|
||||
read -p "确认安装?(1/0) > " res
|
||||
[ "$res" = "1" ] && clashdir=$dir/clash || setdir
|
||||
fi
|
||||
|
|
|
@ -5,7 +5,7 @@ version=1.7.4f
|
|||
|
||||
setdir(){
|
||||
dir_avail(){
|
||||
df -h $1 |awk '{ for(i=1;i<=NF;i++){ if(NR==1){ arr[i]=$i; }else{ arr[i]=arr[i]" "$i; } } } END{ for(i=1;i<=NF;i++){ print arr[i]; } }' |grep Ava |awk '{print $2}'
|
||||
df $2 $1 |awk '{ for(i=1;i<=NF;i++){ if(NR==1){ arr[i]=$i; }else{ arr[i]=arr[i]" "$i; } } } END{ for(i=1;i<=NF;i++){ print arr[i]; } }' |grep Ava |awk '{print $2}'
|
||||
}
|
||||
set_usb_dir(){
|
||||
echo -e "请选择安装目录"
|
||||
|
@ -116,7 +116,7 @@ fi
|
|||
if [ ! -w $dir ];then
|
||||
echo -e "\033[31m没有$dir目录写入权限!请重新设置!\033[0m" && sleep 1 && setdir
|
||||
else
|
||||
echo -e "目标目录\033[32m$dir\033[0m空间剩余:$(dir_avail $dir)"
|
||||
echo -e "目标目录\033[32m$dir\033[0m空间剩余:$(dir_avail $dir -h)"
|
||||
read -p "确认安装?(1/0) > " res
|
||||
[ "$res" = "1" ] && clashdir=$dir/clash || setdir
|
||||
fi
|
||||
|
@ -151,7 +151,7 @@ mv -f /tmp/SC_tmp/* $clashdir 2>/dev/null
|
|||
#初始化
|
||||
[ -f "$clashdir/mark" ] || echo '#ShellClash配置文件,不明勿动!' > $clashdir/mark
|
||||
#本地安装跳过新手引导
|
||||
[ -z "$url" ] && setconfig userguide 1
|
||||
#[ -z "$url" ] && setconfig userguide 1
|
||||
#判断系统类型写入不同的启动文件
|
||||
if [ -f /etc/rc.common ];then
|
||||
#设为init.d方式启动
|
||||
|
|
Loading…
Reference in New Issue
Block a user