Compare commits

..

6 Commits

2 changed files with 16 additions and 8 deletions

View File

@ -15,6 +15,7 @@ fi
# ============================================================ # ============================================================
configure_tuna() { configure_tuna() {
[ "$(uname)" = "Darwin" ] && return
[ $offline -eq 1 ] && return [ $offline -eq 1 ] && return
[ $abroad -eq 1 ] && return [ $abroad -eq 1 ] && return
@ -110,7 +111,7 @@ configure_install_eza() {
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/
rm $tempdir/eza -r rm -r $tempdir/eza
fi fi
fi fi
} }
@ -161,7 +162,9 @@ configure_zsh() {
if confirm_action "要配置 zsh 吗?" "Y"; then if confirm_action "要配置 zsh 吗?" "Y"; then
pkg_install zsh pkg_install zsh
rm ~/.oh-my-zsh -r if [ -d ~/.oh-my-zsh ]; then
rm -r ~/.oh-my-zsh
fi
git_clone ohmyzsh/ohmyzsh ~/.oh-my-zsh git_clone ohmyzsh/ohmyzsh ~/.oh-my-zsh
RUNZSH=no ZSH=~/.oh-my-zsh $scriptdir/files/install-ohmyzsh.sh RUNZSH=no ZSH=~/.oh-my-zsh $scriptdir/files/install-ohmyzsh.sh
@ -215,9 +218,11 @@ configure_tmux() {
[ $offline -eq 1 ] && return [ $offline -eq 1 ] && return
if confirm_action "要配置 tmux 吗?" "Y"; then if confirm_action "要配置 tmux 吗?" "Y"; then
sudo apt-get install tmux -y pkg_install tmux || return $?
rm ~/.tmux -r if [ -d ~/.tmux ]; then
rm -r ~/.tmux
fi
git_clone tmux-plugins/tpm ~/.tmux/plugins/tpm --norecursive git_clone tmux-plugins/tpm ~/.tmux/plugins/tpm --norecursive
git_clone tmux-plugins/tmux-sensible ~/.tmux/plugins/tmux-sensible git_clone tmux-plugins/tmux-sensible ~/.tmux/plugins/tmux-sensible
git_clone tmux-plugins/tmux-yank ~/.tmux/plugins/tmux-yank git_clone tmux-plugins/tmux-yank ~/.tmux/plugins/tmux-yank
@ -309,6 +314,7 @@ configure_mongodb() {
} }
configure_nginx() { configure_nginx() {
[ "$(uname)" = "Darwin" ] && return
[ $offline -eq 1 ] && return [ $offline -eq 1 ] && return
if [ ! -f /etc/apt/sources.list.d/nginx.sources ]; then if [ ! -f /etc/apt/sources.list.d/nginx.sources ]; then
curl -fsSL https://nginx.org/keys/nginx_signing.key | gpg --dearmor | sudo tee /usr/share/keyrings/nginx.gpg >/dev/null curl -fsSL https://nginx.org/keys/nginx_signing.key | gpg --dearmor | sudo tee /usr/share/keyrings/nginx.gpg >/dev/null
@ -428,6 +434,7 @@ configure_zsh_prefix() {
} }
configure_hostname() { configure_hostname() {
[ "$(uname)" = "Darwin" ] && return
if confirm_action "要修改 hostname 吗?" "N"; then if confirm_action "要修改 hostname 吗?" "N"; then
read -p "hostname: " new_hostname read -p "hostname: " new_hostname
echo $new_hostname | sudo tee /etc/hostname >/dev/null echo $new_hostname | sudo tee /etc/hostname >/dev/null
@ -483,6 +490,7 @@ configure_proxychains() {
} }
configure_node_exporter() { configure_node_exporter() {
[ "$(uname)" = "Darwin" ] && return
[ -f /usr/local/bin/node_exporter ] && return [ -f /usr/local/bin/node_exporter ] && return
[ $offline -eq 1 ] && return [ $offline -eq 1 ] && return
@ -502,7 +510,7 @@ configure_node_exporter() {
sudo cp $node_exporter_dir/node_exporter /usr/local/bin/node_exporter sudo cp $node_exporter_dir/node_exporter /usr/local/bin/node_exporter
sudo chmod +x /usr/local/bin/node_exporter sudo chmod +x /usr/local/bin/node_exporter
rm $tempdir/node_exporter.tar.gz rm $tempdir/node_exporter.tar.gz
rm $node_exporter_dir -r rm -r $node_exporter_dir
# Generate a self-signed certificate # Generate a self-signed certificate
# openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -keyout node_exporter.key -out node_exporter.crt # openssl req -new -newkey rsa:2048 -days 3650 -nodes -x509 -keyout node_exporter.key -out node_exporter.crt
@ -592,6 +600,7 @@ configure_git_gpg() {
# ============================================================ # ============================================================
configure_swap() { configure_swap() {
[ "$(uname)" = "Darwin" ] && return
# Input the swap size # Input the swap size
read -p "Swap size (MB): " swap_size read -p "Swap size (MB): " swap_size
# Create a virtual memory file # Create a virtual memory file
@ -636,7 +645,6 @@ configure_tmux
# configure_nodejs # configure_nodejs
configure_docker configure_docker
configure_fail2ban configure_fail2ban
configure_iptables
configure_ufw configure_ufw
# configure_hostname # configure_hostname
configure_timedate configure_timedate

View File

@ -24,8 +24,8 @@ configure_ssh_keygen() {
if confirm_action "要生成 sshkey 吗?" "N"; then if confirm_action "要生成 sshkey 吗?" "N"; then
mkdir -p ~/.ssh mkdir -p ~/.ssh
read -p "sshkey 的名字: " sshkeyname read -r -p "sshkey 的名字: " sshkeyname
ssh-keygen -t ed25519 -C $sshkeyname ssh-keygen -t ed25519 -C "$sshkeyname"
fi fi
} }