Commit Graph

591 Commits (main)

Author SHA1 Message Date
Johannes 'josch' Schauer d262d67877
Fix parallel xz compression... hopefully for the last time... 5 years ago
Johannes 'josch' Schauer 9f2ea61265
Fix parallel xz compression 5 years ago
Johannes 'josch' Schauer aad36777e8
add --man option and reduce output of --help option
Printing the full man page requires the perl-doc package. To avoid this
dependency, print the less verbose output containing only the synopsis
and the option list for the --help option and print the full output
(requiring perldoc) for the --man option.
5 years ago
Johannes 'josch' Schauer de8b6a457d
also run initial installation of Essential:yes with /proc, /dev and /sys mounted
In Debian Jessie, init is part of Essential:yes and thus systemd gets
installed which needs working /proc, /dev and /sys
5 years ago
Johannes 'josch' Schauer 3a1d5413e2
also remove /var/log/apt/eipp.log.xz 5 years ago
Johannes 'josch' Schauer f5afbfaab0
don't let make_path fail if directory already existed 5 years ago
Benjamin Drung 4b82a664da
Use parallel xz compression
One of mmdebstrap benefits over deboostrap is that it is faster.
Creating a xz tarball as output will take a lot of time, since xz
consumes a lot of compute power and tar uses only one core.

Therefore use parallel xz compression since xz supports it using the -T
parameter.

Closes: #943327
Signed-off-by: Benjamin Drung <benjamin.drung@cloud.ionos.com>
5 years ago
Johannes 'josch' Schauer bc423e6ab6
Add disclaimer of warranty and limitation of liability 5 years ago
Johannes 'josch' Schauer a2cd0e9843
add --keyring option as a shorthand for --aptopt='Dir::Etc::Trusted... 5 years ago
Johannes 'josch' Schauer 6cac8e70e8
allow multiple --include options and use array instead of hash
Package order is important when calling apt. Consider this dependency
graph:

    A -> B -> C | D , E -> D | C

"apt install A E" it will install "A B C E"
"apt install E A" it will install "E D A B"
5 years ago
Johannes 'josch' Schauer e12db588bd
add debug output for unknown data type 5 years ago
Johannes 'josch' Schauer da4f9e4349
check whether /sbin/start-stop-daemon.REAL exists before overwriting it 5 years ago
Johannes 'josch' Schauer daab09bfdd
only write /usr/sbin/policy-rc.d if /usr/sbin exists in the chroot 5 years ago
Johannes 'josch' Schauer e0732140c0
make hooks work in chrootless mode 5 years ago
Johannes 'josch' Schauer d36ba6b371
allow multiple --architecture options and separation by whitespace 5 years ago
Johannes 'josch' Schauer 7eb0851c59
only remove policy-rc.d if it exists 5 years ago
Johannes 'josch' Schauer 1f15f690e7
release 0.5.1 5 years ago
Johannes 'josch' Schauer 59472cc8fc
improve error message about arch not being executable 5 years ago
Johannes 'josch' Schauer 22c90c2ca6
it's possible that apt is already downloaded at the time where we want to install it 5 years ago
Johannes 'josch' Schauer 78358eaf9a
improve --components parsing with comma and whitespace as separator 5 years ago
Johannes 'josch' Schauer 9978cbddcb
turn error when --include is used with essential variant into a warning 5 years ago
Johannes 'josch' Schauer 86b430190f
set qemu binfmt identifier before using it to avoid uninitialized value error 5 years ago
Johannes 'josch' Schauer ec1619d664
release 0.5.0 5 years ago
Johannes 'josch' Schauer 1f5e1483c7
add more to bugs section of man page 5 years ago
Johannes 'josch' Schauer 39a3915ea6
add more examples to man page 5 years ago
Johannes 'josch' Schauer ad6883992a
fix mirror URIs for ubuntu 5 years ago
Johannes 'josch' Schauer 7a4cefaee2
only append to QEMU_LD_PREFIX if it's already set 5 years ago
Johannes 'josch' Schauer b3536b98d0
export QEMU_LD_PREFIX in chrootless mode 5 years ago
Johannes 'josch' Schauer d2a1029ee5
collect all diagnostics about binfmt_misc before throwing error 5 years ago
Johannes 'josch' Schauer d5033dd0d1
also check for situations in which a non-native arch can be executed without emulation 5 years ago
Johannes 'josch' Schauer 3d3d3fe12d
Do not copy /etc/resolv.conf or /etc/hostname if the host system doesn't have them 5 years ago
Johannes 'josch' Schauer 3dc32b81b0
add --force-check-gpg dummy option 5 years ago
Helmut Grohne 4b440a0e01
allow messing with s-s-d in hooks
Presently, mmdebstrap fails hard if e.g. a --setup-hook removes
start-stop-daemon.REAL.
5 years ago
Helmut Grohne ea0a6bcd89
make errors about moving s-s-d more verbose 5 years ago
Helmut Grohne 519046094e
fix error message about opening s-s-d 5 years ago
Johannes 'josch' Schauer 58ae0bb97d
select the right mirror for ubuntu, kali and tanglu 5 years ago
Johannes 'josch' Schauer b70d8a0381
fix typo unpriviliged -> unprivileged 5 years ago
Johannes 'josch' Schauer 874a19050c
document that autopkgtest needs an additional entry in /etc/hosts 5 years ago
Johannes 'josch' Schauer c8a3f053d7
document that the full apt syntax can be used 5 years ago
Johannes 'josch' Schauer bfba0e7dce
add more debug output 5 years ago
Johannes 'josch' Schauer 4447769b50
when creating a tarball in chrootless mode, use root ownership 5 years ago
Johannes 'josch' Schauer a921e32e6c
Do not unconditionally read standard input
mmdebstrap used to attempt reading stdin if it was not a tty. This leads
to unexpected behaviour when mmdebstrap is used through ssh without a
pseudo-terminal allocated like so:

    $ ssh remote mmdebstrap unstable /output/dir http://mirror

This will stall forever, waiting for data on standard input. Or
consider:

    $ ssh remote << END
    > somecommand
    > mmdebstrap unstable /output/dir http://mirror
    > othercommand
    END

This will make mmdebstrap read "othercommand" and everything that
follows as a sources.list entry. To prevent this unexpected behaviour,
the following ways to use mmdebstrap will not be supported anymore:

    $ mmdebstrap unstable /output/dir < sources.list
    $ mmdebstrap unstable /output/dir http://mirror < sources.list

Instead, one must now explicitly pass "-" if one wants mmdebstrap to
read from stdin:

    $ mmdebstrap unstable /output/dir - < sources.list
    $ mmdebstrap unstable /output/dir http://mirror - < sources.list
5 years ago
Johannes 'josch' Schauer 1219a65723
add /var/lib/dpkg/arch in chrootless mode when chroot architecture differs 5 years ago
Helmut Grohne 4f2e655ad5
Only attempt removing qemu-user-static for root or unshare mode 5 years ago
Johannes 'josch' Schauer 2d2cdfbbc3
create /var/lib/dpkg/cmethopt for dselect (see #930788) 5 years ago
Johannes 'josch' Schauer 68d7ec15bd
fix docs: fakechroot is tried before proot in auto mode 5 years ago
Johannes 'josch' Schauer da489c6a53
Only error out on W: and Err: lines, on "apt-get update"
Otherwise, maintainer scripts that output W: or Err: lines will break
package installation on "apt-get install".
5 years ago
Johannes 'josch' Schauer c734a59f86
chdir to parent of root before remove_tree to prevent 'cannot stat initial working directory' of File::Path 5 years ago
Johannes 'josch' Schauer ca37c4e89e
chmod 0755 on qemu-user-static binary 5 years ago
Johannes 'josch' Schauer 14d3a4e30f
add Dir::State::Status to apt config for apt << 1.3 5 years ago
Johannes 'josch' Schauer dd5214a8c8
chdir() before 'apt-get update' to accomodate for apt << 1.5 (Debian bug #860738) 5 years ago
Johannes 'josch' Schauer b2d5a45932
cleanup auxfiles *after* running apt-get update or otherwise it will be re-created 5 years ago
Johannes 'josch' Schauer 19fdb4914d
coverage.sh: auto generate package list for aspcud instead of hardcoding it 5 years ago
Johannes 'josch' Schauer 454dd9fa3e
Annotate examples with a description of their effect 5 years ago
Johannes 'josch' Schauer a69a2d39b8
also re-exec under fakechroot if fakechroot is picked in 'auto' mode 5 years ago
Johannes 'josch' Schauer 3e8a251e1f
fix EDSP output for external solvers so that apt doesn't mark itself as Essential:yes 5 years ago
Johannes 'josch' Schauer 6a51d410ec
do not skip package installation in 'custom' variant 5 years ago
Johannes 'josch' Schauer 6d774a3d92
release 0.4.1 5 years ago
Johannes 'josch' Schauer 016cac22f8
add note about dpkg config bug 5 years ago
Johannes 'josch' Schauer 52b1a9dc6e
instead of touching a file, test if /var/lib/apt/lists/partial is readable to decide about apt sandboxing 5 years ago
Johannes 'josch' Schauer 473bc354ae
only set apt Dir config option instead of setting apt directories individually 5 years ago
Johannes 'josch' Schauer e1a41fac94
print errno when unlink fails 5 years ago
Johannes 'josch' Schauer 920877fa2a
disable apt sandboxing if the chroot directory is not accessible by the _apt user 5 years ago
Johannes 'josch' Schauer d0f0283120
do not cleanup apt and dpkg lock files to not set bad precedence 5 years ago
Johannes 'josch' Schauer e3219a5c8f
release 0.4.0 5 years ago
Johannes 'josch' Schauer 48e34852a2
clean /var/lib/apt/lists/auxfiles so that apt older than 1.6 has no problem with the chroot 5 years ago
Johannes 'josch' Schauer a91a825e67
add --version option 5 years ago
Johannes 'josch' Schauer d73b8396ac
print the used temporary directory as info message 5 years ago
Johannes 'josch' Schauer e06f2e9c57
the mmdebstrap command name has to be written in bold 5 years ago
Johannes 'josch' Schauer 1b8ad8400b
add --logfile option 5 years ago
Johannes 'josch' Schauer 1fe5da3d56
Better documentation of example showing mmdebstrap with sources.list on stdin 5 years ago
Johannes 'josch' Schauer 6e61c1a183
document the behaviour if --quiet, --silent, --verbose or --debug are passed at the same time 5 years ago
Johannes 'josch' Schauer db415fe4f4
add short options for --quiet, --silent, --verbose and --debug 5 years ago
Johannes 'josch' Schauer fffd74afc2
explicitly configure Getopt::Long 5 years ago
Johannes 'josch' Schauer 0b058c7db1
add --setup-hook, --essential-hook and rename --customize to --customize-hook 5 years ago
Johannes 'josch' Schauer 89718d367e
test no-op options and print info message when they are used 5 years ago
Johannes 'josch' Schauer 5115ca87c3
don't unset environment variables in @chrootcmd so that hooks still have access to them 5 years ago
Johannes 'josch' Schauer 3f15f66892
fix example for vmdb2 replacement 5 years ago
Johannes 'josch' Schauer 548130867b
do not run another apt-get pass with custom variant 5 years ago
Johannes 'josch' Schauer bde4c795ef
document that security mirrors are only implicitly added if no mirror was specified 5 years ago
Johannes 'josch' Schauer b9e78796b2
prefer fakechroot to proot in auto mode because the latter produces wrong ownership 5 years ago
Johannes 'josch' Schauer a3afe24fc0
Instead of using gzip compression support, run compressor ourselves
- otherwise ./dev tar cannot be concatenated with the rest
 - test compressor early
 - better document the TARGET option
5 years ago
Johannes 'josch' Schauer 84b0b5061b
start sanitizing the environment with chroot() and don't pass on TMPDIR 5 years ago
Johannes 'josch' Schauer 6f8bb8c977
since copy() is using syswrite(), we must flush the filehandle before calling it 5 years ago
Johannes 'josch' Schauer 982f8e982c
add --quiet and --debug switches and debug/verbose/info/warning/error functions 5 years ago
Johannes 'josch' Schauer 58a3069495
add mmdebstrap prefix to temporary directory name 5 years ago
Johannes 'josch' Schauer 765f5b91e9
call apt with Dpkg::Use-Pty=false to enable immediate termination upon SIGINT and prevent it from messing up the terminal with tcsetattr() 5 years ago
Johannes 'josch' Schauer be1af15489
use common function for run_dpkg_progress and run_apt_progress 5 years ago
Johannes 'josch' Schauer 7f58c4596a
handle INT, HUB, PIPE and TERM signals, wait for child processes and clean up mounts 5 years ago
Johannes 'josch' Schauer 0345d30ae6
run_*_progress: fix error message when exec() failed 5 years ago
Johannes 'josch' Schauer a3f69f8874
add undocumented --customize option 5 years ago
Johannes 'josch' Schauer d66a5a7d74
Several formatting improvements to POD 5 years ago
Johannes 'josch' Schauer e0ea1e6d65
add FIXME option to also support Debian derivatives 5 years ago
Johannes 'josch' Schauer fa836c01f7
refer to #898446 when warning about unprivileged_userns_clone 5 years ago
Johannes 'josch' Schauer e0b107453d
add another example --aptopt to man page 5 years ago
Johannes 'josch' Schauer 25bec4d5e1
add --merged-usr and --no-merged-usr no-op options for debootstrap compatibility 5 years ago
Johannes 'josch' Schauer 418b42746e
create an empty /var/lib/dpkg/available as otherwise dpkg fails on package removal 5 years ago
Johannes 'josch' Schauer 1e0b4cb3b0
now that fakechroot and proot are fixed, add support for for variants beyond essential and apt 5 years ago
Johannes 'josch' Schauer 29550acb88
add --interactive=never to rm call to avoid prompts for removal of write protected files in proot mode 5 years ago
Johannes 'josch' Schauer e6ce901be4
run several binfmt checks before using qemu-user mode 5 years ago
Johannes 'josch' Schauer 4a2bf62931
add --resolve-deps no-op option for sbuild-createchroot compatibility 5 years ago
Johannes 'josch' Schauer 3f29fa461a
don't die if output cannot be written to tarball and instead check error condition early 5 years ago
Johannes 'josch' Schauer f4263ebd74
add --verbose option that prints apt and dpkg output instead of progress bars 5 years ago
Johannes 'josch' Schauer 61ad8a8e45
update --help output for --aptopt using single quotes to avoid escaping of double quotes 5 years ago
Johannes 'josch' Schauer 97d273aaf6
disable merged usr 6 years ago
Johannes 'josch' Schauer f101057e1b
add qemu TODO item 6 years ago
Johannes 'josch' Schauer b0979d1d6b
add verbose mode to test_unshare() so that it can report what went wrong 6 years ago
Johannes 'josch' Schauer 3ffc8ea35f
add FIXME comment about binfmt_misc support 6 years ago
Johannes 'josch' Schauer 4ef1eda200
append to $PATH instead of replacing its content 6 years ago
Johannes 'josch' Schauer 972b207508
implement 'extract' variant 6 years ago
Johannes 'josch' Schauer 16d2a4a8d9
allow empty lost+found directory in target directory 6 years ago
Johannes 'josch' Schauer 1730a17286
add two code comments 6 years ago
Johannes 'josch' Schauer 2949691591
When packaging the tarball with proot, exclude /host-rootfs 6 years ago
Johannes 'josch' Schauer 1890e22b14
do not make the default mirror for the native arch only. The sane expectation is, that the default mirror is for any architecture. 6 years ago
Johannes 'josch' Schauer cc7dddb1b3
re-installing packages with dpkg also requires --force-depends because dpkg doesn't consider Pre-Depends 6 years ago
Johannes 'josch' Schauer a9765a3ad2
fix Apt::Architectures architecture list 6 years ago
Johannes 'josch' Schauer 7948894159
dereference array foreignarchs before iterating 6 years ago
Johannes 'josch' Schauer 4c9d2bd3d7
add sanity check for fakechroot/proot renameat2 bug 6 years ago
Johannes 'josch' Schauer b8c63f8797
check the mode earlier so that we can re-exec under fakechroot earlier 6 years ago
Johannes 'josch' Schauer 70c1468453
in fakechroot mode, do not create symlinks to non-existing /proc 6 years ago
Johannes 'josch' Schauer a5866a347c
add --qemu option to proot when creating tar of foreign arch chroot 6 years ago
Johannes 'josch' Schauer 174d54f933
for simplicity, always use our own /dev tar entries 6 years ago
Johannes 'josch' Schauer 7534a7607f
Add chrootless mode and extract and custom variants 6 years ago
Johannes 'josch' Schauer 07f0e53081
Add POD section for environment variables 6 years ago
Johannes 'josch' Schauer a6d6ad4d0d
Add more markup to POD 6 years ago
Johannes 'josch' Schauer 2d6703add0
fix tar call in proot mode (avoid extra entry for /dev and error message about non-existant working directory) 6 years ago
Johannes 'josch' Schauer 5498f61ce5
apt does not support double quotes in paths 6 years ago
Johannes 'josch' Schauer 27f10e2300
fix error string (apt is part of the required variant) 6 years ago
Johannes 'josch' Schauer 1409405af7
always clean apt from the outside in case there is no apt inside the chroot 6 years ago
Johannes 'josch' Schauer 61ff05566a
as a defensive measure, in conditionals for variant and mode, always check for unknown variant/mode
That way, when adding new variants or modes, we have to consciously
choose which branch is to be taken instead of accidentally taking the
default branch.
6 years ago
Johannes 'josch' Schauer 12fc63385b
skip /dev in directory creation 6 years ago
Johannes 'josch' Schauer 145bfe5233
symlinks must also be created with havemknod 6 years ago
Johannes 'josch' Schauer b0efc9aa86
also conditionally only act on symlinks if havemknod is false 6 years ago
Johannes 'josch' Schauer 3c48bce2b2
don't set /usr/bin/env in FAKECHROOT_CMD_SUBST 6 years ago
Johannes 'josch' Schauer 7a25de31db
Don't rely on Architecture field in indextargets output because it's only filled for non-flat mirrors 6 years ago
Johannes 'josch' Schauer bdbe12fec8
don't set Apt::Get::Download-Only in the default apt config but do it explicitly in each apt call 6 years ago
Johannes 'josch' Schauer 191bc47f2c
make sure that apt puts its logs into the chroot 6 years ago
Johannes 'josch' Schauer 11633c7278
don't clean auxfiles anymore 6 years ago
Johannes 'josch' Schauer 7412d5fbce
also unmount in unshare mode to prevent wrong directory permissions of mount targets 6 years ago
Johannes 'josch' Schauer ac8084cb42
only unmount device nodes and directories with --no-mtab in unshare mode 6 years ago
Johannes 'josch' Schauer 594a37d093
add comment about mounting sys with rbind in unshare mode 6 years ago
Johannes 'josch' Schauer c6099857e2
do not chmod symlinks because that will change the target of the symlink and not the symlink itself 6 years ago
Johannes 'josch' Schauer d634095da1
Skip the loop if nothing was created so that chmod later doesn't fail 6 years ago
Johannes 'josch' Schauer eeb1ba4e11
add comment explaining the situation with *-archive-keyring packages 6 years ago
Johannes 'josch' Schauer ab96341957
die if chmod fails 6 years ago
Johannes 'josch' Schauer f2a3f23acf
Fix havemknod test
"last" only exits the innermost block, thus we need a label. Since
blocks are semantically the same as loops that only execute once, we
also replace the while() with a single block.
6 years ago
Johannes 'josch' Schauer c073d0b446
don't use default mirror if no mirror was specified but data was given on standard input 6 years ago
Johannes 'josch' Schauer d25e939363
suppress warnings when the test for the arch-test binary fails 6 years ago
Johannes 'josch' Schauer edb3c9ed9a
add FIXME comment 6 years ago
Johannes 'josch' Schauer 1f13d0157b
print /etc/apt/sources.list if apt-get update didn't download anything 6 years ago
Johannes 'josch' Schauer bb2aa6e9fd
prevent a 'deb...' mirror argument from being handled by the '://' case 6 years ago
Johannes 'josch' Schauer 173ea1162b
also remove dpkg lock files 6 years ago
Johannes 'josch' Schauer 6da8791c11
do not chmod bind mount targets as this would change permissions on the source of the mount 6 years ago
Johannes 'josch' Schauer a9db385868
die if copy() fails 6 years ago
Johannes 'josch' Schauer 640d854c2e
mount a new sysfs when root and don't unmount with --recursive 6 years ago
Johannes 'josch' Schauer 62b92bb229
fix copy-paste error 6 years ago
Johannes 'josch' Schauer b827e58d07
do not print setup() arguments by default 6 years ago
Johannes 'josch' Schauer e7e6ec0314
if newuidmap or newgidmap fail, print all their arguments 6 years ago
Johannes 'josch' Schauer d232870b28
check whether newuidmap and newgidmap are available 6 years ago
Johannes 'josch' Schauer cd39a44934
make sure that unshare mode cannot be run as superuser 6 years ago
Johannes 'josch' Schauer ec9ceb2115
Some more logging 6 years ago
Johannes 'josch' Schauer 1e9817574c
Instead of Dpkg::Index use a primitive deb822 parser and shave off another 10 seconds 6 years ago
Johannes 'josch' Schauer 16d9b413f7
unset APT_CONFIG inside the chroot 6 years ago
Johannes 'josch' Schauer 2930475e62
instead of showing the raw apt and dpkg output, display a progress bar 6 years ago
Johannes 'josch' Schauer 60f047ba66
rmdir /var/lib/apt/lists/auxfiles which is created by apt >= 1.6 but unknown to older apt inside the chroot 6 years ago
Johannes 'josch' Schauer 4d75cb8b89
Write certain apt options to a common config file inside the chroot so that apt inside and outside adhere to it while its settings can still be overwritten 6 years ago
Johannes 'josch' Schauer 87b9971539
use any and none from List::Util 6 years ago
Johannes 'josch' Schauer ee60b2c7e3
use brackets for correct operator precedence when using grep 6 years ago
Johannes 'josch' Schauer fe060e6cad
do not use 'dpkg --install --recursive' because we cannot have a progress bar without knowing how many packages we install 6 years ago
Johannes 'josch' Schauer 42d9141970
avoid glob() because it splits its argument on whitespace 6 years ago
Johannes 'josch' Schauer 56688b2fde
check the exit status after all waitpid calls 6 years ago
Johannes 'josch' Schauer 7b2ca91f59
exit with non-zero exit status if setup() dies 6 years ago
Johannes 'josch' Schauer fcc40dc122
chmod 0755 root directory so that other users (like _apt) can access it 6 years ago
Johannes 'josch' Schauer 0cdd803ba0
store valid modes in an array 6 years ago
Johannes 'josch' Schauer 550562cf6f
rudimentary support for tor:// URIs 6 years ago
Johannes 'josch' Schauer 58004816d1
If nothing got downloaded, check if a file:// URI was maybe used and warn about it 6 years ago
Johannes 'josch' Schauer 9df5afa5c4
apt-get update does not return a non-zero exit on failure, thus parse its output instead 6 years ago
Johannes 'josch' Schauer 0166f95545
Anticipate arch-test not being installed and only check if chroot architecture is unequal host's architecture 6 years ago
Johannes 'josch' Schauer c96a1526b2
add terminating semicolon to more lines 6 years ago
Johannes 'josch' Schauer 99df33ca1f
Install apt-transport-https and ca-certificates if mirrors are https 6 years ago
Johannes 'josch' Schauer bee38bcfc7
only disally --include if variant is essential 6 years ago
Johannes 'josch' Schauer e027e9458f
Be explicit about where to install libfakeroot and libfakechroot 6 years ago
Johannes 'josch' Schauer b7b6b28377
Don't forget to chomp away the newline of the arch-test output 6 years ago
Johannes 'josch' Schauer 49cc8cf32e
Clean lock files as well 6 years ago
Johannes 'josch' Schauer 1adac06646
Add qemu-user support for fakechroot and sudo modes 6 years ago
Johannes 'josch' Schauer 87586fa667
Instead of adding a fake ldconfig to the chroot, use FAKECHROOT_CMD_SUBST 6 years ago
Johannes 'josch' Schauer 4f293ebf0d
die if abs_path failed 6 years ago
Johannes 'josch' Schauer e4a7336fb9
fix typo includes=>include 6 years ago
Johannes 'josch' Schauer 1e472dc33d
Capture output of arch-test 6 years ago
Johannes 'josch' Schauer 77a95f0002
Print information about expecting data from stdin 6 years ago
Johannes 'josch' Schauer 9ed4c65e35
initial commit 6 years ago