apt -> apt-get
This commit is contained in:
parent
921c8f653b
commit
e155562000
@ -39,10 +39,10 @@ configure_upgrade() {
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# 其他系统使用 apt
|
# 其他系统使用 apt
|
||||||
if confirm_action "要运行 apt upgrade 吗?" "N"; then
|
if confirm_action "要运行 apt-get upgrade 吗?" "N"; then
|
||||||
sudo apt update
|
sudo apt-get update
|
||||||
sudo apt upgrade -y
|
sudo apt-get upgrade -y
|
||||||
sudo apt autoremove -y
|
sudo apt-get autoremove -y
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -52,19 +52,19 @@ configure_install_basic() {
|
|||||||
[ "$1" != "noupdate" ] && brew update
|
[ "$1" != "noupdate" ] && brew update
|
||||||
brew install tmux htop
|
brew install tmux htop
|
||||||
else
|
else
|
||||||
[ "$1" != "noupdate" ] && sudo apt update
|
[ "$1" != "noupdate" ] && sudo apt-get update
|
||||||
sudo apt install tmux git curl htop net-tools tar unzip -y
|
sudo apt-get install tmux git curl htop net-tools tar unzip -y
|
||||||
fi
|
fi
|
||||||
pip3 install trash-cli
|
pip3 install trash-cli --break-system-packages
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_install_useful() {
|
configure_install_useful() {
|
||||||
if [ "$(uname)" = "Darwin" ]; then
|
if [ "$(uname)" = "Darwin" ]; then
|
||||||
[ "$1" != "noupdate" ] && brew update
|
[ "$1" != "noupdate" ] && brew update
|
||||||
brew install hexyl bat neofetch tree cloc
|
brew install hexyl bat tree
|
||||||
else
|
else
|
||||||
[ "$1" != "noupdate" ] && sudo apt update
|
[ "$1" != "noupdate" ] && sudo apt-get update
|
||||||
sudo apt install hexyl bat neofetch fd-find fzf tcptraceroute tree cloc -y
|
sudo apt-get install hexyl bat tree fd-find fzf tcptraceroute -y
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,10 +73,20 @@ configure_install_new() {
|
|||||||
[ "$1" != "noupdate" ] && brew update
|
[ "$1" != "noupdate" ] && brew update
|
||||||
brew install pigz
|
brew install pigz
|
||||||
else
|
else
|
||||||
[ "$1" != "noupdate" ] && sudo apt update
|
[ "$1" != "noupdate" ] && sudo apt-get update
|
||||||
sudo apt install pigz -y
|
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
|
fi
|
||||||
pip3 install speedtest-cli
|
|
||||||
}
|
}
|
||||||
|
|
||||||
configure_install_eza() {
|
configure_install_eza() {
|
||||||
@ -86,7 +96,7 @@ configure_install_eza() {
|
|||||||
echo "eza is not supported on $(uname -m)."
|
echo "eza is not supported on $(uname -m)."
|
||||||
elif ! command_exists eza; then
|
elif ! command_exists eza; then
|
||||||
if [[ "$(lsb_release -is)" == "Ubuntu" && ("$(lsb_release -rs)" == "24.04" || "$(lsb_release -rs)" > "24.04") ]]; 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
|
else
|
||||||
unzip $scriptdir/files/eza_$(uname -m)-unknown-linux-musl.zip -d $tempdir/eza
|
unzip $scriptdir/files/eza_$(uname -m)-unknown-linux-musl.zip -d $tempdir/eza
|
||||||
sudo cp $tempdir/eza/eza /usr/local/bin/
|
sudo cp $tempdir/eza/eza /usr/local/bin/
|
||||||
@ -105,7 +115,7 @@ configure_install() {
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if confirm_action "要运行 apt/pip3 install 吗?" "N"; then
|
if confirm_action "要运行 apt/pip3 install 吗?" "N"; then
|
||||||
sudo apt update
|
sudo apt-get update
|
||||||
else
|
else
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
@ -196,7 +206,7 @@ configure_tmux() {
|
|||||||
[ $offline -eq 1 ] && return
|
[ $offline -eq 1 ] && return
|
||||||
|
|
||||||
if confirm_action "要配置 tmux 吗?" "Y"; then
|
if confirm_action "要配置 tmux 吗?" "Y"; then
|
||||||
sudo apt install tmux -y
|
sudo apt-get install tmux -y
|
||||||
|
|
||||||
rm ~/.tmux -r
|
rm ~/.tmux -r
|
||||||
git_clone tmux-plugins/tpm ~/.tmux/plugins/tpm --norecursive
|
git_clone tmux-plugins/tpm ~/.tmux/plugins/tpm --norecursive
|
||||||
@ -207,7 +217,7 @@ configure_tmux() {
|
|||||||
|
|
||||||
cp $scriptdir/files/.tmux.conf ~/.tmux.conf
|
cp $scriptdir/files/.tmux.conf ~/.tmux.conf
|
||||||
[ "$(uname)" = "Darwin" ] && return
|
[ "$(uname)" = "Darwin" ] && return
|
||||||
sudo apt install xsel -y # 能够让 tmux 剪切板与 terminal 同步
|
sudo apt-get install xsel -y # 能够让 tmux 剪切板与 terminal 同步
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,9 +227,9 @@ configure_docker() {
|
|||||||
|
|
||||||
if confirm_action "要安装 docker 吗?" "N"; then
|
if confirm_action "要安装 docker 吗?" "N"; then
|
||||||
# 卸载旧版本
|
# 卸载旧版本
|
||||||
sudo apt remove docker docker-engine docker.io
|
sudo apt-get remove docker docker-engine docker.io
|
||||||
sudo apt update
|
sudo apt-get update
|
||||||
sudo apt install apt-transport-https ca-certificates curl gnupg lsb-release -y
|
sudo apt-get install apt-transport-https ca-certificates curl gnupg lsb-release -y
|
||||||
# 检查系统架构是否为 x86_64
|
# 检查系统架构是否为 x86_64
|
||||||
if [[ $(uname -m) != "x86_64" ]]; then
|
if [[ $(uname -m) != "x86_64" ]]; then
|
||||||
echo "Docker is only supported on amd64 architecture."
|
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
|
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
|
fi
|
||||||
if confirm_action "要安装 nginx 吗?" "Y"; then
|
if confirm_action "要安装 nginx 吗?" "Y"; then
|
||||||
sudo apt update
|
sudo apt-get update
|
||||||
sudo apt install nginx=1.20.2-1~$(lsb_release -cs) -y
|
sudo apt-get install nginx=1.20.2-1~$(lsb_release -cs) -y
|
||||||
echo "别忘了把 /etc/nginx/sites-enabled 中的配置文件移动到 /etc/nginx/conf.d 中"
|
echo "别忘了把 /etc/nginx/sites-enabled 中的配置文件移动到 /etc/nginx/conf.d 中"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -304,7 +314,7 @@ configure_fail2ban() {
|
|||||||
[ "$(uname)" = "Darwin" ] && return
|
[ "$(uname)" = "Darwin" ] && return
|
||||||
|
|
||||||
if confirm_action "要配置 fail2ban 吗?" "N"; then
|
if confirm_action "要配置 fail2ban 吗?" "N"; then
|
||||||
sudo apt install fail2ban -y
|
sudo apt-get install fail2ban -y
|
||||||
sudo mkdir -p /etc/fail2ban
|
sudo mkdir -p /etc/fail2ban
|
||||||
sudo cp $scriptdir/files/jail.local /etc/fail2ban/jail.local
|
sudo cp $scriptdir/files/jail.local /etc/fail2ban/jail.local
|
||||||
sudo systemctl start fail2ban
|
sudo systemctl start fail2ban
|
||||||
@ -362,7 +372,7 @@ configure_oomkiller() {
|
|||||||
[ "$(uname)" = "Darwin" ] && return
|
[ "$(uname)" = "Darwin" ] && return
|
||||||
|
|
||||||
if confirm_action "要启用 earlyoom 吗?" "Y"; then
|
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 cp $scriptdir/files/earlyoom.conf /etc/default/earlyoom
|
||||||
sudo systemctl restart earlyoom
|
sudo systemctl restart earlyoom
|
||||||
fi
|
fi
|
||||||
@ -374,7 +384,7 @@ configure_proxychains() {
|
|||||||
[ "$(uname)" = "Darwin" ] && return
|
[ "$(uname)" = "Darwin" ] && return
|
||||||
|
|
||||||
if confirm_action "要配置 proxychains 吗?" "N"; then
|
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
|
sudo cp $scriptdir/files/proxychains4.conf /etc/proxychains4.conf
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user