git @ Cat's Eye Technologies Funicular / 25785bf
Support a dist_script being run on host when building dist image. Chris Pressey 9 years ago
2 changed file(s) with 25 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
2020 cp distrepos/c64-demo-depot/ribos/ribos.prg device8/ribos
2121 cp distrepos/disksumo/bin/disksumo.prg device8/disksumo
2222 ]],
23 dist_instructions = [[
24 Use Commodore DOS copy commands to copy files from drive 8 to drive 9.
23 dist_script = [[
24 cd device8
25 for FILENAME in *; do
26 c1541 -attach ../dist.d64 -write "$FILENAME"
27 done
28 cd ..
29 c1541 -attach dist.d64 -dir
2530 ]],
2631 }
182182
183183 function basename(filename)
184184 return filename:match("^.+/(.-)$")
185 end
186
187
188 function write_out(filename, contents)
189 local file = io.open(filename, "w")
190 file:write(contents)
191 io.close(file)
192185 end
193186
194187
203196 if exit_code ~= 0 then
204197 os.exit(1)
205198 end
199 end
200
201
202 function write_out(filename, contents)
203 local file = io.open(filename, "w")
204 file:write(contents)
205 io.close(file)
206 end
207
208
209 function run_script(funicular, contents)
210 write_out("script.sh", contents)
211 execute(funicular, "sh -e -x ./script.sh")
212 execute(funicular, "rm ./script.sh")
206213 end
207214
208215
366373 print("Error: Funicularfile must define a setup_script")
367374 os.exit(1)
368375 end
369 write_out("populate.sh", funicular.setup_script)
370 execute(funicular, "sh -e ./populate.sh")
371 execute(funicular, "rm ./populate.sh")
376 run_script(funicular, funicular.setup_script)
372377 else
373378 if funicular.platform.setup_command == nil then
374379 print("Error: platform must define a setup_command")
399404 =========================
400405 ]]
401406 print(funicular.dist_instructions)
407 end
408 if funicular.dist_script then
409 run_script(funicular, funicular.dist_script)
402410 end
403411 execute(funicular, funicular.platform.architecture.emulator_mode.dist_command)
404412 else