-
Notifications
You must be signed in to change notification settings - Fork 7
/
appupdate.tcl
135 lines (104 loc) · 3.56 KB
/
appupdate.tcl
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
#!/usr/local/bin/tclsh
cd "[file dirname [info script]]/"
source "pkgIndex.tcl"
package require de1_updater
# do an app update on the de1plus code base, if this is a de1plus machine
if {[file exists "de1plus.tcl"] == 1} {
package provide de1plus 1.0
}
determine_if_android
#source pkgIndex.tcl
#package require de1_utils
#package require snit
package require sha256
package require crc32
package require http 2.5
package require tls 1.6
::http::register https 443 ::tls::socket
set ::settings(logfile) "updatelog.txt"
# always log app updates
set ::settings(log_enabled) 1
# if using this tool, always update to the latest release version, never to a beta version
set ::settings(app_updates_beta_enabled) 0
set debugcnt 0
set bk "/sdcard/backup_de1plus"
set tmp "/sdcard/de1plus_new"
set dest "/sdcard/de1plus"
set restore "/sdcard/previous_de1plus"
proc translate {x} {return $x}
set tk ""
catch {
set tk [package present Tk]
}
if {$tk != ""} {
button .hello -text "Update Decent App" -command {
catch { .hello configure -text "Working" }
catch { pack forget .frame; }
start_app_update;
after 3000 exit;
} -height 10 -width 40
frame .frame -border 2
button .frame.redownloadapp -text " Redownload entire app " -command {
catch { .hello configure -text "Working" ; update}
catch { file delete "manifest.txt"; }
catch { file delete "timestamp.txt"; }
catch { pack forget .frame; }
catch { start_app_update;}
exit
}
button .frame.exitapp -text " --- Exit --- " -command { exit }
button .frame.resetapp -text " Reset settings " -command {
catch { file delete "settings.tdb"; } ;
exit
}
button .frame.iconcreate -text " Create icon " -command {
catch {
source "pkgIndex.tcl"
catch {
# john 4-11-20 Android 10 is failing on this script, if we don't include these two dependencies
package require snit
package require de1_updater
}
package require de1_main
package require de1_gui
cd "[file dirname [info script]]"
install_de1plus_app_icon
after 1000 exit
}
}
button .frame.resetskin -text " Reset skin " -command {
reset_skin
exit
}
button .frame.restorebk -text " Restore backup " -command {
if {[file exists $bk] != 1} {
catch { .hello configure -text "Sorry, there is no backup to restore." }
} else {
catch { .hello configure -text "Preparing destination."; update }
file delete -force -- ${tmp}/
file delete -force -- ${restore}/
catch { .hello configure -text "Copying backup."; update }
file copy $bk $tmp
catch { .hello configure -text "Renaming current directory."; update }
file rename $dest $restore
catch { .hello configure -text "Renaming new copy."; update }
file rename $tmp $dest
catch { .hello configure -text "Done."; update }
after 1000 exit
}
}
pack .hello -pady 10 -padx 10
pack .frame -side bottom -pady 0 -padx 0
pack .frame.resetapp -side left -pady 10 -padx 10
pack .frame.iconcreate -side left -pady 10 -padx 10
pack .frame.resetskin -side left -pady 10 -padx 10
# display the 'restore backup' button if a backup is available
if {[file exists $bk] == 1} {
pack .frame.restorebk -side left -pady 10 -padx 10
}
# john 13-11-19 taking away this button as many users click it and it causes huge downloads.
# better to ask them to redownload the entire app from our web site https://decentespresso.com/downloads
#pack .frame.redownloadapp -side right -pady 10 -padx 10
pack .frame.exitapp -side right -pady 10 -padx 50
.hello configure -text "[ifexists ::de1(app_update_button_label)] Update app"
}