-
Notifications
You must be signed in to change notification settings - Fork 12
/
update
executable file
·207 lines (199 loc) · 6.07 KB
/
update
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
#!/usr/local/bin/tt++
#EVENT {PROGRAM START}
{
#info system save;
#script {dir} {ls -d archive};
#if {&dir[] == 0}
{
#system mkdir archive;
#showme {<ffa>Created the <afa>archive<ffa> folder.}
};
#script {dir} {ls -d archive/bin};
#if {&dir[] == 0}
{
#system mkdir archive/bin;
#showme {<ffa>Created the <afa>archive/bin<ffa> folder.}
};
#draw {light orange} box 0 1 3 50 {<afa>TinTin++ $info[SYSTEM][CLIENT_VERSION] beta updater.};
#switch {{%3}}
{
#case {{adi}}
{
adi
};
#case {{archive}}
{
archive
};
#case {{download}}
{
download
};
#case {{install}}
{
install
};
#case {{history}}
{
history
};
#case {{revert}}
{
revert
};
#default
{
#draw {light orange} box 0 1 8 50 {<ffa><afa> adi<ffa>: archive + download + install}{<ffa><afa> archive<ffa>: archive current source and binary}{<ffa><afa>download<ffa>: download the beta source code}{<ffa><afa> install<ffa>: install downloaded source code}{<ffa><afa> history<ffa>: history of compiled binaries}{<afa><afa> revert<ffa>: revert to an archived binary}
}
}
}
#ALIAS {adi}
{
archive;
download;
install
}
#ALIAS {archive}
{
#script {file} {ls -l --time-style=full-iso tintin-beta.tar.gz};
#script {exec} {ls -l --time-style=full-iso tt/src/tt++};
#showme {};
#if {&file[]}
{
#regexp {$file[1]} {%d-%d-%d %d:%d:%d}
{
#var date {&1-&2-&3_&4:&5:&6};#system mv tintin-beta.tar.gz archive/${date}_tintin-beta.tar.gz;#showme {};#showme {<ffa>Archiving <afa>tintin-beta.tar.gz<ffa> dated <afa>$date}
}
};
#else
{
#showme {<ffa>No archivable sourcecode found.}
};
#if {&exec[]}
{
#regexp {$exec[1]} {%d-%d-%d %d:%d:%d}
{
#var date {&1-&2-&3_&4:&5:&6};#system mv tt/src/tt++ archive/bin/${date}_tt++;#showme {<ffa>Archiving <afa>tt++ executable <ffa> dated <afa>$date};
}
};
#else
{
#showme {<ffa>No archivable binaries found.}
}
}
#ALIAS {download}
{
archive;
#showme {};
#showme {<ffa>Retrieving <afa>tintin-beta.tar.gz<ffa> from <afa>https://mudhalla.net};
#system {wget https://mudhalla.net/tintin-beta.tar.gz};
#script {file} {ls -l --time-style=full-iso tintin-beta.tar.gz};
#if {&file[]}
{
#regexp {$file[1]} {%d-%d-%d %d:%d:%d}
{
#var date {&1-&2-&3_&4:&5:&6};#system cp tintin-beta.tar.gz archive/${date}_tintin-beta.tar.gz;#showme {};#showme {<ffa>Retrieved <afa>tintin-beta.tar.gz<ffa> dated <afa>$date}
};
#else
{
#showme {<ffa>Retrieved <afa>tintin-beta.tar.gz<ffa> dated <faa>unknown date}
}
};
#else
{
#showme {<ffa>Failed to retrieve <afa>tintin-beta.tar.gz<ffa> <faa>file not found};
#return
}
}
#ALIAS {install}
{
#showme {<ffa>Building <afa>TinTin++<ffa>, please remain seated.};
#script {file} {ls tt/src/Makefile.in};
#if {&file[]}
{
#system {cp tt/src/Makefile.in tt/src/Makefile.bak}
};
#system {tar -zxf tintin-beta.tar.gz};
#script {diff} {diff tt/src/Makefile.in tt/src/Makefile.bak};
#script {file} {ls tt/src/Makefile};
#if {&diff[] == 0 && &file[]}
{
#showme {<ffa>Reconfiguration unnecessary.};
#system {cd tt/src/;touch Makefile;make install}
};
#else
{
#showme {<ffa>Reconfiguration necessary.};
#system {cd tt/src/;./configure;make install}
};
#showme {<ffa>Installation process finished.}
}
#ALIAS {history}
{
#script {exec} {ls -l archive/bin};
#NOP #if {&exec[] == 0};
#if {"$exec[1]" == "total 0"}
{
#showme <ffa>No archived binaries found.;
#return
};
#math count 0;
#variable history {};
#foreach {$exec[-20..-1]} {binary}
{
#regexp {$binary} {%d-%d-%d_%d:%d:%d_tt++}
{
#var date {&1-&2-&3 &4:&5:&6};#math count $count + 1;#list history insert 1 {&0};#echo {<afa>%+3s<ffa> - <afa>tt++<ffa> - <afa>%s} {$count} {$date}
}
}
}
#ALIAS {revert}
{
#if {{%0} == {}}
{
#script {exec} {ls -l archive/bin};
#if {&exec[] == 0}
{
#showme <ffa>No archived binaries found.;
#return
};
#showme {<ffa>You can revert to one of the following binaries:};
#math count 0;
#foreach {$exec[-20..-1]} {binary}
{
#regexp {$binary} {%d-%d-%d_%d:%d:%d_tt++}
{
#var date {&1-&2-&3 &4:&5:&6};#math count $count + 1;#list history insert 1 {&0};#echo {<afa>%+3s<ffa> - <afa>tt++<ffa> - <afa>%s} {$count} {$date}
}
};
#showme <ffa>Use: revert <number> to revert.
};
#else
{
#if {%0 >= -20 && %0 < 0}
{
#script {exec} {ls -l archive/bin};
#if {&exec[] == 0}
{
#showme <ffa>No archived binaries found.;
#return
};
#foreach {$exec[-1..-20]} {binary}
{
#regexp {$binary} {%d-%d-%d_%d:%d:%d_tt++}
{
#var date {&1-&2-&3 &4:&5:&6};#math count $count - 1;#list history insert 1 {&0};
}
};
#if {&history[%0]}
{
#system {cp -f /archive/bin/tt++_$history[%0] /usr/local/tt++};
#showme {<afa>/archive/bin/tt++_$history[%0]<ffa> copied to <afa>/usr/local/tt++}
}
};
#else
{
#showme <ffa>Use: revert <number> to revert.
}
}
}