From: Harald Seiler <hws@denx.de>
To: isar-users@googlegroups.com
Subject: [PATCH 4/4] wic: Refactor fakeroot script
Date: Tue, 12 Feb 2019 10:20:46 +0100 [thread overview]
Message-ID: <20190212092046.6508-5-hws@denx.de> (raw)
In-Reply-To: <20190212092046.6508-1-hws@denx.de>
Signed-off-by: Harald Seiler <hws@denx.de>
---
scripts/wic_fakeroot | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/scripts/wic_fakeroot b/scripts/wic_fakeroot
index 9e01c38..88a03fa 100755
--- a/scripts/wic_fakeroot
+++ b/scripts/wic_fakeroot
@@ -11,7 +11,6 @@
#
import os
import sys
-import shutil
import subprocess
args = sys.argv
@@ -24,14 +23,12 @@ cmd = args[0]
# i.e. in wics partition.py the "du -ks" fails on
# var/cache/apt/archives/partial
# rootfs/root ...
-assert 'root' == os.environ["USER"]
+assert os.geteuid() == 0, "wic_fakeroot must be run as root!"
# e2fsck <= 1.43.5 returns 1 on non-errors (stretch and before affected)
# treat 1 as safe ... the filesystem was successfully repaired and is OK
if cmd.startswith('fsck.'):
ret = subprocess.call(args)
- if ret == 0 or ret == 1:
- sys.exit(0)
- sys.exit(ret)
+ sys.exit(0 if ret == 1 else ret)
-os.execv(shutil.which(cmd), args)
+os.execvp(cmd, args)
--
2.14.1
prev parent reply other threads:[~2019-02-12 9:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-12 9:20 [PATCH 0/4] Python refactoring Harald Seiler
2019-02-12 9:20 ` [PATCH 1/4] Remove all uses of subprocess.call(shell=True) Harald Seiler
2019-02-12 9:51 ` Claudius Heine
2019-02-12 9:20 ` [PATCH 2/4] Use modern python formatting Harald Seiler
2019-02-12 9:20 ` [PATCH 3/4] image: Remove recursion in get_image_name Harald Seiler
2019-02-12 9:20 ` Harald Seiler [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190212092046.6508-5-hws@denx.de \
--to=hws@denx.de \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox