forked from sunnyyoung/WeChatTweak-macOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (54 loc) · 1.73 KB
/
Makefile
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
57
58
59
APP_PATH=/Applications/WeChat.app/Contents/MacOS
APP_NAME=WeChat
BACKUP_NAME=WeChat.bak
FRAMEWORK_PATH=WeChatTweak.framework
FRAMEWORK_NAME=WeChatTweak
DYLIB_NAME=WeChatTweak.dylib
debug::
DYLD_INSERT_LIBRARIES=${FRAMEWORK_PATH}/${FRAMEWORK_NAME} ${APP_PATH}/${APP_NAME} &
install::
@if ! [[ $EUID -eq 0 ]]; then\
echo "This script should be run using sudo or as the root user.";\
exit 1;\
fi
@if ! [ -f "${APP_PATH}/${APP_NAME}" ]; then\
echo "Can not find the WeChat.";\
exit 1;\
fi
@if ! [ -d "${FRAMEWORK_PATH}" ]; then\
echo "Can not find the framework, please build first.";\
exit 1;\
fi
@if [ -f "${APP_PATH}/${DYLIB_NAME}" ]; then\
echo "You're using old version tweak, please uninstall first.";\
exit 1;\
fi
@if [ -d "${APP_PATH}/${FRAMEWORK_PATH}" ]; then\
rm -rf ${APP_PATH}/${FRAMEWORK_PATH};\
cp -R ${FRAMEWORK_PATH} ${APP_PATH};\
echo "Framework found! Replace with new framework successfully!";\
else \
cp ${APP_PATH}/${APP_NAME} ${APP_PATH}/${BACKUP_NAME};\
cp -R ${FRAMEWORK_PATH} ${APP_PATH};\
./insert_dylib @executable_path/${FRAMEWORK_PATH}/${FRAMEWORK_NAME} ${APP_PATH}/${APP_NAME} ${APP_PATH}/${APP_NAME} --all-yes;\
echo "Install successfully!";\
fi
uninstall::
@if ! [[ $EUID -eq 0 ]]; then\
echo "This script should be run using sudo or as the root user.";\
exit 1;\
fi
@if ! [ -f "${APP_PATH}/${APP_NAME}" ]; then\
echo "Can not find the WeChat.";\
exit 1;\
fi
@if ! [ -f "${APP_PATH}/${BACKUP_NAME}" ]; then\
echo "Can not find the WeChat backup file.";\
exit 1;\
fi
@rm -rf ${APP_PATH}/${DYLIB_NAME};
@rm -rf ${APP_PATH}/${FRAMEWORK_PATH};
@mv ${APP_PATH}/${BACKUP_NAME} ${APP_PATH}/${APP_NAME};
@echo "Uninstall successfully";
clean::
rm -rf ${FRAMEWORK_PATH}