diff --git a/README.md b/README.md index 6392387..8dfaefe 100644 --- a/README.md +++ b/README.md @@ -21,20 +21,7 @@ ### 配置 theos ``` -sudo git clone --recursive https://github.com/theos/theos.git /opt/theos -``` - -打开 `~/.bash_profile`,末尾加入 - -``` -export THEOS=/opt/theos -export PATH=/opt/theos/bin/:$PATH -``` - -刷新生效 - -``` -source ~/.bash_profile +bash -c "$(curl -fsSL https://raw.githubusercontent.com/theos/theos/master/bin/install-theos)" ``` 遇到问题,请参考 [theos](https://github.com/theos/theos/wiki/Installation) 安装文档。 @@ -42,7 +29,7 @@ source ~/.bash_profile ### 配置 EasyDev ``` -sudo git clone --recursive https://github.com/lemon4ex/EasyDev.git /opt/EasyDev +git clone --recursive https://github.com/lemon4ex/EasyDev.git ~/EasyDev ``` ### 配置 ldid @@ -51,13 +38,13 @@ sudo git clone --recursive https://github.com/lemon4ex/EasyDev.git /opt/EasyDev brew install ldid ``` -`/opt/EasyDev/bin`目录内已自带,也可不安装。 +`~/EasyDev/bin`目录内已自带,也可不安装。 ### 配置免密码登录越狱设备 ``` ssh-keygen -t rsa -P '' -ssh-copy-id -i /Users/username/.ssh/id_rsa root@ip +ssh-copy-id -i ~/.ssh/id_rsa root@ip ``` 如果没有越狱设备,可跳过。 @@ -79,14 +66,14 @@ xcode-select -p 执行安装命令: ``` -cd /opt/EasyDev/bin +cd ~/EasyDev/bin chmod +x ed-install ./ed-install ``` ### 卸载 ``` -cd /opt/EasyDev/bin +cd ~/EasyDev/bin chmod +x ed-uninstall ./ed-uninstall ``` diff --git a/bin/createIPA.command b/bin/createIPA.command index 51223b1..39bc551 100755 --- a/bin/createIPA.command +++ b/bin/createIPA.command @@ -1,7 +1,7 @@ #!/bin/bash DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -if [[ ${DIR} = "/opt/EasyDev/bin" ]]; then +if [[ ${DIR} = "~/EasyDev/bin" ]]; then DIR="$PWD" fi diff --git a/bin/ed b/bin/ed index 7e8805d..6fa1ded 100755 --- a/bin/ed +++ b/bin/ed @@ -3,14 +3,18 @@ export setCmd="set -eo pipefail" $setCmd -export PATH=/opt/EasyDev/bin:$EasyDevTheosPath/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin:$PATH +export userName="${SUDO_USER-$USER}" +export userGroup=`id -g $userName` +export userHome=`eval echo ~$userName` + +export PATH=$userHome/EasyDev/bin:$EasyDevTheosPath/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin:$PATH export scriptName="${0##*/}" export scriptVer="2.0" export originalArguments=("$@") export activeActionArg -export EasyDevPath="/opt/EasyDev" +export EasyDevPath="$userHome/EasyDev" #默认设备ip export DefaultDeviceIP="localhost" #默认端口号 @@ -18,9 +22,6 @@ export DefaultDevicePort="2222" export DefaultDeviceBuildsDir="/var/root/EasyDevBuilds" -export userName="${SUDO_USER-$USER}" -export userGroup=`id -g $userName` -export userHome=`eval echo ~$userName` export bashProfileFiles=("$userHome/.zshrc" "$userHome/.bash_profile" "$userHome/.bashrc" "$userHome/.bash_login" "$userHome/.profile") export tempDirsFile="`mktemp -d -t $scriptName`/tempdirs" diff --git a/bin/ed-install b/bin/ed-install index a24f32b..423ade0 100755 --- a/bin/ed-install +++ b/bin/ed-install @@ -5,22 +5,22 @@ export setCmd="set -eo pipefail" $setCmd +#获取用户名、用户组、用户目录、和profile文件 +export userName="${SUDO_USER-$USER}" +export userGroup=$(id -g $userName) +export userHome=$(eval echo ~$userName) + #导出环境变量 -export PATH=/opt/EasyDev/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin:$PATH +export PATH=$userHome/EasyDev/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin:$PATH #脚本名称和版本 export scriptName="${0##*/}" export scriptVer="2.0" #本地存储文件的目录 -export EasyDevPath="/opt/EasyDev" +export EasyDevPath="$userHome/EasyDev" export backupFileExt=".EasyDev" -#获取用户名、用户组、用户目录、和profile文件 -export userName="${SUDO_USER-$USER}" -export userGroup=$(id -g $userName) -export userHome=$(eval echo ~$userName) - #用户可能存在的profile文件 export bashProfileFiles=("$userHome/.zshrc" "$userHome/.bash_profile" "$userHome/.bashrc" "$userHome/.bash_login" "$userHome/.profile") @@ -286,7 +286,7 @@ function versionGe() { } # start it -# 创建/opt/EasyDev +# 创建~/EasyDev mkdir -p "$EasyDevPath" || panic $? "Failed to make directory: $EasyDevPath" @@ -294,6 +294,14 @@ mkdir -p "$EasyDevPath" || # downloadGithubTarball "https://codeload.github.com/AloneMonkey/EasyDev/tar.gz/master" "$EasyDevPath" "EasyDev base" # downloadGithubTarball "https://codeload.github.com/AloneMonkey/EasyDev-Xcode-Templates/tar.gz/master" "$EasyDevPath/templates" "Xcode templates" +#替换模板环境变量 +echo "Replace template environment variables..." + +find $EasyDevPath/templates -name "TemplateInfo.plist" | while read -r file; do + sed -i '' -e "s|\${EasyDevPath}|${EasyDevPath}|g" "$file" + sed -i '' -e "s|\${THEOS}|${THEOS}|g" "$file" +done + #创建符号链接 echo "Creating symlink to Xcode templates..." diff --git a/bin/ed-uninstall b/bin/ed-uninstall index 85ecb6a..ebcaef6 100755 --- a/bin/ed-uninstall +++ b/bin/ed-uninstall @@ -3,17 +3,18 @@ export setCmd="set -eo pipefail" $setCmd -export PATH=/opt/EasyDev/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin:$PATH +export userName="${SUDO_USER-$USER}" +export userGroup=`id -g $userName` +export userHome=`eval echo ~$userName` + +export PATH=$userHome/EasyDev/bin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin:$PATH export scriptName="${0##*/}" export scriptVer="2.0" -export EasyDevPath="/opt/EasyDev" +export EasyDevPath="$userHome/EasyDev" export backupFileExt=".EasyDev" -export userName="${SUDO_USER-$USER}" -export userGroup=`id -g $userName` -export userHome=`eval echo ~$userName` export bashProfileFiles=("$userHome/.zshrc" "$userHome/.bash_profile" "$userHome/.bashrc" "$userHome/.bash_login" "$userHome/.profile") export tempDirsFile="`mktemp -d -t $scriptName`/tempdirs" diff --git a/templates/Base.xctemplate/TemplateInfo.plist b/templates/Base.xctemplate/TemplateInfo.plist index 5651e45..0b24308 100644 --- a/templates/Base.xctemplate/TemplateInfo.plist +++ b/templates/Base.xctemplate/TemplateInfo.plist @@ -61,7 +61,7 @@ ENABLE_BITCODE NO EasyDevTheosPath - /opt/theos + ${THEOS} TARGETED_DEVICE_FAMILY 1,2 GCC_WARN_UNDECLARED_SELECTOR @@ -81,7 +81,7 @@ LIBRARY_SEARCH_PATHS $(inherited) $(EasyDevPath)/lib $(EasyDevTheosPath)/lib $(EasyDevTheosPath)/vendor/lib EasyDevPath - /opt/EasyDev + ${EasyDevPath} IPHONEOS_DEPLOYMENT_TARGET 8.0 FRAMEWORK_SEARCH_PATHS @@ -173,7 +173,7 @@ Definitions *:*:importTheosPrefix - #import "/opt/theos/Prefix.pch" //path/to/theos/Prefix.pch + #import "${THEOS}/Prefix.pch" //path/to/theos/Prefix.pch *:comments // // ___FILENAME___ diff --git a/templates/CaptainHook Tweak.xctemplate/TemplateInfo.plist b/templates/CaptainHook Tweak.xctemplate/TemplateInfo.plist index 05c4e89..2ac0135 100644 --- a/templates/CaptainHook Tweak.xctemplate/TemplateInfo.plist +++ b/templates/CaptainHook Tweak.xctemplate/TemplateInfo.plist @@ -51,7 +51,7 @@ ShellScript - /opt/EasyDev/bin/ed --xcbp + ${EasyDevPath}/bin/ed --xcbp ShellPath /bin/sh RunOnlyForDeploymentPostprocessing diff --git a/templates/Cocoa App Plugin.xctemplate/TemplateInfo.plist b/templates/Cocoa App Plugin.xctemplate/TemplateInfo.plist index 0272d74..e7d02ba 100644 --- a/templates/Cocoa App Plugin.xctemplate/TemplateInfo.plist +++ b/templates/Cocoa App Plugin.xctemplate/TemplateInfo.plist @@ -102,7 +102,7 @@ ShellPath /bin/sh ShellScript - /opt/EasyDev/tools/pack-osx.sh + ${EasyDevPath}/tools/pack-osx.sh Class @@ -126,7 +126,7 @@ ShellPath /bin/sh ShellScript - /opt/EasyDev/tools/pack-osx.sh codesign + ${EasyDevPath}/tools/pack-osx.sh codesign TargetIdentifier diff --git a/templates/Cocoa CaptainHook Tweak.xctemplate/TemplateInfo.plist b/templates/Cocoa CaptainHook Tweak.xctemplate/TemplateInfo.plist index f89cb64..0ffe956 100644 --- a/templates/Cocoa CaptainHook Tweak.xctemplate/TemplateInfo.plist +++ b/templates/Cocoa CaptainHook Tweak.xctemplate/TemplateInfo.plist @@ -37,7 +37,7 @@ ENABLE_BITCODE NO EasyDevTheosPath - /opt/theos + ${THEOS} GCC_WARN_UNDECLARED_SELECTOR NO GCC_WARN_ABOUT_MISSING_PROTOTYPES @@ -55,7 +55,7 @@ LIBRARY_SEARCH_PATHS $(inherited) $(EasyDevPath)/lib $(EasyDevTheosPath)/lib $(EasyDevTheosPath)/vendor/lib EasyDevPath - /opt/EasyDev + ${EasyDevPath} MACOSX_DEPLOYMENT_TARGET 10.9 FRAMEWORK_SEARCH_PATHS @@ -77,7 +77,7 @@ ShellScript - /opt/EasyDev/bin/ed --xcbp + ${EasyDevPath}/bin/ed --xcbp ShellPath /bin/sh RunOnlyForDeploymentPostprocessing diff --git a/templates/Cocoa Logos Tweak.xctemplate/TemplateInfo.plist b/templates/Cocoa Logos Tweak.xctemplate/TemplateInfo.plist index 4318746..ce68cf9 100644 --- a/templates/Cocoa Logos Tweak.xctemplate/TemplateInfo.plist +++ b/templates/Cocoa Logos Tweak.xctemplate/TemplateInfo.plist @@ -37,7 +37,7 @@ ENABLE_BITCODE NO EasyDevTheosPath - /opt/theos + ${THEOS} GCC_WARN_UNDECLARED_SELECTOR NO GCC_WARN_ABOUT_MISSING_PROTOTYPES @@ -55,7 +55,7 @@ LIBRARY_SEARCH_PATHS $(inherited) $(EasyDevPath)/lib $(EasyDevTheosPath)/lib $(EasyDevTheosPath)/vendor/lib EasyDevPath - /opt/EasyDev + ${EasyDevPath} MACOSX_DEPLOYMENT_TARGET 10.9 FRAMEWORK_SEARCH_PATHS @@ -65,7 +65,7 @@ ShellScript - /opt/EasyDev/bin/ed --xcbp-logos + ${EasyDevPath}/bin/ed --xcbp-logos ShellPath /bin/sh RunOnlyForDeploymentPostprocessing @@ -87,7 +87,7 @@ ShellScript - /opt/EasyDev/bin/ed --xcbp + ${EasyDevPath}/bin/ed --xcbp ShellPath /bin/sh RunOnlyForDeploymentPostprocessing diff --git a/templates/Cocoa Touch Library.xctemplate/TemplateInfo.plist b/templates/Cocoa Touch Library.xctemplate/TemplateInfo.plist index f881a48..61ed6d6 100644 --- a/templates/Cocoa Touch Library.xctemplate/TemplateInfo.plist +++ b/templates/Cocoa Touch Library.xctemplate/TemplateInfo.plist @@ -27,9 +27,9 @@ GCC_PRECOMPILE_PREFIX_HEADER YES EasyDevPath - /opt/EasyDev + ${EasyDevPath} EasyDevTheosPath - /opt/theos + ${THEOS} BuildPhases @@ -47,7 +47,7 @@ ShellScript - /opt/EasyDev/bin/ed --xcbp + ${EasyDevPath}/bin/ed --xcbp ShellPath /bin/sh RunOnlyForDeploymentPostprocessing diff --git a/templates/Debian Command-line Tool.xctemplate/TemplateInfo.plist b/templates/Debian Command-line Tool.xctemplate/TemplateInfo.plist index 0c19c92..298e2f7 100644 --- a/templates/Debian Command-line Tool.xctemplate/TemplateInfo.plist +++ b/templates/Debian Command-line Tool.xctemplate/TemplateInfo.plist @@ -52,7 +52,7 @@ ShellScript - /opt/EasyDev/bin/ed --xcbp + ${EasyDevPath}/bin/ed --xcbp ShellPath /bin/sh RunOnlyForDeploymentPostprocessing diff --git a/templates/Logos Tweak.xctemplate/TemplateInfo.plist b/templates/Logos Tweak.xctemplate/TemplateInfo.plist index a76bc10..9c48023 100644 --- a/templates/Logos Tweak.xctemplate/TemplateInfo.plist +++ b/templates/Logos Tweak.xctemplate/TemplateInfo.plist @@ -39,7 +39,7 @@ ShellScript - /opt/EasyDev/bin/ed --xcbp-logos + ${EasyDevPath}/bin/ed --xcbp-logos ShellPath /bin/sh RunOnlyForDeploymentPostprocessing @@ -61,7 +61,7 @@ ShellScript - /opt/EasyDev/bin/ed --xcbp + ${EasyDevPath}/bin/ed --xcbp ShellPath /bin/sh RunOnlyForDeploymentPostprocessing diff --git a/templates/PreferenceLoader Bundle.xctemplate/TemplateInfo.plist b/templates/PreferenceLoader Bundle.xctemplate/TemplateInfo.plist index d088e6e..34f496a 100644 --- a/templates/PreferenceLoader Bundle.xctemplate/TemplateInfo.plist +++ b/templates/PreferenceLoader Bundle.xctemplate/TemplateInfo.plist @@ -40,7 +40,7 @@ ShellScript - /opt/EasyDev/bin/ed --xcbp + ${EasyDevPath}/bin/ed --xcbp ShellPath /bin/sh RunOnlyForDeploymentPostprocessing diff --git a/templates/XPC Service.xctemplate/TemplateInfo.plist b/templates/XPC Service.xctemplate/TemplateInfo.plist index 0c611f9..2aafcd5 100644 --- a/templates/XPC Service.xctemplate/TemplateInfo.plist +++ b/templates/XPC Service.xctemplate/TemplateInfo.plist @@ -53,7 +53,7 @@ ShellScript - /opt/EasyDev/bin/ed --xcbp + ${EasyDevPath}/bin/ed --xcbp ShellPath /bin/sh RunOnlyForDeploymentPostprocessing diff --git a/templates/iOS App Plugin.xctemplate/TemplateInfo.plist b/templates/iOS App Plugin.xctemplate/TemplateInfo.plist index 013035f..73bd52b 100644 --- a/templates/iOS App Plugin.xctemplate/TemplateInfo.plist +++ b/templates/iOS App Plugin.xctemplate/TemplateInfo.plist @@ -102,7 +102,7 @@ ShellPath /bin/sh ShellScript - /opt/EasyDev/tools/pack-ios.sh + ${EasyDevPath}/tools/pack-ios.sh Class @@ -126,7 +126,7 @@ ShellPath /bin/sh ShellScript - /opt/EasyDev/tools/pack-ios.sh codesign + ${EasyDevPath}/tools/pack-ios.sh codesign TargetIdentifier diff --git a/tools/pack-ios.sh b/tools/pack-ios.sh index 23d073d..80095c0 100755 --- a/tools/pack-ios.sh +++ b/tools/pack-ios.sh @@ -1,4 +1,4 @@ -EASYDEV_PATH="/opt/EasyDev" +EASYDEV_PATH="~/EasyDev" # temp path TEMP_PATH="${SRCROOT}/${TARGET_NAME}/tmp" diff --git a/tools/pack-osx.sh b/tools/pack-osx.sh index 4ca94e1..712a082 100755 --- a/tools/pack-osx.sh +++ b/tools/pack-osx.sh @@ -1,4 +1,4 @@ -EASYDEV_PATH="/opt/EasyDev" +EASYDEV_PATH="~/EasyDev" # temp path TEMP_PATH="${SRCROOT}/${TARGET_NAME}/tmp"