Update installation scripts and add new features

exa -> eza
This commit is contained in:
Konano 2023-11-27 14:27:03 +08:00
parent 9b7883e6bd
commit 43433adae8
3 changed files with 49 additions and 12 deletions

Binary file not shown.

Binary file not shown.

View File

@ -34,21 +34,38 @@ configure_upgrade() {
fi fi
} }
configure_install_basic() {
[ "$1" != "noupdate" ] && sudo apt update
sudo apt install tmux git curl htop net-tools tar unzip -y
}
configure_install_useful() {
[ "$1" != "noupdate" ] && sudo apt update
sudo apt install hexyl bat neofetch fd-find fzf tcptraceroute -y
pip3 install trash-cli
}
configure_install_new() {
[ "$1" != "noupdate" ] && sudo apt update
sudo apt install pigz -y
pip3 install speedtest-cli
}
configure_install_eza() {
if ! command_exists eza; then
unzip $scriptdir/files/eza_x86_64-unknown-linux-musl.zip -d $tempdir/eza
sudo cp $tempdir/eza/eza /usr/local/bin/
rm $tempdir/eza -r
fi
}
configure_install() { configure_install() {
if confirm_action "要运行 apt/pip3 install 吗?" "N"; then if confirm_action "要运行 apt/pip3 install 吗?" "N"; then
sudo apt update sudo apt update
sudo apt install tmux git curl htop net-tools tcptraceroute tar unzip -y configure_install_basic noupdate
sudo apt install hexyl bat neofetch fd-find fzf pigz -y configure_install_useful noupdate
pip3 install trash-cli speedtest-cli configure_install_new noupdate
configure_install_eza noupdate
sudo apt install exa -y
if [ $? -ne 0 ]; then
unzip $scriptdir/files/exa-linux-x86_64-v0.10.1.zip -d $tempdir/exa
sudo cp $tempdir/exa/bin/* /usr/local/bin/
sudo cp $tempdir/exa/man/* /usr/share/man/man1/
sudo cp $tempdir/exa/completions/exa.zsh /usr/local/share/zsh/site-functions
rm $tempdir/exa -r
fi
fi fi
} }
@ -194,6 +211,26 @@ configure_oomkiller() {
fi fi
} }
configure_swap() {
# Create a virtual memory file
sudo dd if=/dev/zero of=/mnt/swap bs=1M count=4096
sudo chmod 0600 /mnt/swap
sudo mkswap /mnt/swap
sudo swapon /mnt/swap
# Write auto mount parameters
if ! grep -q swap /etc/fstab; then
echo "/mnt/swap swap swap defaults 0 0" >> /etc/fstab
fi
# Set virtual memory usage
if ! grep -q swappiness /etc/sysctl.conf; then
echo "vm.swappiness = 10" >> /etc/sysctl.conf
else
sed -i 's/vm.swappiness = 0/vm.swappiness = 10/' /etc/sysctl.conf
fi
# Make the configuration take effect
sysctl -p
}
# ============================================================ # ============================================================
if [ $# -ne 0 ]; then if [ $# -ne 0 ]; then