diff options
-rw-r--r-- | meta/classes/nativesdk.bbclass | 2 | ||||
-rwxr-xr-x | scripts/nativesdk-intercept/chgrp | 27 | ||||
-rwxr-xr-x | scripts/nativesdk-intercept/chown | 27 |
3 files changed, 56 insertions, 0 deletions
diff --git a/meta/classes/nativesdk.bbclass b/meta/classes/nativesdk.bbclass index 14e210562f..f8e9607513 100644 --- a/meta/classes/nativesdk.bbclass +++ b/meta/classes/nativesdk.bbclass | |||
@@ -113,3 +113,5 @@ do_packagedata[stamp-extra-info] = "" | |||
113 | USE_NLS = "${SDKUSE_NLS}" | 113 | USE_NLS = "${SDKUSE_NLS}" |
114 | 114 | ||
115 | OLDEST_KERNEL = "${SDK_OLDEST_KERNEL}" | 115 | OLDEST_KERNEL = "${SDK_OLDEST_KERNEL}" |
116 | |||
117 | PATH:prepend = "${COREBASE}/scripts/nativesdk-intercept:" | ||
diff --git a/scripts/nativesdk-intercept/chgrp b/scripts/nativesdk-intercept/chgrp new file mode 100755 index 0000000000..30cc417d3a --- /dev/null +++ b/scripts/nativesdk-intercept/chgrp | |||
@@ -0,0 +1,27 @@ | |||
1 | #!/usr/bin/env python3 | ||
2 | # | ||
3 | # Wrapper around 'chgrp' that redirects to root in all cases | ||
4 | |||
5 | import os | ||
6 | import shutil | ||
7 | import sys | ||
8 | |||
9 | # calculate path to the real 'chgrp' | ||
10 | path = os.environ['PATH'] | ||
11 | path = path.replace(os.path.dirname(sys.argv[0]), '') | ||
12 | real_chgrp = shutil.which('chgrp', path=path) | ||
13 | |||
14 | args = list() | ||
15 | |||
16 | found = False | ||
17 | for i in sys.argv: | ||
18 | if i.startswith("-"): | ||
19 | args.append(i) | ||
20 | continue | ||
21 | if not found: | ||
22 | args.append("root") | ||
23 | found = True | ||
24 | else: | ||
25 | args.append(i) | ||
26 | |||
27 | os.execv(real_chgrp, args) | ||
diff --git a/scripts/nativesdk-intercept/chown b/scripts/nativesdk-intercept/chown new file mode 100755 index 0000000000..3914b3e384 --- /dev/null +++ b/scripts/nativesdk-intercept/chown | |||
@@ -0,0 +1,27 @@ | |||
1 | #!/usr/bin/env python3 | ||
2 | # | ||
3 | # Wrapper around 'chown' that redirects to root in all cases | ||
4 | |||
5 | import os | ||
6 | import shutil | ||
7 | import sys | ||
8 | |||
9 | # calculate path to the real 'chown' | ||
10 | path = os.environ['PATH'] | ||
11 | path = path.replace(os.path.dirname(sys.argv[0]), '') | ||
12 | real_chown = shutil.which('chown', path=path) | ||
13 | |||
14 | args = list() | ||
15 | |||
16 | found = False | ||
17 | for i in sys.argv: | ||
18 | if i.startswith("-"): | ||
19 | args.append(i) | ||
20 | continue | ||
21 | if not found: | ||
22 | args.append("root:root") | ||
23 | found = True | ||
24 | else: | ||
25 | args.append(i) | ||
26 | |||
27 | os.execv(real_chown, args) | ||