diff --git a/common.py b/common.py index 5a0a5be..5aeb836 100644 --- a/common.py +++ b/common.py @@ -49,6 +49,19 @@ consts['data_dir'] = os.path.join(consts['root_dir'], 'data') consts['p9_dir'] = os.path.join(consts['data_dir'], '9p') consts['gem5_non_default_source_root_dir'] = os.path.join(consts['data_dir'], 'gem5') if consts['in_docker']: + # fatal: unsafe repository ('/root/lkmc' is owned by someone else) + # Fuck these error checks, let me shoot my feet in peace. + # The best solution would be to actually get Docker to mount + # the current diretory as root. But I've never been able to do that: + # * https://stackoverflow.com/questions/51973179/docker-mount-volumes-as-root + # * https://unix.stackexchange.com/questions/523492/how-to-mount-files-as-specific-user-when-using-docker-namespace-remapping + # * https://stackoverflow.com/questions/35291520/docker-and-userns-remap-how-to-manage-volume-permissions-to-share-data-betwee + # So for now we see as owner e.g. 1000:1000 on the volume, and root:root on /. + # '*' to ignore all was added on Git 2.36... Without that we would need to add every single submodule to the list. + # * https://stackoverflow.com/questions/71901632/fatal-unsafe-repository-home-repon-is-owned-by-someone-else + # * https://stackoverflow.com/questions/71849415/i-cannot-add-the-parent-directory-to-safe-directory-in-git/71904131#71904131 + # * https://www.reddit.com/r/docker/comments/o8bnft/is_it_possible_to_mount_files_with_readwrite/ + subprocess.check_output(['git', 'config', '--global', '--add', 'safe.directory', '*']) consts['out_dir'] = os.path.join(consts['root_dir'], 'out.docker') else: consts['out_dir'] = os.path.join(consts['root_dir'], 'out') diff --git a/setup b/setup index 67983d5..2f4342a 100755 --- a/setup +++ b/setup @@ -1,5 +1,6 @@ #!/usr/bin/env bash # Minimum requirements to run ./build --download-dependencies +set -ex if [ $# -eq 1 ]; then y=-y else @@ -7,12 +8,21 @@ else fi if [ -f /.dockerenv ]; then sudo= + export DEBIAN_FRONTEND=noninteractive else sudo=sudo fi $sudo apt-get update +if [ -f /.dockerenv ]; then + apt install -y software-properties-common + add-apt-repository -y ppa:git-core/ppa + $sudo apt update + git=git=1:2.36.0-0ppa1~ubuntu20.04.1 +else + git=git +fi $sudo apt-get install $y \ - git \ + $git \ python3 \ python3-pip \ python3-distutils \