2024-11-18 23:12:52 +08:00
|
|
|
declare update_path="$1"
|
2024-07-25 21:59:46 +08:00
|
|
|
|
2024-11-18 23:12:52 +08:00
|
|
|
echo '#!/bin/bash' > "${update_path}/update.sh"
|
2024-07-27 15:12:30 +08:00
|
|
|
|
|
|
|
if [[ -f "/usr/bin/apt" ]];then
|
2024-11-18 23:12:52 +08:00
|
|
|
echo 'sudo apt update -y' >> "${update_path}/update.sh"
|
|
|
|
echo 'sudo apt-get dist-upgrade -y' >> "${update_path}/update.sh"
|
2024-07-27 15:12:30 +08:00
|
|
|
elif [[ -f "/usr/bin/apt-get" ]];then
|
2024-11-18 23:12:52 +08:00
|
|
|
echo 'sudo apt-get update -y' >> "${update_path}/update.sh"
|
|
|
|
echo 'sudo apt dist-upgrade -y' >> "${update_path}/update.sh"
|
2024-09-22 23:13:33 +08:00
|
|
|
elif [[ -f "/usr/bin/pacman" ]];then
|
|
|
|
sudo pacman -Syu --noconfirm
|
2024-07-27 15:12:30 +08:00
|
|
|
else
|
2024-11-18 23:12:52 +08:00
|
|
|
rm "${update_path}/update.sh"
|
|
|
|
echo "暂不支持该系统的自动更新配置"
|
2024-07-27 15:12:30 +08:00
|
|
|
exit
|
|
|
|
fi
|