kali Linux 操作系统更新命令脚本
执行方法
sudo apt install dos2unix
dos2unix update_script.sh
sudo ./update_script.sh
kali Linux 操作系统更新命令脚本
#!/bin/bash
clear
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE="\033[0;34m"
PURPLE="\033[0;35m"
NC='\033[0m'
echo -e "${PURPLE}Kali Linux 自动更新脚本 By:......${NC}"
echo -e "${BLUE}欢迎使用Kali Linux自动更新脚本,如需开始请按下回车键!如需退出请按下 CTRL+C.${NC}"
read input
echo -e "${PURPLE}Kali Linux 软件源地址文件${NC}"
echo -e "${YELLOW}cat /etc/apt/sources.list${NC}"
sudo cat /etc/apt/sources.list
echo -e "\n"
echo -e "${GREEN}Kali Linux 官方源如下(未注释内容为预编译的二进制软件包;注释内容为构建软件包的源码,可忽略):${NC}"
echo -e "${GREEN}deb http://http.kali.org/kali kali-rolling main non-free contrib${NC}"
echo -e "${GREEN}# deb-src http://http.kali.org/kali kali-rolling main non-free contrib${NC}"
echo -e "${BLUE}如果确认无误请按下回车键即将进行更新!如需修改请按下 CTRL+C 自行修改。${NC}"
read input
echo -e "${PURPLE}正在获取更新,请稍后...${NC}"
echo -e "\n"
echo -e "${YELLOW}①、即将更新软件包列表,它会从配置的软件源中获取最新的软件包信息。${NC}"
read -p "确认执行 'sudo apt-get update -y' 命令吗? [Y/N]: " choice
if [[ $choice == "Y" || $choice == "y" ]]; then
sudo apt-get update -y
else
echo -e "${RED}已取消执行 'sudo apt-get update -y' 命令。${NC}"
fi
echo -e "\n"
echo -e "${YELLOW}②、即将升级已安装的软件包,如果软件包有相依性的问题,此软件包就不会被升级。(稳定性更新)${NC}"
read -p "确认执行 'sudo apt-get upgrade -y' 命令吗? [Y/N]: " choice
if [[ $choice == "Y" || $choice == "y" ]]; then
sudo apt-get upgrade -y
else
echo -e "${RED}已取消执行 'sudo apt-get upgrade -y' 命令。${NC}"
fi
echo -e "\n"
echo -e "${YELLOW}③、即将升级已安装的软件包,检测并进行系统、内核等升级。如果软件包有相依性的问题,会移除旧版,直接安装新版本。(有风险的更新,且耗时较长)${NC}"
read -p "确认执行 'sudo apt-get dist-upgrade -y或sudo apt-get full-upgrade -y' 命令吗? [Y/N]: " choice
if [[ $choice == "Y" || $choice == "y" ]]; then
sudo apt-get dist-upgrade -y
else
echo -e "${RED}已取消执行 'sudo apt-get dist-upgrade -y' 命令。${NC}"
fi
echo -e "\n"
echo -e "${PURPLE}已成功获取更新~!${NC}\n"
echo -e "\n"
echo -e "${YELLOW}清理淀余缓存中,请稍后...${NC}"
read -p "确认执行 'sudo apt-get autoclean -y' 命令吗? [Y/N]: " choice
if [[ $choice == "Y" || $choice == "y" ]]; then
sudo apt-get autoclean -y
else
echo -e "${RED}已取消执行 'sudo apt-get autoclean -y' 命令。${NC}"
fi
echo -e "\n"
read -p "确认执行 'sudo apt-get clean -y' 命令吗? [Y/N]: " choice
if [[ $choice == "Y" || $choice == "y" ]]; then
sudo apt-get clean -y
else
echo -e "${RED}已取消执行 'sudo apt-get clean -y' 命令。${NC}"
fi
echo -e "\n"
read -p "确认执行 'sudo apt-get autoremove -y' 命令吗? [Y/N]: " choice
if [[ $choice == "Y" || $choice == "y" ]]; then
sudo apt-get autoremove -y
else
echo -e "${RED}已取消执行 'sudo apt-get autoremove -y' 命令。${NC}"
fi
echo -e "\n"
echo -e "${PURPLE}您的Kali Linux操作系统已成功更新,欢迎您的再次使用~!${NC}"
echo -e "${PURPLE}By:......${NC}"
标签:sudo,操作系统,get,kali,NC,apt,echo,Linux,choice
From: https://www.cnblogs.com/carmi/p/18226930