【发布时间】:2018-08-13 09:52:17
【问题描述】:
我编写了一些代码来打包频道 IPA 并使用 shell 退出 IPA。当我在命令行中运行这个 shell 时它工作正常。
主外壳代码:
#!/bin/bash
name=$1
needchannel=$2
appName="$name.app"
ipa="$name.ipa"
plistName="${name}_${needchannel}.plist"
# echo "${1} ${2} $ipa"
if [ ! -f "./Payload" ];then
# echo "not exit Payload"
unzip $ipa
chmod -R 0777 Payload
else
echo "exit Payload"
fi
cd Payload
cd $appName
ipaPath="${name}_${needchannel}.ipa"
/usr/libexec/PlistBuddy -c "set Channel $needchannel" "Channel.plist"
cd ../..
/usr/bin/codesign -f -s "iPhone Distribution: xxxx, ooo" --entitlements entitlements.plist "Payload/${appName}"
zip -rq "./app/${ipaPath}" "Payload"
PHP 代码:
<?php
$webid = $_GET["webid"];
$appfinder = "./app/";
$filename = "Channel_".$webid.".ipa";
if (!file_exists($appfinder.$filename))
{
$shell = "sh produceApp.sh Channel $webid";
system($shell, $status);
if( $status ){
echo "produceApp error";
var_dump($status);
return;
}
}
?>
我不知道为什么 shell 在命令行中运行成功而在 PHP 中失败。 谁能帮帮我。
除协同设计外,一切正常。
ps:我用php写shell代码,直接运行,system()返回1;像这样:
<?php
$shell = "/usr/bin/codesign -f -s \"iPhone Distribution: xxx, ooo\" --entitlements entitlements.plist \"Payload/Channel.app\"";
echo "$shell";
echo "<br>";
system($shell, $status);
print_r($status);
?>
chrome show shell 是:
/usr/bin/codesign -f -s "iPhone Distribution: xxx, ooo" --entitlements entitlementds.plist "Payload/Channel.app"
并且函数 system() 返回 $status 为 1..
【问题讨论】:
-
您尝试过什么调试问题?有没有给出任何错误信息?您尝试了哪些类型的日志记录?
-
php 中的失败是什么意思?错误是什么?
-
shell我改成/usr/bin/codesign -f -s "iPhone Distribution: xxxx, ooo" --entitlements entitlements.plist "Payload/Channel.app",系统($ shell, $status) 返回 1....
-
谢谢,我找到了问题,我使用当前用户运行 shell,但是浏览器是 apache,在 apache 中运行的 php 无法访问钥匙串……所以,代码设计无法正常工作。 .