From 8f25d5924919d4768566e1650be5dac7a6ba682f Mon Sep 17 00:00:00 2001 From: Jeremy Rand Date: Wed, 19 May 2021 07:26:56 +0000 Subject: [PATCH] Cirrus: Add root to subuid/subgid list Fixes https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/issues/40298 --- tools/add-root-subids.py | 22 ++++++++++++++++++++++ tools/cirrus_build_project.sh | 3 +++ 2 files changed, 25 insertions(+) create mode 100755 tools/add-root-subids.py diff --git a/tools/add-root-subids.py b/tools/add-root-subids.py new file mode 100755 index 0000000..f55cb09 --- /dev/null +++ b/tools/add-root-subids.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 + +def add_subid(baseid: str, filename: str): + mapid = 100000 + countid = 65536 + + with open(filename, "r") as f: + for line in f: + line_baseid, line_mapid, line_countid = line.split(":") + line_mapid = int(line_mapid) + line_countid = int(line_countid) + + if line_baseid == baseid: + return + + mapid = max(mapid, line_mapid + line_countid) + + with open(filename, "a") as f: + f.write(f"{baseid}:{mapid}:{countid}\n") + +add_subid("root", "/etc/subuid") +add_subid("root", "/etc/subgid") diff --git a/tools/cirrus_build_project.sh b/tools/cirrus_build_project.sh index 311028b..9af02a6 100755 --- a/tools/cirrus_build_project.sh +++ b/tools/cirrus_build_project.sh @@ -36,6 +36,9 @@ cat tools/rbm.local.conf.onetarget | sed "s/CHANNEL/$CHANNEL/g" | sed "s/ncdns-a echo "Patching rbm..." ./tools/patch-tor-to-namecoin.sh +echo "Mapping subid's..." +./tools/add-root-subids.py + if [[ "$BUMP_DEPS" -eq 1 ]]; then ./tools/namecoin-bump-versions.sh exit 0