1 Star 0 Fork 0

谭威/installScript

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
fix5to6upgrade 2.45 KB
一键复制 编辑 原始数据 按行查看 历史
Aaron Murray 提交于 2022-10-18 18:05 . fix debian security repo
#!/bin/bash
#
# shellcheck disable=SC1090,SC1091,SC1117,SC2016,SC2046,SC2086
#
# version: 0.0.3
#
if [[ $(id -u) -ne 0 ]]; then
echo "This script must be executed as root or using sudo."
exit 99
fi
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
export LANG=C.UTF-8
echo "Removing old sources ..."
rm -f /etc/apt/sources.list.d/omvextras.list /etc/apt/sources.list.d/omv-extras-org.list
xmlstarlet ed --inplace -u /config/system/omvextras/extras -v 0 /etc/openmediavault/config.xml
xmlstarlet ed --inplace -u /config/system/omvextras/testing -v 0 /etc/openmediavault/config.xml
echo "Clearing cache ..."
/usr/bin/salt-call --local saltutil.clear_cache
omv-salt stage run prepare
echo "Rebuilding sources.list* ..."
omv-salt deploy run apt omvextras
echo "Change to bullseye and shaitan just in case ..."
sed -i "s/buster/bullseye/g" /etc/apt/sources.list
sed -i "s/buster/bullseye/g" /etc/apt/sources.list.d/*
sed -i "s/usul/shaitan/g" /etc/apt/sources.list.d/*
if [ -f /etc/apt/apt.conf ]; then
echo "Changing apt.conf ..."
sed -i "s/buster/bullseye/g" /etc/apt/apt.conf
fi
armbian="/etc/apt/sources.list.d/armbian.list"
if [ -f "${armbian}" ]; then
echo "Fixing Armbian repo ..."
echo "deb http://apt.armbian.com bullseye main bullseye-utils" | tee ${armbian}
fi
security="/etc/apt/sources.list.d/openmediavault-os-security.list"
if [ -f "${security}" ]; then
echo "Fixing Debian security repo ..."
echo "deb http://security.debian.org/debian-security bullseye-security main contrib non-free" | tee ${security}
fi
echo "Running apt-get update ..."
apt-get update
echo "Running apt-get dist-upgrade ..."
apt-get --yes \
--option DPkg::Options::="--force-confdef" \
--option DPkg::Options::="--force-confold" \
dist-upgrade
echo "Enable cron-apt ..."
rm -f /etc/cron-apt/refrain
echo "Enable apt index ..."
cp /usr/sbin/omv-mkaptidx /root/
rm -f /usr/sbin/omv-mkaptidx
if [ ! -f "/usr/sbin/omv-mkaptidx" ]; then
echo "omv-mkaptidx does not exist. Downloading..."
wget -O /usr/sbin/omv-mkaptidx https://github.com/openmediavault/openmediavault/raw/master/deb/openmediavault/usr/sbin/omv-mkaptidx
chmod +x /usr/sbin/omv-mkaptidx
fi
echo "Rebuild apt index ..."
omv-mkaptidx
echo "Rebuild OMV pam config ..."
dpkg-divert --remove --rename /etc/pam.d/openmediavault
dpkg-divert --remove --rename /etc/pam.d/openmediavault-common-auth
dpkg-divert --remove --rename /etc/pam.d/openmediavault-webgui
echo "Done."
exit 0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/carliels/installScript.git
git@gitee.com:carliels/installScript.git
carliels
installScript
installScript
master

搜索帮助