2 Star 0 Fork 0

anotherday/omv-packages

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
omv-apt-init 3.28 KB
一键复制 编辑 原始数据 按行查看 历史
anotherday 提交于 2024-06-03 02:08 . u 1
#!/bin/bash
# init omv repos
. /etc/default/openmediavault
. /usr/share/openmediavault/scripts/helper-functions
. /usr/share/openmediavault/sysinfo/functions
declare -i i=0
export LANG=C
((i++))
echo -e "${i}. Init apt repos ..."
omv-env set OMV_APT_REPOSITORY_URL "https://mirrors.tuna.tsinghua.edu.cn/OpenMediaVault/public"
omv-env set OMV_APT_ALT_REPOSITORY_URL "https://mirrors.tuna.tsinghua.edu.cn/OpenMediaVault/packages"
omv-env set OMV_APT_KERNEL_BACKPORTS_REPOSITORY_URL "https://mirrors.tuna.tsinghua.edu.cn/debian"
omv-env set OMV_APT_SECURITY_REPOSITORY_URL "https://mirrors.tuna.tsinghua.edu.cn/debian-security"
omv-env set OMV_EXTRAS_APT_REPOSITORY_URL "https://mirrors.tuna.tsinghua.edu.cn/OpenMediaVault/openmediavault-plugin-developers"
omv-env set OMV_EXTRAS_KEY_URL "https://mirrors.tuna.tsinghua.edu.cn/OpenMediaVault/openmediavault-plugin-developers/omvextras2026.asc"
omv-env set OMV_DOCKER_APT_REPOSITORY_URL "https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian"
omv-env set OMV_DOCKER_KEY_URL "https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian/gpg"
omv-salt stage run --quiet prepare
omv-salt deploy run --quiet apt
((i++))
echo -e "\n${i}. Cleaning apt cache files..."
/usr/bin/apt-get clean
((i++))
echo -e "\n${i}. Clearing available dpkg packages..."
/usr/bin/dpkg --clear-avail
((i++))
echo -e "\n${i}. Removing apt lists..."
rm -rfv /var/lib/apt/lists/*
((i++))
echo -e "\n${i}. Removing OpenMediaVault cache packages..."
rm -fv /var/cache/openmediavault/archives/*
((i++))
echo -e "\n${i}. Creating new OpenMediaVault packages file..."
touch /var/cache/openmediavault/archives/Packages
# add repos
arch="$(dpkg --print-architecture)"
dist="$(lsb_release --codename --short)"
omv_codename=$(omv_product_info "versionname")
echo "APT::Get::Update::SourceListWarnings::NonFreeFirmware \"false\";" > /etc/apt/apt.conf.d/no-"${dist,,}"-firmware.conf
repo_url="https://mirrors.tuna.tsinghua.edu.cn/OpenMediaVault/openmediavault-plugin-developers"
key_url="https://mirrors.tuna.tsinghua.edu.cn/OpenMediaVault/openmediavault-plugin-developers/omvextras2026.asc"
docker_url="https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian"
docker_key_url="https://mirrors.tuna.tsinghua.edu.cn/docker-ce/linux/debian/gpg"
key="/usr/share/keyrings/omvextras.gpg"
docker_key="/usr/share/keyrings/docker.gpg"
list="/etc/apt/sources.list.d/omvextras.list"
docker_list="/etc/apt/sources.list.d/omvdocker.list"
((i++))
echo -e "\n${i}. Remove old omv-extras apt list files..."
grep -l 'openmediavault-plugin-developers' /etc/apt/sources.list.d/* | sudo xargs -r rm -fv
rm -fv /etc/apt/keyrings/docker.gpg
((i++))
echo -e "\n${i}. Adding omv-extras repo and key..."
mkdir -pv "$(dirname ${key})"
echo "deb [signed-by=${key} arch=${arch}] ${repo_url} ${omv_codename,,} main" > ${list}
wget --quiet --output-document=- "${key_url}" | gpg --dearmor > "${key}"
chmod 644 ${list} ${key}
# docker repo
grep -l 'docker' /etc/apt/sources.list.d/* | sudo xargs -r rm -fv
((i++))
echo -e "\n${i}. Adding docker repo and key..."
echo "deb [signed-by=${docker_key} arch=${arch}] ${docker_url} ${dist,,} stable" > ${docker_list}
wget --quiet --output-document=- "${docker_key_url}" | gpg --dearmor > "${docker_key}"
chmod 644 ${docker_list} ${docker_key}
((i++))
echo -e "\n${i}. Updating apt..."
/usr/bin/apt-get update
exit 0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Shell
1
https://gitee.com/anotherday/omv-packages.git
git@gitee.com:anotherday/omv-packages.git
anotherday
omv-packages
omv-packages
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385