-
Notifications
You must be signed in to change notification settings - Fork 11
/
utils.sh
56 lines (46 loc) · 1.25 KB
/
utils.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
54
55
56
#!/bin/bash -ex
delete_file_or_dir() {
local target=$1
if [ -e "$target" ]; then
if [ -d "$target" ]; then
rm -rf "$target"
echo "Directory deleted: $target"
else
rm "$target"
echo "File deleted: $target"
fi
else
echo "Error: $target does not exist."
fi
}
process_plist() {
local plist_path="$1"
if [ -z "$plist_path" ]; then
echo "Error: Plist file path is not provided."
return 1
fi
if [ ! -f "$plist_path" ]; then
echo "Error: Plist file does not exist at path: $plist_path"
return 1
fi
echo "Converting plist to XML format..."
plutil -convert xml1 "$plist_path" 2>/dev/null
echo "Linting plist file..."
plutil -lint "$plist_path" 2>/dev/null
if [ $? -eq 0 ]; then
echo "Plist file processed successfully."
else
echo "Error occurred while processing plist file."
return 2
fi
}
notarize_app() {
local target=$1
if [ ! -f "$target" ]; then
echo "Error: $target does not exist."
exit 1
fi
xcrun notarytool submit $target --apple-id "***@***" \
--team-id "******" --password "******" --wait
xcrun stapler staple $target
}