pve/scripts/config.sh

38 lines
1 KiB
Bash
Raw Normal View History

2023-04-22 21:58:53 +08:00
#!/bin/bash
2023-08-22 12:15:30 +08:00
# from
2023-06-22 14:42:39 +08:00
# https://github.com/spiritLHLS/pve
2023-04-22 21:58:53 +08:00
divert_install_script() {
local package_name=$1
local divert_script="/usr/local/sbin/${package_name}-install"
local install_script="/var/lib/dpkg/info/${package_name}.postinst"
2023-06-14 09:50:07 +08:00
if [ -x "$(command -v yum)" ]; then
divert_script="/usr/local/sbin/${package_name}-install"
install_script="/var/lib/rpm/centos/${package_name}.postinst"
fi
2023-04-22 21:58:53 +08:00
ln -sf "${divert_script}" "${install_script}"
2023-08-22 12:15:30 +08:00
echo '#!/bin/bash' >"${divert_script}"
echo 'exit 1' >>"${divert_script}"
2023-04-22 21:58:53 +08:00
chmod +x "${divert_script}"
}
2023-06-14 09:50:07 +08:00
if [ -x "$(command -v apt-get)" ]; then
echo "Package: zmap nmap masscan medusa apache2-utils hping3
2023-04-22 21:58:53 +08:00
Pin: release *
Pin-Priority: -1" | sudo tee -a /etc/apt/preferences
2023-06-14 09:50:07 +08:00
fi
if [ -x "$(command -v apt-get)" ]; then
sudo apt-get update
elif [ -x "$(command -v yum)" ]; then
sudo yum update
fi
2023-04-22 21:58:53 +08:00
divert_install_script "zmap"
divert_install_script "nmap"
divert_install_script "masscan"
divert_install_script "medusa"
2023-06-14 09:50:07 +08:00
divert_install_script "hping3"
divert_install_script "apache2-utils"
2023-04-22 21:58:53 +08:00
rm -rf "$0"