forked from webfrogs/xcode_shell
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
chenchengfang
committed
Feb 27, 2013
1 parent
1a66c80
commit e8cf186
Showing
6 changed files
with
154 additions
and
46 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
#-------------------------------------------- | ||
# 修改日期:2012/09/27 | ||
# 修改人:ccf | ||
# 修改内容:去掉打包的部分脚本,只保留生成协议文件部分,以后此脚本依赖ipa-build脚本 | ||
# 修改内容:去掉打包的部分脚本,只保留生成协议文件部分,以后此脚本依赖ipa-build脚本生成的内容 | ||
#-------------------------------------------- | ||
# 修改日期:2013/02/18 | ||
# 修改人:ccf | ||
|
@@ -18,29 +18,42 @@ | |
# 修改人:ccf | ||
# 修改内容:添加上传服务器后邮件提醒功能 | ||
#-------------------------------------------- | ||
# 修改日期:2013/02/27 | ||
# 修改人:ccf | ||
# 修改内容:添加更新服务器上工程索引文件功能 | ||
#-------------------------------------------- | ||
|
||
|
||
|
||
|
||
#获取当前shell文件所在的绝对路径 | ||
shell_path=$(dirname $0) | ||
|
||
|
||
#须配置内容 start | ||
|
||
#存放该shell文件夹的路径 | ||
shell_path=~/shell | ||
#sftp参数设置 | ||
sftp_server=192.168.xx.xx | ||
sftp_username=xx | ||
sftp_password=xx | ||
sftp_workpath="/usr/share/xx/xx/xx" | ||
|
||
|
||
|
||
#发布应用的url地址 | ||
pulish_url="http://**.com/" | ||
pulish_url="http://xx.com/xx" | ||
|
||
#以下是邮箱的相关设置 | ||
#收件人 | ||
email_reciver=**@** | ||
email_reciver=[email protected] | ||
#发送者邮箱 | ||
email_sender=**@** | ||
email_sender=[email protected] | ||
#邮箱用户名 | ||
email_username=** | ||
email_username=xx | ||
#邮箱密码 | ||
email_password=** | ||
email_password=xx | ||
#smtp服务器地址 | ||
email_smtphost=** | ||
email_smtphost=smtp.exmail.qq.com | ||
|
||
|
||
#可配置内容 end | ||
|
@@ -109,7 +122,7 @@ unzip tmp.zip | |
#app文件中Info.plist文件路径 | ||
app_infoplist_path=$(pwd)/Payload/*.app/Info.plist | ||
#取版本号 | ||
#bundleShortVersion=$(/usr/libexec/PlistBuddy -c "print CFBundleShortVersionString" ${app_infoplist_path}) | ||
bundleShortVersion=$(/usr/libexec/PlistBuddy -c "print CFBundleShortVersionString" ${app_infoplist_path}) | ||
#取build值 | ||
bundleVersion=$(/usr/libexec/PlistBuddy -c "print CFBundleVersion" ${app_infoplist_path}) | ||
#取bundleIdentifier | ||
|
@@ -138,6 +151,12 @@ mkdir $target_name | |
cp ./ipa-build/*.ipa ./$target_name/${target_name}.ipa | ||
cp ../[email protected] ./$target_name/${target_name}_logo.png | ||
cd $target_name | ||
|
||
#ipa下载url | ||
ipa_download_url=${pulish_url}/${target_name}/${target_name}.ipa | ||
#itms-services协议串 | ||
ios_install_url="itms-services://?action=download-manifest&url=${pulish_url}/${target_name}/${target_name}.plist" | ||
|
||
#生成install.html文件 | ||
cat << EOF > index.html | ||
<!DOCTYPE HTML> | ||
|
@@ -153,7 +172,7 @@ cat << EOF > index.html | |
<br> | ||
<p align=center> | ||
<font size="8"> | ||
<a href="itms-services://?action=download-manifest&url=${pulish_url}/${target_name}/${target_name}.plist">点击这里安装</a> | ||
<a href="${ios_install_url}">点击这里安装</a> | ||
</font> | ||
</p> | ||
|
@@ -176,7 +195,7 @@ cat << EOF > ${target_name}.plist | |
<key>kind</key> | ||
<string>software-package</string> | ||
<key>url</key> | ||
<string>${pulish_url}/${target_name}/${target_name}.ipa</string> | ||
<string>${ipa_download_url}</string> | ||
</dict> | ||
<dict> | ||
<key>kind</key> | ||
|
@@ -215,7 +234,20 @@ cat << EOF > ${target_name}.plist | |
EOF | ||
|
||
#调用upload脚本来将文件上传到服务器 | ||
${shell_path}/upload $target_name || exit | ||
${shell_path}/uploadItemsServicesFiles $target_name ${sftp_server} ${sftp_username} ${sftp_password} ${sftp_workpath} || exit | ||
|
||
#切换到tmp目录下 | ||
serverIndexHtmlName=index.html | ||
cd /tmp | ||
rm ${serverIndexHtmlName} | ||
#从服务器下载index.html | ||
${shell_path}/sftpDownloadFile ${serverIndexHtmlName} ${sftp_server} ${sftp_username} ${sftp_password} ${sftp_workpath} || exit | ||
#更新index.html | ||
${shell_path}/updateLocalIndexHtml ${display_name} ${bundleShortVersion} ${ipa_download_url} ${ios_install_url} || exit | ||
#上传index.html | ||
${shell_path}/sftpUploadFile ${serverIndexHtmlName} ${sftp_server} ${sftp_username} ${sftp_password} ${sftp_workpath} || exit | ||
|
||
|
||
|
||
#发送邮件 | ||
if [ $should_email = y ];then | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/expect -f | ||
|
||
#-------------------------------------------- | ||
# 功能:使用sftp到服务器指定目录下载指定文件到当前路径 | ||
# 使用说明:命令有5个参数。注意:目前该脚本无参数验证功能,必须5个参数,否则脚本运行结果会发生错误 | ||
# 参数1:要下载的文件名 | ||
# 参数2:服务器地址 | ||
# 参数3:sftp用户名 | ||
# 参数4:sftp密码 | ||
# 参数5:sftp工作路径 | ||
# 作者:ccf | ||
# E-mail:[email protected] | ||
# 创建日期:2013/02/27 | ||
#-------------------------------------------- | ||
|
||
|
||
#参数设置 | ||
set downloadFileName [lindex $argv 0] | ||
set host [lindex $argv 1] | ||
set username [lindex $argv 2] | ||
set password [lindex $argv 3] | ||
set hostfilepath [lindex $argv 4] | ||
|
||
#sftp连接 | ||
spawn sftp $username@$host | ||
|
||
#第一次sftp时需输入yes | ||
expect { | ||
"(yes/no)?" {send "yes\r"; exp_continue} | ||
"password:" {send "$password\r"} | ||
} | ||
|
||
#切换到所要放置的目录下 | ||
expect "sftp>" | ||
send "cd $hostfilepath\r" | ||
|
||
#从服务器上下载指定 | ||
expect "sftp>" | ||
send "get $downloadFileName\r" | ||
|
||
#退出sftp | ||
expect "sftp>" | ||
send "bye\r" | ||
|
||
expect eof | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/expect -f | ||
|
||
#-------------------------------------------- | ||
# 功能:使用sftp将当前路径下指定文件上传到服务器指定路径中 | ||
# 使用说明:命令有5个参数。注意:目前该脚本无参数验证功能,必须5个参数,否则脚本运行结果会发生错误 | ||
# 参数1:要上传的文件名 | ||
# 参数2:服务器地址 | ||
# 参数3:sftp用户名 | ||
# 参数4:sftp密码 | ||
# 参数5:sftp工作路径 | ||
# 作者:ccf | ||
# E-mail:[email protected] | ||
# 创建日期:2013/02/27 | ||
#-------------------------------------------- | ||
|
||
|
||
#参数设置 | ||
set uploadFileName [lindex $argv 0] | ||
set host [lindex $argv 1] | ||
set username [lindex $argv 2] | ||
set password [lindex $argv 3] | ||
set hostfilepath [lindex $argv 4] | ||
|
||
#sftp连接 | ||
spawn sftp $username@$host | ||
|
||
#第一次sftp时需输入yes | ||
expect { | ||
"(yes/no)?" {send "yes\r"; exp_continue} | ||
"password:" {send "$password\r"} | ||
} | ||
|
||
#切换到所要放置的目录下 | ||
expect "sftp>" | ||
send "cd $hostfilepath\r" | ||
|
||
#从服务器上下载指定 | ||
expect "sftp>" | ||
send "put $uploadFileName\r" | ||
|
||
#退出sftp | ||
expect "sftp>" | ||
send "bye\r" | ||
|
||
expect eof | ||
|
||
|
||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,13 @@ | |
|
||
#-------------------------------------------- | ||
# 功能:先在服务器指定路径下新建文件夹,并将脚本所在路径下所有文件通过sftp协议上传到该文件夹中。 | ||
# 使用说明:命令后带一个参数,表示在服务器中新建文件夹的名字。注意:目前该脚本无参数验证功能,必须有该参数,否则脚本运行结果会发生错误 | ||
# 使用说明:命令有5个参数。注意:目前该脚本无参数验证功能,必须5个参数,否则脚本运行结果会发生错误 | ||
# 参数1:服务器中新建文件夹的名字; | ||
# 参数2:服务器地址 | ||
# 参数3:sftp用户名 | ||
# 参数4:sftp密码 | ||
# 参数5:sftp工作路径 | ||
# | ||
# 作者:ccf | ||
# E-mail:[email protected] | ||
# 创建日期:2013/02/17 | ||
|
@@ -11,10 +17,11 @@ | |
|
||
#参数设置 | ||
set filefolder [lindex $argv 0] | ||
set host 192.168.**.** | ||
set username root | ||
set password **** | ||
set hostfilepath /usr/**/**/**/** | ||
set host [lindex $argv 1] | ||
set username [lindex $argv 2] | ||
set password [lindex $argv 3] | ||
set hostfilepath [lindex $argv 4] | ||
|
||
|
||
#sftp连接 | ||
spawn sftp $username@$host | ||
|
@@ -29,6 +36,7 @@ expect { | |
expect "sftp>" | ||
send "cd $hostfilepath\r" | ||
|
||
|
||
#判断文件夹是否已经存在,若不存在,则新建。之后进入到文件夹中 | ||
expect "sftp>" | ||
send "ls $filefolder\r" | ||
|
@@ -49,7 +57,4 @@ send "put ./*\r" | |
expect "sftp>" | ||
send "bye\r" | ||
|
||
interact | ||
|
||
|
||
|
||
expect eof |