更新了文件检测方式,新增更换系统语言
This commit is contained in:
parent
0288eed8fb
commit
2cec79d034
@ -19,7 +19,7 @@ if [[ -z ${web_path} ]];then
|
||||
fi
|
||||
read -p "是否备份到本地,默认 关闭 ,输入 y 开启:" local_pick
|
||||
read -p "是否备份到百度网盘,默认 开启 ,输入 n 关闭:" baidu_pick
|
||||
read -p "是否备份到阿里云盘 默认 开启 , 输入 n 关闭" aliyun_pick
|
||||
read -p "是否备份到阿里云盘 默认 开启 , 输入 n 关闭:" aliyun_pick
|
||||
|
||||
if [[ ! $local_pick =~ [Yy] && $baidu_pick =~ [Nn] && $aliyun_pick =~ [Nn] ]];then
|
||||
echo "没有可备份的选项"
|
||||
@ -39,7 +39,16 @@ if [[ $local_pick =~ Yy ]];then
|
||||
fi
|
||||
|
||||
if [[ ! $baidu_pick =~ [Nn] ]];then
|
||||
if ! command -v python3 -m venv &> /dev/null ; then
|
||||
if [[ -f "/usr/bin/apt-get" ]];then
|
||||
sudo apt-get install python3-venv -y
|
||||
elif [[ -f "/usr/bin/apt" ]];then
|
||||
sudo apt-get install python3-venv -y
|
||||
else
|
||||
echo "无法自动安装 python3-venv 请手动安装"
|
||||
exit
|
||||
fi
|
||||
fi
|
||||
python3 -m venv "${path}/venv"
|
||||
source "${path}/venv/bin/activate"
|
||||
pip install bypy
|
||||
@ -54,11 +63,9 @@ fi
|
||||
if [[ ! $aliyun_pick =~ [Nn] ]];then
|
||||
if [[ ! -d "${path}/aliyunpan" ]];then
|
||||
wget -P "${path}" https://github.com/tickstep/aliyunpan/releases/download/v0.3.2/aliyunpan-v0.3.2-linux-amd64.zip -O "${path}/aliyunpan.zip"
|
||||
unzip aliyunpan.zip
|
||||
unzip "${path}/aliyunpan.zip" -d "${path}"
|
||||
rm "${path}/aliyunpan.zip"
|
||||
declare tmp_file=$( ls "${path}" | grep "aliyunpan" )
|
||||
mv "${path}/${tmp_file}" "${path}/aliyunpan"
|
||||
mv "${path}/$(ls "${path}" | grep "aliyunpan")" "${path}/aliyunpan"
|
||||
${path}/aliyunpan/aliyunpan login
|
||||
else
|
||||
echo "检测到阿里云盘已经存在,请确认是否登录"
|
||||
|
@ -1,4 +1,3 @@
|
||||
declare version=$(cat /etc/os-release | grep '^ID' | awk -F '=' '{print $2}')
|
||||
declare path=$1
|
||||
declare cron=$2
|
||||
|
||||
@ -6,20 +5,19 @@ if [[ -f "${path}/update.sh" ]];then
|
||||
echo "该路径文件已经存在"
|
||||
fi
|
||||
|
||||
case "$version" in
|
||||
'debian')
|
||||
cat > "${path}/update.sh" << EOF
|
||||
#!/bin/bash
|
||||
sudo apt update
|
||||
sudo apt-get update
|
||||
sudo apt dist-upgrade
|
||||
sudo apt-get dist-upgrade
|
||||
EOF
|
||||
;;
|
||||
*)
|
||||
echo '#!/bin/bash' > "${path}/update.sh"
|
||||
|
||||
if [[ -f "/usr/bin/apt" ]];then
|
||||
echo 'sudo apt update' >> "${path}/update.sh"
|
||||
echo 'sudo apt-get dist-upgrade' >> "${path}/update.sh"
|
||||
elif [[ -f "/usr/bin/apt-get" ]];then
|
||||
echo 'sudo apt-get update' >> "${path}/update.sh"
|
||||
echo 'sudo apt dist-upgrade' >> "${path}/update.sh"
|
||||
else
|
||||
rm "${path}/update.sh"
|
||||
echo "暂不支持该系统配置自动更新软件"
|
||||
exit
|
||||
esac
|
||||
fi
|
||||
|
||||
chmod +x "${path}/update.sh"
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
declare pick
|
||||
echo "========Other========"
|
||||
echo "1.开启BBR"
|
||||
echo "2.更换系统语言"
|
||||
echo "输入其他任意返回主页"
|
||||
echo "========Other========"
|
||||
read -p "请输入:" pick
|
||||
@ -16,4 +17,40 @@ case "$pick" in
|
||||
grep -q "net.ipv4.tcp_congestion_control=bbr" "/etc/sysctl.conf" || echo 'net.ipv4.tcp_congestion_control=bbr' | sudo tee -a "/etc/sysctl.conf"
|
||||
sudo sysctl -p || echo "bbr 开启失败"
|
||||
sysctl net.ipv4.tcp_available_congestion_control | grep bbr && echo "bbr 开启成功"
|
||||
;;
|
||||
'2')
|
||||
declare lang
|
||||
echo "1.中文"
|
||||
echo "2.英文"
|
||||
read -p "请输入:" lang
|
||||
if [[ -f "/usr/bin/apt-get" ]];then
|
||||
sudo apt-get install -y locales
|
||||
sudo apt-get install -y language-pack-zh-hans
|
||||
elif [[ -f "/usr/bin/apt" ]];then
|
||||
sudo apt install -y locales
|
||||
sudo apt install -y language-pack-zh-hans
|
||||
else
|
||||
echo "暂不支持该系统一键更换语言"
|
||||
exit
|
||||
fi
|
||||
case $lang in
|
||||
'1')
|
||||
sudo sed -i 's/.*zh_CN.UTF-8.*/zh_CN.UTF-8 UTF-8/g' /etc/locale.gen
|
||||
sudo sed -i "s/^LANG.*/LANG=zh_CN.UTF-8/g" /etc/default/locale
|
||||
sudo sed -i "s/^LC_ALL.*/LC_ALL=zh_CN.UTF-8/g" /etc/default/locale
|
||||
source /etc/default/locale
|
||||
sudo locale-gen
|
||||
update-locale
|
||||
echo "中文语言更换成功"
|
||||
;;
|
||||
'2')
|
||||
sudo sed -i 's/.*en_US.UTF-8.*/en_US.UTF-8 UTF-8/g' /etc/locale.gen
|
||||
sudo sed -i "s/^LANG.*/LANG=en_US.UTF-8/g" /etc/default/locale
|
||||
sudo sed -i "s/^LC_ALL.*/LC_ALL=en_US.UTF-8/g" /etc/default/locale
|
||||
source /etc/default/locale
|
||||
sudo locale-gen
|
||||
update-locale
|
||||
echo "英文语言更换成功"
|
||||
;;
|
||||
esac
|
||||
esac
|
@ -1,16 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
declare install_str
|
||||
declare version=$(cat /etc/os-release | grep -w 'ID' | awk -F '=' '{print $2}')
|
||||
case "$version" in
|
||||
'debian')
|
||||
install_str='apt-get install'
|
||||
|
||||
;;
|
||||
*)
|
||||
declare pkg
|
||||
if [[ -f "/usr/bin/apt-get" ]];then
|
||||
pkg='apt-get'
|
||||
elif [[ -f "/usr/bin/apt" ]];then
|
||||
pkg='apt'
|
||||
else
|
||||
echo "暂不支持该系统一键安装常用软件"
|
||||
exit
|
||||
esac
|
||||
fi
|
||||
|
||||
|
||||
declare pick
|
||||
declare -a soft_array
|
||||
@ -62,7 +63,7 @@ if [[ ! $pick_docker =~ [Nn] ]];then
|
||||
read -p "请输入需要选择的镜像站:" docker_img_number_pick
|
||||
declare docker_img
|
||||
if [[ ! $docker_img_number_pick =~ [1-${#docker_imgs[@]}] ]];then
|
||||
docker_img='https://mirrors.ustc.edu.cn/docker-ce'
|
||||
docker_img='https://mirrors.sustc.edu.cn/docker-ce'
|
||||
else
|
||||
docker_img_number_pick=${docker_img_number[$docker_img_number_pick]}
|
||||
docker_img=${docker_imgs[$docker_img_number_pick]}
|
||||
@ -76,7 +77,7 @@ if [[ ! $pick_x =~ [Nn] ]];then
|
||||
fi
|
||||
|
||||
|
||||
eval "$install_str -y"
|
||||
eval "sudo ${pkg} install -y ${install_str}"
|
||||
if [[ ! $pick_x =~ [Nn] ]];then
|
||||
eval "$(curl https://get.x-cmd.com)"
|
||||
fi
|
||||
@ -93,9 +94,9 @@ fi
|
||||
|
||||
|
||||
if [[ ! $pick_docker =~ [Nn] ]];then
|
||||
if [[ $version == 'debian' ]];then
|
||||
sudo apt-get update
|
||||
sudo apt-get install ca-certificates curl -y
|
||||
if [[ ${pkg} == 'apt' || ${pkg} == 'apt-get' ]];then
|
||||
sudo ${pkg} update
|
||||
sudo ${pkg} install ca-certificates curl -y
|
||||
sudo install -m 0755 -d /etc/apt/keyrings
|
||||
sudo curl -fsSL "${docker_img}/linux/${version}/gpg" -o /etc/apt/keyrings/docker.asc
|
||||
sudo chmod a+r /etc/apt/keyrings/docker.asc
|
||||
@ -103,8 +104,8 @@ if [[ ! $pick_docker =~ [Nn] ]];then
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] ${docker_img}/linux/${version} \
|
||||
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
|
||||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
sudo apt-get update
|
||||
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
|
||||
sudo ${pkg} update
|
||||
sudo ${pkg} install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -48,6 +48,7 @@ deb ${url}/debian/ bookworm main contrib non-free non-free-firmware
|
||||
deb ${url}/debian/ bookworm-updates main contrib non-free non-free-firmware
|
||||
deb ${url}/debian/ bookworm-backports main contrib non-free non-free-firmware
|
||||
EOF
|
||||
sudo apt update
|
||||
sudo apt-get update
|
||||
;;
|
||||
*)
|
||||
|
Loading…
Reference in New Issue
Block a user