forked from josch/mmdebstrap
make hooks work in chrootless mode
This commit is contained in:
parent
d36ba6b371
commit
e0732140c0
2 changed files with 61 additions and 4 deletions
59
coverage.sh
59
coverage.sh
|
@ -52,7 +52,7 @@ if [ ! -e shared/mmdebstrap ] || [ mmdebstrap -nt shared/mmdebstrap ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
starttime=
|
starttime=
|
||||||
total=105
|
total=106
|
||||||
i=1
|
i=1
|
||||||
|
|
||||||
print_header() {
|
print_header() {
|
||||||
|
@ -1480,6 +1480,63 @@ else
|
||||||
./run_null.sh
|
./run_null.sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
print_header "mode=chrootless,variant=custom: install doc-debian and test hooks"
|
||||||
|
cat << END > shared/test.sh
|
||||||
|
#!/bin/sh
|
||||||
|
set -eu
|
||||||
|
export LC_ALL=C.UTF-8
|
||||||
|
export SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH
|
||||||
|
[ "\$(id -u)" -eq 0 ] && ! id -u user > /dev/null 2>&1 && adduser --gecos user --disabled-password user
|
||||||
|
prefix=
|
||||||
|
[ "\$(id -u)" -eq 0 ] && prefix="runuser -u user --"
|
||||||
|
\$prefix $CMD --mode=chrootless --variant=custom --include=doc-debian --setup-hook='touch "\$1/setup"' --customize-hook='touch "\$1/customize"' $DEFAULT_DIST /tmp/debian-chroot $mirror
|
||||||
|
rm /tmp/debian-chroot/setup
|
||||||
|
rm /tmp/debian-chroot/customize
|
||||||
|
chmod 700 /tmp/debian-chroot
|
||||||
|
tar -C /tmp/debian-chroot --owner=0 --group=0 --numeric-owner --sort=name --clamp-mtime --mtime=$(date --utc --date=@$SOURCE_DATE_EPOCH --iso-8601=seconds) -cf /tmp/debian-chroot.tar .
|
||||||
|
tar tvf /tmp/debian-chroot.tar | grep -v ' ./dev' | diff -u doc-debian.tar.list -
|
||||||
|
rm /tmp/debian-chroot.tar
|
||||||
|
# delete contents of doc-debian
|
||||||
|
rm /tmp/debian-chroot/usr/share/doc-base/debian-*
|
||||||
|
rm -r /tmp/debian-chroot/usr/share/doc/debian
|
||||||
|
rm -r /tmp/debian-chroot/usr/share/doc/doc-debian
|
||||||
|
# delete real files
|
||||||
|
rm /tmp/debian-chroot/etc/apt/sources.list
|
||||||
|
rm /tmp/debian-chroot/etc/fstab
|
||||||
|
rm /tmp/debian-chroot/etc/hostname
|
||||||
|
rm /tmp/debian-chroot/etc/resolv.conf
|
||||||
|
rm /tmp/debian-chroot/var/lib/dpkg/status
|
||||||
|
rm /tmp/debian-chroot/var/lib/dpkg/available
|
||||||
|
rm /tmp/debian-chroot/var/cache/apt/archives/lock
|
||||||
|
rm /tmp/debian-chroot/var/lib/dpkg/lock
|
||||||
|
rm /tmp/debian-chroot/var/lib/dpkg/lock-frontend
|
||||||
|
rm /tmp/debian-chroot/var/lib/dpkg/cmethopt
|
||||||
|
rm /tmp/debian-chroot/var/lib/apt/lists/lock
|
||||||
|
rm /tmp/debian-chroot/var/lib/apt/extended_states
|
||||||
|
## delete merged usr symlinks
|
||||||
|
#rm /tmp/debian-chroot/libx32
|
||||||
|
#rm /tmp/debian-chroot/lib64
|
||||||
|
#rm /tmp/debian-chroot/lib32
|
||||||
|
#rm /tmp/debian-chroot/sbin
|
||||||
|
#rm /tmp/debian-chroot/bin
|
||||||
|
#rm /tmp/debian-chroot/lib
|
||||||
|
# in chrootless mode, there is more to remove
|
||||||
|
rm /tmp/debian-chroot/var/log/apt/eipp.log.xz
|
||||||
|
rm /tmp/debian-chroot/var/lib/dpkg/triggers/Lock
|
||||||
|
rm /tmp/debian-chroot/var/lib/dpkg/triggers/Unincorp
|
||||||
|
rm /tmp/debian-chroot/var/lib/dpkg/status-old
|
||||||
|
rm /tmp/debian-chroot/var/lib/dpkg/info/format
|
||||||
|
rm /tmp/debian-chroot/var/lib/dpkg/info/doc-debian.md5sums
|
||||||
|
rm /tmp/debian-chroot/var/lib/dpkg/info/doc-debian.list
|
||||||
|
# the rest should be empty directories that we can rmdir recursively
|
||||||
|
find /tmp/debian-chroot -depth -print0 | xargs -0 rmdir
|
||||||
|
END
|
||||||
|
if [ "$HAVE_QEMU" = "yes" ]; then
|
||||||
|
./run_qemu.sh
|
||||||
|
else
|
||||||
|
./run_null.sh
|
||||||
|
fi
|
||||||
|
|
||||||
print_header "mode=chrootless,variant=custom: install libmagic-mgc on armhf"
|
print_header "mode=chrootless,variant=custom: install libmagic-mgc on armhf"
|
||||||
cat << END > shared/test.sh
|
cat << END > shared/test.sh
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
|
@ -792,7 +792,7 @@ sub run_chroot(&$) {
|
||||||
error "unsupported type: $type";
|
error "unsupported type: $type";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elsif (any { $_ eq $options->{mode} } ('proot', 'fakechroot')) {
|
} elsif (any { $_ eq $options->{mode} } ('proot', 'fakechroot', 'chrootless')) {
|
||||||
# we cannot mount in fakechroot and proot mode
|
# we cannot mount in fakechroot and proot mode
|
||||||
# in proot mode we have /dev bind-mounted already through --bind=/dev
|
# in proot mode we have /dev bind-mounted already through --bind=/dev
|
||||||
} else {
|
} else {
|
||||||
|
@ -823,7 +823,7 @@ sub run_chroot(&$) {
|
||||||
# we have to rbind because just using bind results in "wrong fs
|
# we have to rbind because just using bind results in "wrong fs
|
||||||
# type, bad option, bad superblock" error
|
# type, bad option, bad superblock" error
|
||||||
0 == system('mount', '-o', 'rbind', '/sys', "$options->{root}/sys") or error "mount /sys failed: $?";
|
0 == system('mount', '-o', 'rbind', '/sys', "$options->{root}/sys") or error "mount /sys failed: $?";
|
||||||
} elsif (any { $_ eq $options->{mode} } ('proot', 'fakechroot')) {
|
} elsif (any { $_ eq $options->{mode} } ('proot', 'fakechroot', 'chrootless')) {
|
||||||
# we cannot mount in fakechroot and proot mode
|
# we cannot mount in fakechroot and proot mode
|
||||||
# in proot mode we have /proc bind-mounted already through --bind=/proc
|
# in proot mode we have /proc bind-mounted already through --bind=/proc
|
||||||
} else {
|
} else {
|
||||||
|
@ -845,7 +845,7 @@ sub run_chroot(&$) {
|
||||||
0 == system('umount', '--no-mtab', "$options->{root}/proc") or error "umount /proc failed: $?";
|
0 == system('umount', '--no-mtab', "$options->{root}/proc") or error "umount /proc failed: $?";
|
||||||
};
|
};
|
||||||
0 == system('mount', '-t', 'proc', 'proc', "$options->{root}/proc") or error "mount /proc failed: $?";
|
0 == system('mount', '-t', 'proc', 'proc', "$options->{root}/proc") or error "mount /proc failed: $?";
|
||||||
} elsif (any { $_ eq $options->{mode} } ('proot', 'fakechroot')) {
|
} elsif (any { $_ eq $options->{mode} } ('proot', 'fakechroot', 'chrootless')) {
|
||||||
# we cannot mount in fakechroot and proot mode
|
# we cannot mount in fakechroot and proot mode
|
||||||
# in proot mode we have /sys bind-mounted already through --bind=/sys
|
# in proot mode we have /sys bind-mounted already through --bind=/sys
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue