mirror of
https://github.com/RasppleII/a2server.git
synced 2026-04-19 23:16:29 +00:00
cppo detects invalid SHK rather than creating empty folder
This commit is contained in:
+11
-5
@@ -1169,15 +1169,21 @@ if g.SHK:
|
||||
targetDir = (args[3] if g.extractFile else args[2])
|
||||
unshkdir = ("/tmp/cppo-" + str(uuid.uuid4()))
|
||||
makedirs(unshkdir)
|
||||
if not os.system("cd " + unshkdir + "; " +
|
||||
"nulib2 -xse " +
|
||||
os.path.abspath(g.imageFile) + " " +
|
||||
(args[2].replace('/', ':') if g.extractFile else "") +
|
||||
" | grep -q 'no records match' > /dev/null"):
|
||||
result = os.system("/bin/bash -c 'cd " + unshkdir + "; " +
|
||||
"result=$(nulib2 -xse " + os.path.abspath(g.imageFile) +
|
||||
((" " + args[2].replace('/', ':'))
|
||||
if g.extractFile else "") + " 2> /dev/null); " +
|
||||
"if [[ $result == \"Failed.\" ]]; then exit 3; " +
|
||||
"else if grep -q \"no records match\" <<< \"$result\"" +
|
||||
" > /dev/null; then exit 2; else exit 0; fi; fi'")
|
||||
if (result == 512):
|
||||
print(
|
||||
"File not found in ShrinkIt archive. Try cppo -cat to get the path,")
|
||||
print(" and omit any leading slash or colon.")
|
||||
sys.exit(1)
|
||||
elif (result != 0):
|
||||
print("ShrinkIt archive is invalid, or some other problem happened.")
|
||||
sys.exit(1)
|
||||
if g.extractFile:
|
||||
g.extractFile = g.extractFile.replace(':', '/')
|
||||
extractPath = (unshkdir + "/" + g.extractFile)
|
||||
|
||||
Reference in New Issue
Block a user