我这边使用python来编写的,基本达到了最大化程度的解耦,其他人或者其他地方都可以直接使用。先创建installMobileProfile.py

#!/usr/bin/python

# -*- coding: UTF-8 -*-

import sys

import commands

import os

paramsCount = len(sys.argv)

if (paramsCount != 5):

print "本文件只支持以下的四个参数同时配置,缺一不可"

print "第一个参数:描述文件的路径"

print "第二个参数:p12文件的路径"

print "第三个参数:操作系统用户的密码"

print "第四个参数:p12文件的密码"

exit()

mobileProfilePath=sys.argv[1]

p12filePath = sys.argv[2]

password = sys.argv[3]

cert_Pass = sys.argv[4]

print 'params is:' + mobileProfilePath + ' p12:' + p12filePath + ' pass:' + password + ' cert_Pass:' + cert_Pass

shellCommod = "grep UUID -A1 -a " + mobileProfilePath + "| grep -io '[-A-F0-9]\{36\}'"

UUID = commands.getoutput(str(shellCommod))

print "uuid is:" + UUID

homePath = commands.getoutput("echo ~")

output=str(homePath+"/Library/MobileDevice/Provisioning Profiles/"+UUID+".mobileprovision")

output1=str(homePath+"/Library/MobileDevice/Provisioning\ Profiles/"+UUID+".mobileprovision")

print output

if os.path.isfile(output):

print "file is founded"

print "install finished"

else:

print "file not found"

cp_commod = str("cp " + mobileProfilePath + " " + output1)

print cp_commod

print "copying file from "+mobileProfilePath+" to "+output1

os.system(cp_commod)

print "install finished"

os.system("ls ~/Library/MobileDevice/Provisioning\ Profiles/")

#install p12 file

keychain_Path = str(homePath+"/Library/Keychains/login.keychain")

sh1 = str("security default-keychain -s " + keychain_Path)

print "shell1 is:" + sh1

os.system(sh1)

sh2 = str("security unlock-keychain -p " + password + ' ' + keychain_Path)

print "shell2 is:" + sh2

os.system(sh2)

sh3 = str("security import " + p12filePath + " -k " + keychain_Path + ' -P ' + cert_Pass)

print "shell3 is:" + sh3

result = commands.getoutput(sh3)

print result

linux安装p12,用命令行安装mobileprovision和p12证书相关推荐

  1. Linux使用笔记:Oracle数据库安装配置(命令行安装)

    文章目录 1. Oracle数据库安装配置 1.1. 安装准备 1.2. 修改内核参数 1.3. 创建安装用户和目录 1.4. 修改配置文件 1.5. 开始安装 1.5.1. 上传安装包 1.5.2. ...

  2. Linux 图形化和命令行安装达梦数据库

    首先,去官网下载达梦数据库的镜像 下载的是一个压缩包,解压后得到一个镜像文件,把这个镜像文件挂载在/mnt目录下: mount -o loop dm8_20201112_x86_rh7_64_ent_ ...

  3. androidsdktools安装_如何命令行安装Android SDK Build Tools(构建工具)?

    Android构建工具安装的问题 我想从命令行建立Android开发环境,遇到了如下问题: wget http://dl.google.com/android/android-sdk_r22.0.5- ...

  4. Unity3D安装:从命令行安装 Unity

    推荐:将 NSDT场景编辑器 加入你的3D工具链 3D工具集: NSDT简石数字孪生 从命令行安装 Unity 如果要在组织中自动部署 Unity,可以从命令行安装 Editor 和其他组件.这些组件 ...

  5. Linux(centos)命令行安装谷歌浏览器

    1.安装 下载最新版的谷歌浏览器: wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm 安装 ...

  6. Ubuntu18.04安装sagemath(命令行安装,超方便)

    Ubuntu果然是易用的,不像网上那么多编译源码sagemath的教程,直接一行命令就解决! sudo -i apt update apt-get update apt install sagemat ...

  7. linux添加磁盘后进入grub,从硬盘安装 Linux 和从 GRUB 命令行启动操作系统

    标题 +=================================================+ |  从硬盘安装 Linux 和从 GRUB 命令行启动操作系统  | +======== ...

  8. websphere7 linux 命令行安装(静默安装)

    1 登陆root用户,解压该安装包 was.cd.70011.trial.base.opt.linux.ia32.tar.gz 2.编辑配置文件responsefile.nd.txt. respons ...

  9. linux 从命令行启动,硬盘安装Linux和从Grub命令行启动操作系统

    发信人: (飞象过河), 信区: Linux 标 题: 硬盘安装Linux和从Grub命令行启动操作系统 发信站: 瀚海星云 (2004年10月18日22:44:09 星期一), 站内信件 标题 += ...

  10. 安装Linux系统时卡在命令行了,从硬盘安装Linux和从Grub命令行启动操作系统

    从硬盘安装Linux和从Grub命令行启动操作系统 发表于:2007-07-04来源:作者:点击数: 标签: 内容简介 ---------------------------------------- ...

最新文章

  1. 传微软有意收购EA公司,连《绝地求生》的蓝洞也想一并收入囊中
  2. 关于python语言、下列说法不正确的是-关于Python中的字符串,下列说法错误的是()...
  3. antd tree 动态添加_一文了解Matlab如何制作动态图像
  4. 牛人总结python中string模块各属性以及函数的用法,果断转了,好东西
  5. Python Django 参数解包及代码示例
  6. VTK:PolyData之SmoothPolyDataFilter
  7. 100题_08 求1+2+...+n
  8. shell编程最新总结大全
  9. ASP.NET Core 生成验证码
  10. Windows Server 2003 下安装Apache+Php+Mysql
  11. JavaScript学习(八十八)—数组知识点总结,超详细!!!
  12. Silverlight C# 游戏开发:自定义鼠标(一)
  13. python中pass的使用_pass语句如何在Python项目中使用
  14. python数据挖掘orange
  15. 软件测试整理复习(简答题)转载请经由作者同意
  16. Linux/ubuntu AWK / BEGIN / END的用法
  17. java保留字详解_保留字
  18. 网络共享计算机权限访问,访问共享计算机的时候提示没有权限使用网络资源的解决方法...
  19. arduino蓝牙通讯代码_手机与Arduino蓝牙串口通讯实验及完整例程
  20. 免费试用一年微软云服务领取教程

热门文章

  1. java窗口进度条_java进度条窗口具体如何制作?
  2. 下载视频网站中ts格式的视频
  3. 联想计算机wifi卸载,win10联想笔记本电脑wifi功能消失了怎么办
  4. 计算机课禁用监视器,win7系统防止别人偷窥电脑的操作方法
  5. 微型计算机控制赖寿宏pdf,微型计算机控制技术答案(赖寿宏).pdf
  6. Android报错:The processing instruction target matching [xX][mM][lL] is not allowed.
  7. 业余无线电通信_业余电台操作证书查询方式
  8. 汉字Unicode编码规范
  9. RapidXml读取并修改XML文件
  10. PGSQL触发器实例