-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathregenerate.sh
50 lines (39 loc) · 1.39 KB
/
regenerate.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
#!/bin/bash
echo "Type the path to the json file of apps you want to generate"
read -er config
echo "Generating push certificates for file at "$config""
echo "Enter your developer center email/username"
read -er username
echo "Type a password to protect your generated .p12 files with"
read -er password
if [[ -z $password ]]; then
echo Please provide a password using the -p flag to protect your generated .p12 file
exit 1
fi
if [[ -z $config ]]; then
echo Please provide the path to the apps you want to generate push certs for using the -a flag
exit 1
fi
numberOfApps=$(jq '.apps | length' $config)
configTeam=$(jq '.teamID' $config -r)
echo "Generating push certificates with default team: "$configTeam""
if [ ! -d "./generated" ]; then
mkdir -p "./generated";
fi
APPCOUNTER=0
while [ $APPCOUNTER -lt $numberOfApps ];
do
bundleID=$(jq ".apps[$APPCOUNTER].bundleID" $config -r);
name=$(jq ".apps[$APPCOUNTER].name" $config -r);
overrideTeamId=$(jq ".apps[$APPCOUNTER].teamID" $config -r);
if [ "$overrideTeamId" != "null" ]; then configTeam=$overrideTeamId; else echo "No team override provided"; fi
mkdir -p "./generated/$name/Live";
cd "./generated/$name/Live"
if [ "$configTeam" == '' ]; then
pem --force -a $bundleID -u $username -p $password
else
pem --force -a $bundleID -u $username -p $password -b $configTeam
fi
cd "../../../"
let APPCOUNTER=APPCOUNTER+1;
done