更正升级软件包命令选项

This commit is contained in:
SuperManito
2024-01-19 02:01:46 +08:00
parent d959129839
commit d4e0cb395b
2 changed files with 13 additions and 13 deletions

View File

@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
## Author: SuperManito ## Author: SuperManito
## Modified: 2024-01-18 ## Modified: 2024-01-19
## License: MIT ## License: MIT
## GitHub: https://github.com/SuperManito/LinuxMirrors ## GitHub: https://github.com/SuperManito/LinuxMirrors
## Website: https://linuxmirrors.cn ## Website: https://linuxmirrors.cn
@@ -1002,8 +1002,8 @@ function ChangeMirrors() {
fi fi
} }
## 更新软件包 ## 升级软件包
function UpdateSoftware() { function UpgradeSoftware() {
function CleanCache() { function CleanCache() {
## 跳过特殊系统 ## 跳过特殊系统
case "${SYSTEM_JUDGMENT}" in case "${SYSTEM_JUDGMENT}" in
@@ -1052,8 +1052,8 @@ function UpdateSoftware() {
;; ;;
esac esac
## 交互确认 ## 交互确认
if [[ -z "${UPDATA_SOFTWARE}" ]]; then if [[ -z "${UPGRADE_SOFTWARE}" ]]; then
UPDATA_SOFTWARE="false" UPGRADE_SOFTWARE="false"
local CHOICE local CHOICE
CHOICE=$(echo -e "\n${BOLD}└─ 是否跳过更新软件包? [Y/n] ${PLAIN}") CHOICE=$(echo -e "\n${BOLD}└─ 是否跳过更新软件包? [Y/n] ${PLAIN}")
read -rp "${CHOICE}" INPUT read -rp "${CHOICE}" INPUT
@@ -1061,14 +1061,14 @@ function UpdateSoftware() {
case "${INPUT}" in case "${INPUT}" in
[Yy] | [Yy][Ee][Ss]) ;; [Yy] | [Yy][Ee][Ss]) ;;
[Nn] | [Nn][Oo]) [Nn] | [Nn][Oo])
UPDATA_SOFTWARE="true" UPGRADE_SOFTWARE="true"
;; ;;
*) *)
echo -e "\n$WARN 输入错误,默认不更新!" echo -e "\n$WARN 输入错误,默认不更新!"
;; ;;
esac esac
fi fi
if [[ "${UPDATA_SOFTWARE}" == "false" ]]; then if [[ "${UPGRADE_SOFTWARE}" == "false" ]]; then
return return
fi fi
echo -e '' echo -e ''
@@ -4963,7 +4963,7 @@ function CommandOptions() {
--close-firewall 关闭防火墙 true 或 false --close-firewall 关闭防火墙 true 或 false
--backup 备份原有软件源 true 或 false --backup 备份原有软件源 true 或 false
--ignore-backup-tips 忽略覆盖备份提示 无 --ignore-backup-tips 忽略覆盖备份提示 无
--updata-software 更新软件包 true 或 false --upgrade-software 更新软件包 true 或 false
--clean-cache 清理下载缓存 true 或 false --clean-cache 清理下载缓存 true 或 false
--print-diff 打印源文件修改前后差异 无 --print-diff 打印源文件修改前后差异 无
@@ -5149,11 +5149,11 @@ function CommandOptions() {
IGNORE_BACKUP_TIPS="true" IGNORE_BACKUP_TIPS="true"
;; ;;
## 更新软件包 ## 更新软件包
--updata-software) --upgrade-software | --updata-software)
if [ "$2" ]; then if [ "$2" ]; then
case "$2" in case "$2" in
[Tt]rue | [Ff]alse) [Tt]rue | [Ff]alse)
UPDATA_SOFTWARE="${2,,}" UPGRADE_SOFTWARE="${2,,}"
shift shift
;; ;;
*) *)
@@ -5216,7 +5216,7 @@ function Combin_Function() {
BackupOriginalMirrors BackupOriginalMirrors
RemoveOriginMirrors RemoveOriginMirrors
ChangeMirrors ChangeMirrors
UpdateSoftware UpgradeSoftware
RunEnd RunEnd
} }

View File

@@ -17,7 +17,7 @@
| `--close-firewall` | 关闭防火墙 | `true``false` | | `--close-firewall` | 关闭防火墙 | `true``false` |
| `--backup` | 备份原有软件源 | `true``false` | | `--backup` | 备份原有软件源 | `true``false` |
| `--ignore-backup-tips` | 忽略覆盖备份提示(即不覆盖备份) | 无 | | `--ignore-backup-tips` | 忽略覆盖备份提示(即不覆盖备份) | 无 |
| `--updata-software` | 更新软件包 | `true``false` | | `--upgrade-software` | 更新软件包 | `true``false` |
| `--clean-cache` | 清理下载缓存 | `true``false` | | `--clean-cache` | 清理下载缓存 | `true``false` |
| `--print-diff` | 打印源文件修改前后差异 | `true``false` | | `--print-diff` | 打印源文件修改前后差异 | `true``false` |
| `--help` | 查看帮助菜单 | 无 | | `--help` | 查看帮助菜单 | 无 |
@@ -160,7 +160,7 @@ bash <(curl -sSL https://linuxmirrors.cn/main.sh) \
--install-epel true \ --install-epel true \
--close-firewall true \ --close-firewall true \
--backup true \ --backup true \
--updata-software false \ --upgrade-software false \
--clean-cache false \ --clean-cache false \
--ignore-backup-tips --ignore-backup-tips
``` ```