Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------------------------------------------------------
- -- WARNING!!! --
- -- FFRepo for ComputerCraft will not be supported anymore. --
- -- If you want to continue using FFRepo, use OpenComputers --
- -- version instead. --
- -- http://pastebin.com/BUGDqGMB --
- -------------------------------------------------------------
- -- FFRepo installing program
- -- Made by YuRaNnNzZZ (topgamer) and Sanovskiy (pater)
- local basedir = '/ffbin'
- local baseurl = 'http://ffgs.ru/ffrepo/get/raw/true/search/by_name/value/'
- local prog = {'ffrepoConfig', 'ffrepoInit', 'ffrepo', 'ffrepoApi'}
- print('Installing ffrepo...')
- print('Installing JSON library... ')
- shell.run('pastebin', 'get', '4nRg9CHU', basedir .. '/json')
- term.write('Checking target directory... ')
- if fs.exists(basedir) then
- if not fs.isDir(basedir) then
- print('Deleted file, created directory.')
- fs.delete(basedir) -- установка любой ценой
- fs.makeDir(basedir)
- else
- print('OK.')
- end
- else
- print('Created.')
- fs.makeDir(basedir)
- end
- print('Installing core modules...')
- for key,val in pairs(prog) do
- term.write(' ' .. val .. '... ')
- targetDir = basedir
- local dl = http.get(baseurl .. val)
- local code = dl.readAll()
- dl.close()
- if string.len(code) < 1 then
- error('Failed.')
- end
- if val == 'ffrepoConfig' then
- targetDir = '/'
- end
- local filename = targetDir .. '/' .. val
- local installing = fs.open(filename, "w")
- installing.write(code)
- installing.close()
- print('Done.')
- end
- print('Core modules installed.')
- local startupname = '/startup'
- if fs.exists(startupname) then
- startupname = '/startup.ffrepo'
- print('Looks like you already have startup file.')
- print('You might need to add this string to your startup file:')
- print('shell.run("ffbin/ffrepoInit")')
- end
- local initfile = fs.open(startupname, 'w')
- initfile.write('shell.run("ffbin/ffrepoInit")')
- initfile.close()
- print('Startup file saved to: ' .. startupname)
- print('Have a nice day.')
- if startupname == '/startup' then
- print('Your system will be restarted in 10 seconds.')
- sleep(10)
- os.reboot()
- end
Advertisement
Add Comment
Please, Sign In to add comment