Debian Codegraph @

mk/linux/tools-for-standalone-client/installer/scripts/config.lua

raw
1 local GAME_INSTALL_SIZE = 705000000;
2 local GAME_VERSION = "3.13.0";
3
4 local _ = MojoSetup.translate
5
6 Setup.Package
7 {
8 vendor = "megaglest.org",
9 id = "megaglest",
10 description = _("MegaGlest v" .. GAME_VERSION),
11 version = GAME_VERSION,
12 splash = "glestforumsheader.bmp",
13 superuser = false,
14 write_manifest = true,
15 support_uninstall = true,
16 recommended_destinations =
17 {
18 MojoSetup.info.homedir,
19 "/opt/games",
20 "/usr/local/games"
21 },
22
23 precheck = function(package)
24 -- MojoSetup.msgbox('Test#1', MojoSetup.info.homedir .. '/megaglest/uninstall-megaglest.sh')
25
26 local previousPath = ''
27 if MojoSetup.platform.exists(MojoSetup.info.homedir .. '/megaglest/uninstall-megaglest.sh') then
28 previousPath = MojoSetup.info.homedir .. '/megaglest/'
29 elseif MojoSetup.platform.exists('/opt/games/megaglest/uninstall-megaglest.sh') then
30 previousPath = '/opt/games/megaglest/'
31 elseif MojoSetup.platform.exists('/usr/local/games/megaglest/uninstall-megaglest.sh') then
32 previousPath = '/usr/local/games/megaglest/'
33 end
34
35 if previousPath ~= '' then
36 if MojoSetup.promptyn(_("MegaGlest Uninstall Title"), _("MegaGlest Uninstall Prompt") .. '\n\n[' .. previousPath .. ']') then
37 os.execute(previousPath .. 'uninstall-megaglest.sh')
38 end
39
40 end
41 end,
42
43 preinstall = function(package)
44 local previousPath = ''
45 if MojoSetup.platform.exists(MojoSetup.info.homedir .. '/megaglest/mydata/') then
46 previousPath = MojoSetup.info.homedir .. '/megaglest/'
47 elseif MojoSetup.platform.exists('/opt/games/megaglest/mydata/') then
48 previousPath = '/opt/games/megaglest/'
49 elseif MojoSetup.platform.exists('/usr/local/games/megaglest/mydata/') then
50 previousPath = '/usr/local/games/megaglest/'
51 end
52
53 -- Move mod data folder to new location if we find it
54 if previousPath ~= '' then
55 local instPathData = MojoSetup.info.homedir .. '/.megaglest/'
56 local instPath = instPathData
57 -- MojoSetup.msgbox('Moving mod folder','About to move mod folder from [' .. previousPath .. '] to [' .. instPath .. ']')
58
59 os.execute('mkdir ' .. instPathData)
60 os.execute('mv ' .. previousPath .. 'mydata/* ' .. instPath)
61 os.execute('mv ' .. previousPath .. 'glestuser.ini ' .. instPath .. 'glestuser.ini')
62 end
63 end,
64
65 postinstall = function(package)
66 if MojoSetup.promptyn(_("MegaGlest Visit Website Title"), _("MegaGlest Visit Website Prompt")) then
67 MojoSetup.launchbrowser("http://megaglest.org/get-started.html")
68 end
69 end,
70
71 postuninstall = function(package)
72 -- Cleanup additional files
73 if MojoSetup.destination ~= '' then
74 if MojoSetup.platform.exists(MojoSetup.destination .. '/lib/') then
75 os.execute('rm -rf ' .. MojoSetup.destination .. '/lib/')
76 end
77 if MojoSetup.platform.exists(MojoSetup.destination) then
78 os.execute('rm -rf ' .. MojoSetup.destination)
79 end
80 end
81 end,
82
83 Setup.Eula
84 {
85 description = _("MegaGlest Game License"),
86 source = _("docs/gnu_gpl_3.0.txt")
87 },
88
89 Setup.Eula
90 {
91 description = _("MegaGlest Data License"),
92 source = _("docs/cc-by-sa-3.0-unported.txt")
93 },
94
95 Setup.Readme
96 {
97 description = _("MegaGlest README"),
98 source = _("docs/README.txt")
99 },
100
101 Setup.Option
102 {
103 value = true,
104 required = true,
105 disabled = false,
106 bytes = GAME_INSTALL_SIZE,
107 description = _("MegaGlest v" .. GAME_VERSION),
108
109 Setup.File
110 {
111 -- Just install everything we see...
112 source = "base:///mgdata.tar.xz",
113 },
114
115 Setup.DesktopMenuItem
116 {
117 disabled = false,
118 name = _("MegaGlest v" .. GAME_VERSION),
119 genericname = _("MegaGlest"),
120 tooltip = _("A real time strategy game."),
121 builtin_icon = false,
122 icon = "megaglest.png",
123 commandline = "%0/start_megaglest",
124 category = "Game;StrategyGame"
125 },
126
127 Setup.DesktopMenuItem
128 {
129 disabled = false,
130 name = _("MegaGlest Map Editor v" .. GAME_VERSION),
131 genericname = _("MegaGlest"),
132 tooltip = _("A real time strategy game."),
133 builtin_icon = false,
134 icon = "megaglest.png",
135 commandline = "%0/start_megaglest_mapeditor",
136 category = "Game;StrategyGame",
137 --mimetype = {"application/x-gbm", "application/mgm"}
138 },
139
140 Setup.DesktopMenuItem
141 {
142 disabled = false,
143 name = _("MegaGlest G3D Model Viewer v" .. GAME_VERSION),
144 genericname = _("MegaGlest"),
145 tooltip = _("A real time strategy game."),
146 builtin_icon = false,
147 icon = "megaglest.png",
148 commandline = "%0/start_megaglest_g3dviewer",
149 category = "Game;StrategyGame",
150 --mimetype = {"application/x-g3d"}
151 },
152
153 Setup.DesktopMenuItem
154 {
155 disabled = false,
156 name = _("MegaGlest Uninstall v" .. GAME_VERSION),
157 genericname = _("MegaGlest"),
158 tooltip = _("A real time strategy game."),
159 builtin_icon = false,
160 icon = "megaglest-uninstall.ico",
161 commandline = "%0/uninstall-megaglest.sh",
162 category = "Game;StrategyGame"
163 }
164
165 }
166 }
167
168 -- end of config.lua ...
169