dependency installation fixed

This commit is contained in:
shijimasoft 2023-09-16 15:02:28 +02:00
parent 0625e7484f
commit 91f845c44d

View File

@ -4,31 +4,37 @@ log : File = File.new "cia-unix.log", "w"
log.puts Time.utc.to_s
# dependencies check
tools = ["python2.7", "./ctrtool", "./makerom", "decrypt.py"]
tools = ["python2.7", "./ctrtool", "./makerom", "decrypt.py", "seeddb.bin"]
tools.each do |tool|
if !File.exists? %x[which #{tool}].chomp
case tool
when "python2.7"
case tool
when "python2.7"
if !File.exists? %x[which #{tool}].chomp
log.delete if File.exists? "cia-unix.log"
puts "#{"Python 2.7".colorize.mode(:bold)} not found. Install it before continue"
abort "https://www.python.org/download/releases/2.7/"
when "decrypt.py"
if !File.exists? "decrypt.py"
log.delete if File.exists? "cia-unix.log"
abort "#{tool.colorize.mode(:bold)} not found. Make sure it's located in the #{"same directory".colorize.mode(:underline)}" if !File.exists? tool
end
else
print "Some #{"tools".colorize.mode(:bold)} are missing, do you want to download them? (y/n): "
if ["y", "Y"].includes? gets.to_s
system "./dltools.sh"
else
log.delete if File.exists? "cia-unix.log"
abort "#{tool.lchop("./").colorize.mode(:bold)} not found. Make sure it's located in the #{"same directory".colorize.mode(:underline)}"
end
end
when "./ctrtool", "./makerom"
if !File.exists? %x[which #{tool}].chomp
log.delete if File.exists? "cia-unix.log"
download_dep
abort "#{tool.lchop("./").colorize.mode(:bold)} not found. Make sure it's located in the #{"same directory".colorize.mode(:underline)}" if !File.exists? tool
end
when "decrypt.py", "seeddb.bin"
if !File.exists? tool
log.delete if File.exists? "cia-unix.log"
download_dep
abort "#{tool.colorize.mode(:bold)} not found. Make sure it's located in the #{"same directory".colorize.mode(:underline)}" if !File.exists? tool
end
end
end
def download_dep
print "Some #{"tools".colorize.mode(:bold)} are missing, do you want to download them? (y/n): "
if ["y", "Y"].includes? gets.to_s
system "./dltools.sh"
end
end
# roms presence check
if Dir["*.cia"].size.zero? && Dir["*.3ds"].size.zero?
log.delete if File.exists? "cia-unix.log"