This repository has been archived by the owner on Jan 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
preinst
executable file
·47 lines (40 loc) · 1.57 KB
/
preinst
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
#!/bin/bash
set -e
# fix my broken logic from 2.0b2…
if [[ -h /Library/TypeStatus/TypeStatus ]]; then
rm /Library/TypeStatus/TypeStatus
fi
# delete a broken symlink if necessary
if [[ -h /Library/TypeStatus && "$(readlink -q /Library/TypeStatus)" == "" ]]; then
rm /Library/TypeStatus
fi
# if the providers directory doesn’t exist yet
if [[ ! -d /usr/lib/TypeStatus/Providers ]]; then
# if /Library/TypeStatus is a symlink, just copy the symlink. easy
if [[ -h /Library/TypeStatus ]]; then
cp /Library/TypeStatus /usr/lib/TypeStatus
else
# stash /usr/lib/TypeStatus if necessary
if [[ -x /usr/libexec/cydia/move.sh ]]; then
bash /usr/libexec/cydia/move.sh /usr/lib/TypeStatus
else
mkdir -p /usr/lib/TypeStatus
fi
# if there are providers in the old location, move them. otherwise, create an empty dir
if [[ -d /Library/TypeStatus/Providers ]]; then
mv /Library/TypeStatus/Providers /usr/lib/TypeStatus/Providers
else
mkdir -p /usr/lib/TypeStatus/Providers
fi
fi
fi
# if /Library/TypeStatus isn’t a symlink, make it be one now
if [[ ! -h /Library/TypeStatus && ! -d /Library/TypeStatus ]]; then
ln -s /usr/lib/TypeStatus /Library/TypeStatus
fi
# if the framework leads to the wrong place, fix it (why does this happen?)
fw_link="$(readlink -q /Library/Frameworks/TypeStatusProvider.framework || true)"
if [[ "$fw_link" == "" || "$fw_link" == "/usr/lib/TypeStatus/TypeStatusProvider.framework" ]]; then
rm -rf /Library/Frameworks/TypeStatusProvider.framework
ln -s /usr/lib/TypeStatusProvider.framework /Library/Frameworks/TypeStatusProvider.framework
fi