Trap EXIT and use relative cache and db paths
Trapping exit ensures that unmounting occurs in the event of an exit 1 or a normal exit. Pacman 3.0.6 takes cachedir and dbpath to be relative to it's given root, not absolute. Signed-off-by: Simo Leone <simo@archlinux.org> Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
This commit is contained in:
parent
656a54014b
commit
192b24f829
|
@ -65,7 +65,7 @@ function chroot_mount ()
|
||||||
[ -e "${working_dir}/var/cache/pacman" ] || mkdir -p "${working_dir}/var/cache/pacman"
|
[ -e "${working_dir}/var/cache/pacman" ] || mkdir -p "${working_dir}/var/cache/pacman"
|
||||||
mount -o bind /var/cache/pacman "${working_dir}/var/cache/pacman"
|
mount -o bind /var/cache/pacman "${working_dir}/var/cache/pacman"
|
||||||
|
|
||||||
trap 'chroot_umount' 1 2 15
|
trap 'chroot_umount' 0 1 2 15
|
||||||
}
|
}
|
||||||
|
|
||||||
function chroot_umount ()
|
function chroot_umount ()
|
||||||
|
@ -111,8 +111,9 @@ else
|
||||||
|
|
||||||
pacargs="--noconfirm -v " #--noprogressbar -v
|
pacargs="--noconfirm -v " #--noprogressbar -v
|
||||||
pacargs="$pacargs --root=${working_dir}"
|
pacargs="$pacargs --root=${working_dir}"
|
||||||
pacargs="$pacargs --dbpath=${working_dir}/var/lib/pacman"
|
# pacman takes these as relative to the given root
|
||||||
pacargs="$pacargs --cachedir=${working_dir}/var/cache/pacman"
|
pacargs="$pacargs --dbpath=/var/lib/pacman"
|
||||||
|
pacargs="$pacargs --cachedir=/var/cache/pacman/pkg"
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
echo "no packages to install"
|
echo "no packages to install"
|
||||||
|
|
Loading…
Reference in New Issue