/
Creating a patch.patch
97 lines (71 loc) · 4.89 KB
/
Creating a patch.patch
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
AUTHOR=Ricky Divjakovski
VERSION=1.4
DESCRIPTION=How to create a patch file
# Lines beginning with # will be ignores
# Code is delimited by the | (pipeline) character
# Assume you are in the root(/) of the device
# This will output text to the patch output window - WriteLine|OUTPUTTEXT
# WriteLine|Hi, this is my first patch
# This checks if the patch is being installed to the correct platform (Amlgic, Rockchip or Allwinner)
# If not the script will not run
# Platform|Amlogic
# This will instantaneously end a script with output to the patch output window (use with IfExists or IfContains) - EndScript|FAILED/SUCCESS|OUTPUTTEXT
# IfFileNotExists|/level2/system/build.prop2
# EndScript|FAILED|Build.prop2 was not found
# IfFileExists|/level2/system/build.prop
# EndScript|SUCCESS|Build.prop was already found
# This function will recursively search and delete a file - SearchDeleteFile|SEARCH STRING
# SearchDeleteFile|/level2/level2/system|*netflix*.apk
# This function will recursively search and delete a directory - SearchDeleteDir|SEARCH STRING
# SearchDeleteDir|/level2/system|priv*app
# This function will delete a specific file - DeleteFile|FILE PATH
# DeleteFile|/level2/system/preinstall/weather.apk
# This function will delete a specific directory - DeleteDir|DIR PATH
# DeleteDir|/level2/system/preinstall/app
# This function will copy a file from one location to another - CopyFile|FILE TO COPY|DESTINATION FILE|Overwrite(Y/N)
# CopyFile|/level2/system/preinstall/netflix.apk|/level2/system/app/netflix.apk|Y
# This function will copy a directory from one location to another - CopyDir|FILE TO COPY|DESTINATION DIR|Overwrite(Y/N)
# CopyDir|/level2/system/preinstall|/level2/system/app/AnotherPreinstall|Y
# This function will move a file from one location to another - MoveFile|FILE TO COPY|DESTINATION FILE|Overwrite(Y/N)
# MoveFile|/level2/system/preinstall/netflix.apk|/level2/system/app/netflix.apk|Y
# This function will move a directory from one location to another - MoveDir|FOLDER TO COPY|DESTINATION DIR|Overwrite(Y/N)
# MoveDir|/level2/system/preinstall|/level2/system/app/OldPreinstall|Y
# This function will create a new file - CreateFile|FILE TO COPY|DESTINATION FILE
# CreateFile|/level2/system/MyNewFile.txt
# This function will create a new directory - CreateDir|DESTINATION FILE|Overwrite(Y/N)
# CreateDir|/level2/system/MyNewDir
# This function will append text to a file - AppendFile|FILE TO APPEND|TEXT TO APPEND
# Note, \n will be replaced with the new line character
# AppendFile|/level2/system/build.prop|\n# MyNewProperty=1
# This function will replace a line in a file - ReplaceText|FILE|SEARCH POSITION|SEARCH STRING|REPLACEMENT LINE
# START will search for text at the start of a line, END will search for text at the end of a line, CONTAINS will search for text anywhere in the line
# Note, \n will be replaced with the new line character
# Examples below will edit ro.service.bootvideo=1 in /system/build.prop
# ReplaceLine|/level2/system/build.prop|START|beo|ro.service.bootvideo=1
# ReplaceLine|/level2/system/build.prop|END|deo=999999999|ro.service.bootvideo=1\n# line after
# ReplaceLine|/level2/system/build.prop|CONTAINS|oodeo|ro.service.bootvideo=1
# This function will replace text in a file - ReplaceText|FILE|SEARCH STRING|REPLACEMENT
# Note, \n will be replaced with the new line character
# ReplaceText|/level2/system/build.prop|bootvideo|bootanimation
# This function will download a file - Download|OUTPUT FILE|Overwrite if exists(Y/N)|DIRECT DL LINK
# Download|/level2/system/app/netflix.apk|Y|https://direct.download.link
# This function will unzip a file into the directory specified - Unzip|ZIPFILE|OUTPUT directory
# Unzip|/system/text.zip|/system
# This function will check if a file exists, if so it will run the next line of code - IfFileExists|FILENAME
# IfFilexists|/level2/system/build.prop
# CreateFile|/level2/system/MyNewFile.txt
# This function will check if a directory exists, if so it will run the next line of code - IfDirExists|DIRNAME
# IfDirExists|/level2/system/build.prop
# CreateFile|/level2/system/MyNewDir
# This function will check if a file does not exists, if it doesnt it will run the next line of code - IfFileNotExists|FILENAME
# IfFileNotxists|/level2/system/build.prop
# CreateFile|/level2/system/MyNewFile.txt
# This function will check if a directory does not exists, if it doesnt it will run the next line of code - IfDirNotExists|DIRNAME
# IfDirNotExists|/level2/system/build.prop
# CreateFile|/level2/system/MyNewDir
# This function will check if a file contains text, if so it will run the next line of code - IfContains|FILENAME|PHRASE
# IfContains|/level2/system/build.prop|ro.build.version.release=9.0
# CreateFile|/system/WeAreAndroid9
# This function will check if a file does not contain text, if not it will run the next line of code - IfNotContains|FILENAME|PHRASE
# IfContains|/level2/system/build.prop|ro.build.version.release=9.0
# CreateFile|/level2/system/WeAreAndroid9