mirror of
https://github.com/bin456789/reinstall.git
synced 2025-06-08 05:19:57 +00:00
parent
06559947e3
commit
b664df17e8
13
trans.sh
13
trans.sh
@ -3870,16 +3870,21 @@ chroot_dnf() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
chroot_apt_install() {
|
chroot_apt_update() {
|
||||||
os_dir=$1
|
os_dir=$1
|
||||||
shift
|
|
||||||
|
|
||||||
current_hash=$(cat $os_dir/etc/apt/sources.list $os_dir/etc/apt/sources.list.d/*.sources 2>/dev/null | md5sum)
|
current_hash=$(cat $os_dir/etc/apt/sources.list $os_dir/etc/apt/sources.list.d/*.sources 2>/dev/null | md5sum)
|
||||||
if ! [ "$saved_hash" = "$current_hash" ]; then
|
if ! [ "$saved_hash" = "$current_hash" ]; then
|
||||||
chroot $os_dir apt-get update
|
chroot $os_dir apt-get update
|
||||||
saved_hash="$current_hash"
|
saved_hash="$current_hash"
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
chroot_apt_install() {
|
||||||
|
os_dir=$1
|
||||||
|
shift
|
||||||
|
|
||||||
|
chroot_apt_update $os_dir
|
||||||
DEBIAN_FRONTEND=noninteractive chroot $os_dir apt-get install -y "$@"
|
DEBIAN_FRONTEND=noninteractive chroot $os_dir apt-get install -y "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3887,6 +3892,10 @@ chroot_apt_remove() {
|
|||||||
os_dir=$1
|
os_dir=$1
|
||||||
shift
|
shift
|
||||||
|
|
||||||
|
# minimal 镜像 删除 grub-pc 时会安装 grub-efi-amd64
|
||||||
|
# 因此需要先更新索引
|
||||||
|
chroot_apt_update $os_dir
|
||||||
|
|
||||||
# 不能用 apt remove --purge -y xxx yyy
|
# 不能用 apt remove --purge -y xxx yyy
|
||||||
# 因为如果索引里没有其中一个,会报错,另一个也不会删除
|
# 因为如果索引里没有其中一个,会报错,另一个也不会删除
|
||||||
local pkgs=
|
local pkgs=
|
||||||
|
Loading…
x
Reference in New Issue
Block a user