Skip to content
This repository was archived by the owner on Nov 21, 2018. It is now read-only.

Commit a20d18f

Browse files
committed
Fix permissions before building .pkg
1 parent a816dfa commit a20d18f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

package-rust.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,17 @@ def run(args):
200200
print "creating .pkg"
201201
os.mkdir(TEMP_DIR + "/pkg")
202202
shutil.copytree(TEMP_DIR + "/work/" + package_name, TEMP_DIR + "/pkg/root")
203+
# The package root, extracted from a tarball has entirely wrong permissions.
204+
# This goes over everything and fixes them.
205+
run(["chmod", "-R", "u+rwX,go+rX,go-w", TEMP_DIR + "/pkg/root"])
206+
for filename in os.listdir(TEMP_DIR + "/pkg/root/bin"):
207+
run(["chmod", "0755", TEMP_DIR + "/pkg/root/bin/" + filename])
208+
209+
# Remove everything under the root. These all shouldn't be installed.
210+
for filename in os.listdir(TEMP_DIR + "/pkg/root"):
211+
if os.path.isfile(TEMP_DIR + "/pkg/root/" + filename):
212+
run(["rm", TEMP_DIR + "/pkg/root/" + filename])
213+
203214
os.mkdir(TEMP_DIR + "/pkg/res")
204215
shutil.copyfile(TEMP_DIR + "/LICENSE.txt", TEMP_DIR + "/pkg/res/LICENSE.txt")
205216
shutil.copyfile("./pkg/welcome.rtf", TEMP_DIR + "/pkg/res/welcome.rtf")

0 commit comments

Comments
 (0)