From e155562000562009010d194745f05b5d6c1cd30f Mon Sep 17 00:00:00 2001 From: Konano Date: Thu, 17 Oct 2024 10:05:16 +0800 Subject: [PATCH] apt -> apt-get --- configure_priv.sh | 60 +++++++++++++++++++++++++++-------------------- utils.sh | 2 +- 2 files changed, 36 insertions(+), 26 deletions(-) diff --git a/configure_priv.sh b/configure_priv.sh index 249e7b3..39be410 100755 --- a/configure_priv.sh +++ b/configure_priv.sh @@ -39,10 +39,10 @@ configure_upgrade() { fi else # 其他系统使用 apt - if confirm_action "要运行 apt upgrade 吗?" "N"; then - sudo apt update - sudo apt upgrade -y - sudo apt autoremove -y + if confirm_action "要运行 apt-get upgrade 吗?" "N"; then + sudo apt-get update + sudo apt-get upgrade -y + sudo apt-get autoremove -y fi fi } @@ -52,19 +52,19 @@ configure_install_basic() { [ "$1" != "noupdate" ] && brew update brew install tmux htop else - [ "$1" != "noupdate" ] && sudo apt update - sudo apt install tmux git curl htop net-tools tar unzip -y + [ "$1" != "noupdate" ] && sudo apt-get update + sudo apt-get install tmux git curl htop net-tools tar unzip -y fi - pip3 install trash-cli + pip3 install trash-cli --break-system-packages } configure_install_useful() { if [ "$(uname)" = "Darwin" ]; then [ "$1" != "noupdate" ] && brew update - brew install hexyl bat neofetch tree cloc + brew install hexyl bat tree else - [ "$1" != "noupdate" ] && sudo apt update - sudo apt install hexyl bat neofetch fd-find fzf tcptraceroute tree cloc -y + [ "$1" != "noupdate" ] && sudo apt-get update + sudo apt-get install hexyl bat tree fd-find fzf tcptraceroute -y fi } @@ -73,10 +73,20 @@ configure_install_new() { [ "$1" != "noupdate" ] && brew update brew install pigz else - [ "$1" != "noupdate" ] && sudo apt update - sudo apt install pigz -y + [ "$1" != "noupdate" ] && sudo apt-get update + sudo apt-get install pigz -y + fi + pip3 install speedtest-cli --break-system-packages +} + +configure_install_old() { + if [ "$(uname)" = "Darwin" ]; then + [ "$1" != "noupdate" ] && brew update + brew install neofetch cloc + else + [ "$1" != "noupdate" ] && sudo apt-get update + sudo apt-get install neofetch cloc -y fi - pip3 install speedtest-cli } configure_install_eza() { @@ -86,7 +96,7 @@ configure_install_eza() { echo "eza is not supported on $(uname -m)." elif ! command_exists eza; then if [[ "$(lsb_release -is)" == "Ubuntu" && ("$(lsb_release -rs)" == "24.04" || "$(lsb_release -rs)" > "24.04") ]]; then - sudo apt install eza -y + sudo apt-get install eza -y else unzip $scriptdir/files/eza_$(uname -m)-unknown-linux-musl.zip -d $tempdir/eza sudo cp $tempdir/eza/eza /usr/local/bin/ @@ -105,7 +115,7 @@ configure_install() { fi else if confirm_action "要运行 apt/pip3 install 吗?" "N"; then - sudo apt update + sudo apt-get update else return fi @@ -196,7 +206,7 @@ configure_tmux() { [ $offline -eq 1 ] && return if confirm_action "要配置 tmux 吗?" "Y"; then - sudo apt install tmux -y + sudo apt-get install tmux -y rm ~/.tmux -r git_clone tmux-plugins/tpm ~/.tmux/plugins/tpm --norecursive @@ -207,7 +217,7 @@ configure_tmux() { cp $scriptdir/files/.tmux.conf ~/.tmux.conf [ "$(uname)" = "Darwin" ] && return - sudo apt install xsel -y # 能够让 tmux 剪切板与 terminal 同步 + sudo apt-get install xsel -y # 能够让 tmux 剪切板与 terminal 同步 fi } @@ -217,9 +227,9 @@ configure_docker() { if confirm_action "要安装 docker 吗?" "N"; then # 卸载旧版本 - sudo apt remove docker docker-engine docker.io - sudo apt update - sudo apt install apt-transport-https ca-certificates curl gnupg lsb-release -y + sudo apt-get remove docker docker-engine docker.io + sudo apt-get update + sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release -y # 检查系统架构是否为 x86_64 if [[ $(uname -m) != "x86_64" ]]; then echo "Docker is only supported on amd64 architecture." @@ -292,8 +302,8 @@ configure_nginx() { echo "deb-src [signed-by=/usr/share/keyrings/nginx.gpg] https://nginx.org/packages/ubuntu/ $(lsb_release -cs) nginx" | sudo tee -a /etc/apt/sources.list.d/nginx.list >/dev/null fi if confirm_action "要安装 nginx 吗?" "Y"; then - sudo apt update - sudo apt install nginx=1.20.2-1~$(lsb_release -cs) -y + sudo apt-get update + sudo apt-get install nginx=1.20.2-1~$(lsb_release -cs) -y echo "别忘了把 /etc/nginx/sites-enabled 中的配置文件移动到 /etc/nginx/conf.d 中" fi } @@ -304,7 +314,7 @@ configure_fail2ban() { [ "$(uname)" = "Darwin" ] && return if confirm_action "要配置 fail2ban 吗?" "N"; then - sudo apt install fail2ban -y + sudo apt-get install fail2ban -y sudo mkdir -p /etc/fail2ban sudo cp $scriptdir/files/jail.local /etc/fail2ban/jail.local sudo systemctl start fail2ban @@ -362,7 +372,7 @@ configure_oomkiller() { [ "$(uname)" = "Darwin" ] && return if confirm_action "要启用 earlyoom 吗?" "Y"; then - sudo apt install earlyoom -y + sudo apt-get install earlyoom -y sudo cp $scriptdir/files/earlyoom.conf /etc/default/earlyoom sudo systemctl restart earlyoom fi @@ -374,7 +384,7 @@ configure_proxychains() { [ "$(uname)" = "Darwin" ] && return if confirm_action "要配置 proxychains 吗?" "N"; then - sudo apt install proxychains4 -y + sudo apt-get install proxychains4 -y sudo cp $scriptdir/files/proxychains4.conf /etc/proxychains4.conf fi } diff --git a/utils.sh b/utils.sh index 6b71729..31adeae 100755 --- a/utils.sh +++ b/utils.sh @@ -65,7 +65,7 @@ pkg_install() { if [ "$(uname)" = "Darwin" ]; then brew install "$@" else - sudo apt install "$@" -y + sudo apt-get install "$@" -y fi }