-
Notifications
You must be signed in to change notification settings - Fork 3
/
iOSAutoPacking.sh
53 lines (45 loc) · 1.21 KB
/
iOSAutoPacking.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!bin/bash
# author: Haocold
# date: 2018-05-09 21:08:12
echo "\n"
echo "============================"
echo "= ="
echo "= iOS Auto Packing ="
echo "= Made by Haocold ="
echo "= 2018-05-09 21:08:12 ="
echo "= ="
echo "============================"
echo ".\n..\n...\nBegin...\n..."
echo "Please input file path...\n..."
echo "File ends with .app...\n..."
echo "It's in 'Products' of your project...\n..."
echo "Drag it into terminal...\n..."
echo "And then press Enter..."
echo ".\n..\n..."
echo "File path is:"
read input
echo ".\n..\n..."
# Create Payload folder.
# %/* : is delete the last path component of 'input'
echo "mkdir 'Payload' folder..."
cd ${input%/*}
mkdir Payload
echo ".\n..\n..."
# Move file to Payload.
echo "copy file..."
app_name=${input##*/} # Demo.app
cp -rf ${app_name} Payload
echo ".\n..\n..."
# Zip Payload.
echo "zip file..."
zip -q -r Payload".zip" Payload
echo ".\n..\n..."
# Rename 'zip' to 'ipa'.
echo "rename 'zip' to 'ipa'..."
app_name=${app_name%.*}".ipa" # Demo.ipa
mv Payload".zip" ${app_name} # Payload.zip -> Demo.ipa
echo ".\n..\n..."
rm -rf Payload
echo "Done!!!"
echo "Find the '${app_name}' file..."
echo "It's it!\n"