diff options
Diffstat (limited to 'scripts/nativesdk-intercept')
-rwxr-xr-x | scripts/nativesdk-intercept/chgrp | 30 | ||||
-rwxr-xr-x | scripts/nativesdk-intercept/chown | 30 |
2 files changed, 60 insertions, 0 deletions
diff --git a/scripts/nativesdk-intercept/chgrp b/scripts/nativesdk-intercept/chgrp new file mode 100755 index 0000000000..f8ae84b8b3 --- /dev/null +++ b/scripts/nativesdk-intercept/chgrp @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +# +# Wrapper around 'chgrp' that redirects to root in all cases + +import os +import shutil +import sys + +# calculate path to the real 'chgrp' +path = os.environ['PATH'] +path = path.replace(os.path.dirname(sys.argv[0]), '') +real_chgrp = shutil.which('chgrp', path=path) + +args = list() + +found = False + +args.append(real_chgrp) + +for i in sys.argv[1:]: + if i.startswith("-"): + args.append(i) + continue + if not found: + args.append("root") + found = True + else: + args.append(i) + +os.execv(real_chgrp, args) diff --git a/scripts/nativesdk-intercept/chown b/scripts/nativesdk-intercept/chown new file mode 100755 index 0000000000..0805ceb70a --- /dev/null +++ b/scripts/nativesdk-intercept/chown @@ -0,0 +1,30 @@ +#!/usr/bin/env python3 +# +# Wrapper around 'chown' that redirects to root in all cases + +import os +import shutil +import sys + +# calculate path to the real 'chown' +path = os.environ['PATH'] +path = path.replace(os.path.dirname(sys.argv[0]), '') +real_chown = shutil.which('chown', path=path) + +args = list() + +found = False + +args.append(real_chown) + +for i in sys.argv[1:]: + if i.startswith("-"): + args.append(i) + continue + if not found: + args.append("root:root") + found = True + else: + args.append(i) + +os.execv(real_chown, args) |