-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
53 lines (48 loc) · 1.59 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
APP_PATH=/Applications/企业微信.app/Contents/MacOS
APP_NAME=企业微信
BACKUP_NAME=企业微信.bak
FRAMEWORK_PATH=WEWTweak.framework
FRAMEWORK_NAME=WEWTweak
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 ${APP_NAME}.";\
exit 1;\
fi
@if ! [ -d "${FRAMEWORK_PATH}" ]; then\
echo "⚠️ Can not find ${FRAMEWORK_PATH}, please build first.";\
exit 1;\
fi
@if [ -d "${APP_PATH}/${FRAMEWORK_PATH}" ]; then\
rm -rf ${APP_PATH}/${FRAMEWORK_PATH};\
cp -R ${FRAMEWORK_PATH} ${APP_PATH};\
echo "✅ Replaced the old framework with the new one, install success.";\
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 success.";\
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 ${APP_NAME}.";\
exit 1;\
fi
@if ! [ -f "${APP_PATH}/${BACKUP_NAME}" ]; then\
echo "😢 Can not find ${BACKUP_NAME}.";\
exit 1;\
fi
@rm -rf ${APP_PATH}/${FRAMEWORK_PATH};
@mv ${APP_PATH}/${BACKUP_NAME} ${APP_PATH}/${APP_NAME};
@echo "✅ Uninstall success";
clean::
rm -rf ${FRAMEWORK_PATH}