(7)theos安装

安装签名工具ldid

  • 先确保安装了brew
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  • 利用brew安装ldid
$ brew install ldid

修改环境变量

  • 编辑用户的配置文件
$ vim ~/.bash_profile
  • .bash_profile文件后面加入以下2行
export THEOS=~/theos
export PATH=$THEOS/bin:$PATH
  • .bash_profile配置的环境变量立即生效(或者重新打开终端)
$ source ~/.bash_profile

下载theos

  • 建议在$THEOS目录下载代码(也就是刚才配置的~/theos
$ git clone --recursive https://github.com/theos/theos.git $THEOS

新建tweak项目

  • cd到一个存放项目代码的文件夹(比如桌面)
$ cd ~/Desktop
$ nic.pl
  • 选择[11.] iphone/tweak

  • 填写项目信息
    • Project Name (项目名称)
    • Package Name(项目ID,可随便写)
    • Author/Maintainer Name
      • 作者
      • 直接回车就行,默认Mac上的用户名
    • [iphone/tweak] MobileSubstrate Bundle filter
      • 需要修改的APP的Bundle identifier
      • 可以通过Cycript查看APP的Bundle identifier
    • [iphone/tweak] List of applications to terminate upon installation
      • 直接回车就行

编辑Makefile

  • 在前面加入环境变量,写清楚通过哪个IP和端口访问手机
    • THEOS_DEVICE_IP
    • THEOS_DEVICE_PORT
export THEOS_DEVICE_IP=127.0.0.1
export THEOS_DEVICE_PORT=10010


include $(THEOS)/makefiles/common.mk

TWEAK_NAME = tingtweak2
tingtweak2_FILES = Tweak.xm

include $(THEOS_MAKE_PATH)/tweak.mk

after-install::
    install.exec "killall -9 SpringBoard"

如果不希望每个项目的Makefile都编写IP和端口环境变量,也可以添加到用户的配置文件中,编辑完毕后$ source ~/.bash_profile(或者重启终端)

$ vim ~/.bash_profile
export THEOS=~/theos
export PATH=$THEOS/bin:$PATH
export THEOS_DEVICE_IP=127.0.0.1
export THEOS_DEVICE_PORT=10010
$ source ~/.bash_profile

编写代码

  • 打开Tweak.xm文件
%hook XMSoundPatchImageView

- (id)initWithFrame:(struct CGRect)arg1{
    return nil;
}

%end

%hook XMAdAnimationViewTwo

- (id)initWithFrame:(struct CGRect)arg1{
    return nil;
}

%end

编译-打包-安装

  • 编译
make
  • 打包成deb
make package
  • 安装
make install

可能遇到的问题

make package的错误
 $ make package
  Can't locate IO/Compress/Lzma.pm in @INC (you may need to install the
  IO::Compress::Lzma module) (@INC contains: /Library/Perl/5.18/darwin-
  thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-
  thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2
  /System/Library/Perl/5.18/darwin-thread-multi-2level
  /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-
  multi-2level /System/Library/Perl/Extras/5.18 .) at
  /Users/mj/theos/bin/dm.pl line 12.
  BEGIN failed--compilation aborted at /Users/mj/theos/bin/dm.pl line 12.
  make: *** [internal-package] Error 2
  • 是因为打包压缩方式有问题,改成gzip压缩就行了
    • 修改dm.pl文件,用#号注释掉下面两句
$ vim $THEOS/vendor/dm.pl/dm.pl
#use IO::Compress::Lzma;
#use IO::Compress::Xz;
  • 修改deb.mk文件第6行的压缩方式为gzip
$ vim $THEOS/makefiles/package/deb.mk
           _THEOS_PLATFORM_DPKG_DEB_COMPRESSION ?= gzip
make的错误
$ make
  Error: You do not have an SDK in
  /Library/Developer/CommandLineTools/Platforms/iPhoneOS.platform/Developer/S
  DKs
  • 是因为多个Xcode导致路径(可能安装了多个xcode),需要指定以下xcode
$ sudo xcode-select --switch
/Applications/Xcode.app/Contents/Developer/
  • 之前编译过,有会有以下提示
$ make
  > Making all for tweak xxx...
  make[2]: Nothing to be done for `internal-library-compile'. 

这是因为缓存导致的,但是不影响操作,如需出现原来的打印,可以clean一下

$ make clean
$ make
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是一个可以用于自动安装CentOS7系统的kickstart文件示例: ``` #version=DEVEL # System language lang en_US # Language modules to install langsupport --default=en_US # System keyboard keyboard us # System timezone timezone Asia/Shanghai --isUtc # Root password rootpw --iscrypted $6$y8Ls6SxYJLgU2X9$4XsLjF0HJ8aG5L8XmKZAK5LJmZi/DW3.7q3qXw3m9WdWvTTXw7JhHE8rD1BtOyJdSb9yQ7oRwkZxkLcFh1vP1 # Network information network --bootproto=dhcp --device=eth0 --onboot=yes --noipv6 --hostname=localhost.localdomain # Firewall configuration firewall --disabled # Run the Setup Agent on first boot firstboot --disable # SELinux configuration selinux --disabled # Install OS instead of upgrade install # Use network installation url --url=http://mirrors.aliyun.com/centos/7/os/x86_64/ # Root filesystem partitioning ignoredisk --only-use=sda autopart --type=lvm # System bootloader configuration bootloader --location=mbr --boot-drive=sda # Clear the Master Boot Record zerombr # Do not configure the X Window System skipx # Enable installation of all languages skiplocales # Reboot after installation reboot # Package installation %packages --nobase @core kexec-tools ``` 这个kickstart文件做的事情: 1. 设置系统语言为英文。 2. 安装英文语言支持。 3. 设置键盘为美式英语。 4. 设置时区为亚洲上海,并将其设置为UTC时间。 5. 设置root密码。 6. 配置网络,使用dhcp自动获取IP地址。 7. 禁用防火墙。 8. 禁用SELinux。 9. 安装操作系统。 10. 使用阿里云的CentOS7源进行安装。 11. 使用LVM分区方案。 12. 配置引导程序的安装位置。 13. 清除主引导记录。 14. 不需要安装X Window System。 15. 安装所有语言支持。 16. 安装core和kexec-tools两个包。 17. 安装完成后自动重启系统。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值